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.
This commit is contained in:
Michael Lutz
2018-10-28 23:30:49 +01:00
parent 4bf216993a
commit 32ce1ce347
7 changed files with 347 additions and 2 deletions

View File

@@ -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) {