Update text-size related caches after changing font details

This commit is contained in:
Jonathan G Rennison
2024-01-15 17:51:33 +00:00
parent d7b75614bb
commit bb22440ab7
4 changed files with 18 additions and 2 deletions

View File

@@ -2286,6 +2286,8 @@ DEF_CONSOLE_CMD(ConFont)
IConsolePrintF(CC_DEFAULT, "%s: \"%s\" %d %s [\"%s\" %d %s]", FontSizeToName(fs), fc->GetFontName().c_str(), fc->GetFontSize(), GetFontAAState(fs) ? "aa" : "noaa", setting->font.c_str(), setting->size, setting->aa ? "aa" : "noaa");
}
FontChanged();
return true;
}

View File

@@ -2222,6 +2222,18 @@ bool AdjustGUIZoom(AdjustGUIZoomMode mode)
return true;
}
void FontChanged()
{
extern void FlushDeparturesWindowTextCaches();
FlushDeparturesWindowTextCaches();
UpdateRouteStepSpriteSize();
SetupWidgetDimensions();
UpdateAllVirtCoords();
ReInitAllWindows(true);
}
void ChangeGameSpeed(bool enable_fast_forward)
{
if (enable_fast_forward) {

View File

@@ -97,6 +97,8 @@ enum AdjustGUIZoomMode {
};
bool AdjustGUIZoom(AdjustGUIZoomMode mode);
void FontChanged();
void RedrawScreenRect(int left, int top, int right, int bottom);
Dimension GetSpriteSize(SpriteID sprid, Point *offset = nullptr, ZoomLevel zoom = ZOOM_LVL_GUI);

View File

@@ -596,8 +596,8 @@ struct GameOptionsWindow : Window {
InitFontCache(false);
InitFontCache(true);
ClearFontCache();
SetupWidgetDimensions();
ReInitAllWindows(true);
FontChanged();
break;
case WID_GO_GUI_FONT_AA: