diff options
Diffstat (limited to 'src/fontcache.cpp')
-rw-r--r-- | src/fontcache.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 778af3440..709b8a7d6 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -737,6 +737,7 @@ public: virtual GlyphID MapCharToGlyph(WChar key); virtual const char *GetFontName() { return WIDE_TO_MB(this->logfont.lfFaceName); } virtual bool IsBuiltInFont() { return false; } + virtual void *GetOSHandle() { return &this->logfont; } }; @@ -960,13 +961,16 @@ static void LoadWin32Font(FontSize fs) LOGFONT logfont; MemSetT(&logfont, 0); - - logfont.lfWeight = strcasestr(settings->font, " bold") != nullptr ? FW_BOLD : FW_NORMAL; // Poor man's way to allow selecting bold fonts. - logfont.lfPitchAndFamily = fs == FS_MONO ? FIXED_PITCH : VARIABLE_PITCH; - logfont.lfCharSet = DEFAULT_CHARSET; - logfont.lfOutPrecision = OUT_OUTLINE_PRECIS; - logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; - convert_to_fs(settings->font, logfont.lfFaceName, lengthof(logfont.lfFaceName), false); + if (settings->os_handle != nullptr) logfont = *(const LOGFONT *)settings->os_handle; + + if (logfont.lfFaceName[0] == 0) { + logfont.lfWeight = strcasestr(settings->font, " bold") != nullptr ? FW_BOLD : FW_NORMAL; // Poor man's way to allow selecting bold fonts. + logfont.lfPitchAndFamily = fs == FS_MONO ? FIXED_PITCH : VARIABLE_PITCH; + logfont.lfCharSet = DEFAULT_CHARSET; + logfont.lfOutPrecision = OUT_OUTLINE_PRECIS; + logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; + convert_to_fs(settings->font, logfont.lfFaceName, lengthof(logfont.lfFaceName), false); + } HFONT font = CreateFontIndirect(&logfont); if (font == nullptr) { |