mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Add ResizeFont function to the fontcache class.
parent
23d1304779
commit
46ebb42fa8
|
@ -148,6 +148,29 @@ static void LoadFontHelper(FontSize fs)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to change the size setting of a font in OpenTTD.
|
||||
* @param font_size FontSize(enum not pixel size) of the font to change.
|
||||
* @param size The new pixel size to use for this font.
|
||||
*/
|
||||
void ResizeFont(FontSize font_size, uint size)
|
||||
{
|
||||
FontCacheSubSetting *setting = GetFontCacheSubSetting(font_size);
|
||||
|
||||
if (setting->size == size) return;
|
||||
|
||||
setting->size = size;
|
||||
|
||||
FontCache *loaded_font = FontCache::Get(font_size);
|
||||
loaded_font->SetFontSize(size);
|
||||
|
||||
LoadStringWidthTable();
|
||||
UpdateAllVirtCoords();
|
||||
ReInitAllWindows(true);
|
||||
|
||||
if (_save_config) SaveToConfig();
|
||||
}
|
||||
|
||||
void SetFont(FontSize font_size, const std::string &font, uint size)
|
||||
{
|
||||
FontCacheSubSetting *setting = GetFontCacheSubSetting(font_size);
|
||||
|
|
|
@ -232,6 +232,7 @@ std::string GetFontCacheFontName(FontSize fs);
|
|||
void DebugPrintFontSettings(const std::string &desc);
|
||||
bool GetFontAAState();
|
||||
void InitFontCache();
|
||||
void ResizeFont(FontSize font_size, uint size);
|
||||
void SetFont(FontSize fontsize, const std::string &font, uint size);
|
||||
void UninitFontCache();
|
||||
|
||||
|
|
Loading…
Reference in New Issue