mirror of https://github.com/OpenTTD/OpenTTD
Codechange: [windows] cache the actually loaded font name
parent
af3df959c2
commit
e6c857cdba
|
@ -378,7 +378,6 @@ Win32FontCache::Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels)
|
||||||
{
|
{
|
||||||
this->dc = CreateCompatibleDC(nullptr);
|
this->dc = CreateCompatibleDC(nullptr);
|
||||||
this->SetFontSize(fs, pixels);
|
this->SetFontSize(fs, pixels);
|
||||||
this->fontname = FS2OTTD(this->logfont.lfFaceName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32FontCache::~Win32FontCache()
|
Win32FontCache::~Win32FontCache()
|
||||||
|
@ -441,7 +440,9 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels)
|
||||||
this->glyph_size.cx = otm->otmTextMetrics.tmMaxCharWidth;
|
this->glyph_size.cx = otm->otmTextMetrics.tmMaxCharWidth;
|
||||||
this->glyph_size.cy = otm->otmTextMetrics.tmHeight;
|
this->glyph_size.cy = otm->otmTextMetrics.tmHeight;
|
||||||
|
|
||||||
Debug(fontcache, 2, "Loaded font '{}' with size {}", FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFullName)), pixels);
|
this->fontname = FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFaceName));
|
||||||
|
|
||||||
|
Debug(fontcache, 2, "Loaded font '{}' with size {}", this->fontname, pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,7 @@ private:
|
||||||
HDC dc = nullptr; ///< Cached GDI device context.
|
HDC dc = nullptr; ///< Cached GDI device context.
|
||||||
HGDIOBJ old_font; ///< Old font selected into the GDI context.
|
HGDIOBJ old_font; ///< Old font selected into the GDI context.
|
||||||
SIZE glyph_size; ///< Maximum size of regular glyphs.
|
SIZE glyph_size; ///< Maximum size of regular glyphs.
|
||||||
std::string fontname; ///< Cached copy of this->logfont.lfFaceName
|
std::string fontname; ///< Cached copy of loaded font facename
|
||||||
|
|
||||||
void SetFontSize(FontSize fs, int pixels);
|
void SetFontSize(FontSize fs, int pixels);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue