summaryrefslogtreecommitdiff
path: root/src/fontcache.cpp
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2019-02-24 16:27:44 +0000
committerGitHub <noreply@github.com>2019-02-24 16:27:44 +0000
commit195fd0dc60cc895539ac6c04ff83b6f99f739830 (patch)
treef5cbcd397645ae1f1a8075bbc9bd5a85ded86bb0 /src/fontcache.cpp
parent91eee793e1632c124c22ee46911e7de5fb3a2362 (diff)
downloadopenttd-195fd0dc60cc895539ac6c04ff83b6f99f739830.tar.xz
Fix #7266: Reorder reinitialization of caches when changing font zoom level. (#7273)
Diffstat (limited to 'src/fontcache.cpp')
-rw-r--r--src/fontcache.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 604cc7374..2811f1798 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -421,6 +421,9 @@ FreeTypeFontCache::~FreeTypeFontCache()
*/
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;
for (int i = 0; i < 256; i++) {
@@ -438,9 +441,6 @@ void FreeTypeFontCache::ClearFontCache()
this->glyph_to_sprite = NULL;
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)