summaryrefslogtreecommitdiff
path: root/src/fontcache.cpp
diff options
context:
space:
mode:
authorGreg Carlin <gregcarlin@users.noreply.github.com>2019-02-23 03:27:46 -0500
committerPeterN <peter@fuzzle.org>2019-02-23 08:27:46 +0000
commit00d28a500d9b2c32877871e0d2b917c8b28a82a6 (patch)
tree4833e57b77c01a0dfa327e546831319336c4cd13 /src/fontcache.cpp
parent56a6d7aec88b170eaf0dd57e14f5fffc24d3b1af (diff)
downloadopenttd-00d28a500d9b2c32877871e0d2b917c8b28a82a6.tar.xz
Feature: Add option to adjust font size separately from GUI size. (#7003)
Adds an option in the "Game Options" next to "Interface Size" called "Font Size". Available options are normal, double, and quad.
Diffstat (limited to 'src/fontcache.cpp')
-rw-r--r--src/fontcache.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 98e8bdf41..9b732ce1e 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -189,7 +189,7 @@ uint SpriteFontCache::GetGlyphWidth(GlyphID key)
int SpriteFontCache::GetHeight() const
{
- return ScaleGUITrad(this->height);
+ return this->height * (1 << (ZOOM_LVL_OUT_4X - _font_zoom));
}
bool SpriteFontCache::GetDrawGlyphShadow()
@@ -293,6 +293,10 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels)
pixels = Clamp(min(head->Lowest_Rec_PPEM, 20) + diff, scaled_height, MAX_FONT_SIZE);
}
}
+
+ /* Apply user-specified font zoom. */
+ pixels *= (1 << (ZOOM_LVL_OUT_4X - _font_zoom));
+
this->used_size = pixels;
FT_Error err = FT_Set_Pixel_Sizes(this->face, 0, pixels);
@@ -438,7 +442,7 @@ void FreeTypeFontCache::ClearFontCache()
Layouter::ResetFontCache(this->fs);
/* GUI scaling might have changed, determine font size anew if it was automatically selected. */
- if (this->face != NULL && this->req_size == 0) this->SetFontSize(this->fs, this->face, this->req_size);
+ if (this->face != NULL) this->SetFontSize(this->fs, this->face, this->req_size);
}
FreeTypeFontCache::GlyphEntry *FreeTypeFontCache::GetGlyphPtr(GlyphID key)