summaryrefslogtreecommitdiff
path: root/src/fontcache.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2018-10-28 23:30:49 +0100
committerMichael Lutz <michi@icosahedron.de>2018-12-08 20:13:27 +0100
commit32ce1ce3473253644d1237227706e4f8ce55ab7a (patch)
tree59731354a3b4ced7e0f6040e696ff670e39d2d19 /src/fontcache.cpp
parent4bf216993a1df7a29922bf34e2d8191460842452 (diff)
downloadopenttd-32ce1ce3473253644d1237227706e4f8ce55ab7a.tar.xz
Add: [OSX] Text layout using the native CoreText API.
By default, the native API will be used instead of ICU, but if ICU is forced in using configure, it will take precedence.
Diffstat (limited to 'src/fontcache.cpp')
-rw-r--r--src/fontcache.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 3a5dd886c..55da0c55c 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -210,6 +210,7 @@ class FreeTypeFontCache : public FontCache {
private:
FT_Face face; ///< The font face associated with this font.
int req_size; ///< Requested font size.
+ int used_size; ///< Used font size.
typedef SmallMap<uint32, SmallPair<size_t, const void*> > FontTable; ///< Table with font table cache
FontTable font_tables; ///< Cached font tables.
@@ -243,6 +244,7 @@ private:
public:
FreeTypeFontCache(FontSize fs, FT_Face face, int pixels);
~FreeTypeFontCache();
+ virtual int GetFontSize() const { return this->used_size; }
virtual SpriteID GetUnicodeGlyph(WChar key) { return this->parent->GetUnicodeGlyph(key); }
virtual void SetUnicodeGlyph(WChar key, SpriteID sprite) { this->parent->SetUnicodeGlyph(key, sprite); }
virtual void InitializeUnicodeGlyphMap() { this->parent->InitializeUnicodeGlyphMap(); }
@@ -291,6 +293,7 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels)
pixels = Clamp(min(head->Lowest_Rec_PPEM, 20) + diff, scaled_height, MAX_FONT_SIZE);
}
}
+ this->used_size = pixels;
FT_Error err = FT_Set_Pixel_Sizes(this->face, 0, pixels);
if (err != FT_Err_Ok) {