mirror of https://github.com/OpenTTD/OpenTTD
parent
91eee793e1
commit
195fd0dc60
|
@ -421,6 +421,9 @@ FreeTypeFontCache::~FreeTypeFontCache()
|
||||||
*/
|
*/
|
||||||
void FreeTypeFontCache::ClearFontCache()
|
void FreeTypeFontCache::ClearFontCache()
|
||||||
{
|
{
|
||||||
|
/* Font scaling might have changed, determine font size anew if it was automatically selected. */
|
||||||
|
if (this->face != NULL) this->SetFontSize(this->fs, this->face, this->req_size);
|
||||||
|
|
||||||
if (this->glyph_to_sprite == NULL) return;
|
if (this->glyph_to_sprite == NULL) return;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
|
@ -438,9 +441,6 @@ void FreeTypeFontCache::ClearFontCache()
|
||||||
this->glyph_to_sprite = NULL;
|
this->glyph_to_sprite = NULL;
|
||||||
|
|
||||||
Layouter::ResetFontCache(this->fs);
|
Layouter::ResetFontCache(this->fs);
|
||||||
|
|
||||||
/* GUI scaling might have changed, determine font size anew if it was automatically selected. */
|
|
||||||
if (this->face != NULL) this->SetFontSize(this->fs, this->face, this->req_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeTypeFontCache::GlyphEntry *FreeTypeFontCache::GetGlyphPtr(GlyphID key)
|
FreeTypeFontCache::GlyphEntry *FreeTypeFontCache::GetGlyphPtr(GlyphID key)
|
||||||
|
|
|
@ -1131,13 +1131,14 @@ TextColour GetContrastColour(uint8 background, uint8 threshold)
|
||||||
*/
|
*/
|
||||||
void LoadStringWidthTable(bool monospace)
|
void LoadStringWidthTable(bool monospace)
|
||||||
{
|
{
|
||||||
|
ClearFontCache();
|
||||||
|
|
||||||
for (FontSize fs = monospace ? FS_MONO : FS_BEGIN; fs < (monospace ? FS_END : FS_MONO); fs++) {
|
for (FontSize fs = monospace ? FS_MONO : FS_BEGIN; fs < (monospace ? FS_END : FS_MONO); fs++) {
|
||||||
for (uint i = 0; i != 224; i++) {
|
for (uint i = 0; i != 224; i++) {
|
||||||
_stringwidth_table[fs][i] = GetGlyphWidth(fs, i + 32);
|
_stringwidth_table[fs][i] = GetGlyphWidth(fs, i + 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearFontCache();
|
|
||||||
ReInitAllWindows();
|
ReInitAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -556,16 +556,15 @@ struct GameOptionsWindow : Window {
|
||||||
GfxClearSpriteCache();
|
GfxClearSpriteCache();
|
||||||
_gui_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
|
_gui_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
|
||||||
UpdateCursorSize();
|
UpdateCursorSize();
|
||||||
LoadStringWidthTable();
|
|
||||||
UpdateAllVirtCoords();
|
UpdateAllVirtCoords();
|
||||||
|
ReInitAllWindows();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GO_FONT_ZOOM_DROPDOWN:
|
case WID_GO_FONT_ZOOM_DROPDOWN:
|
||||||
GfxClearSpriteCache();
|
|
||||||
_font_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
|
_font_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
|
||||||
ClearFontCache();
|
ClearFontCache();
|
||||||
|
LoadStringWidthTable();
|
||||||
UpdateAllVirtCoords();
|
UpdateAllVirtCoords();
|
||||||
ReInitAllWindows();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GO_BASE_GRF_DROPDOWN:
|
case WID_GO_BASE_GRF_DROPDOWN:
|
||||||
|
|
Loading…
Reference in New Issue