@@ -34,14 +34,14 @@ private:
|
||||
FT_Face face; ///< The font face associated with this font.
|
||||
|
||||
void SetFontSize(FontSize fs, FT_Face face, int pixels);
|
||||
const void *InternalGetFontTable(uint32 tag, size_t &length) override;
|
||||
const void *InternalGetFontTable(uint32_t tag, size_t &length) override;
|
||||
const Sprite *InternalGetGlyph(GlyphID key, bool aa) override;
|
||||
|
||||
public:
|
||||
FreeTypeFontCache(FontSize fs, FT_Face face, int pixels);
|
||||
~FreeTypeFontCache();
|
||||
void ClearFontCache() override;
|
||||
GlyphID MapCharToGlyph(WChar key) override;
|
||||
GlyphID MapCharToGlyph(char32_t key) override;
|
||||
std::string GetFontName() override { return stdstr_fmt("%s, %s", face->family_name, face->style_name); }
|
||||
bool IsBuiltInFont() override { return false; }
|
||||
const void *GetOSHandle() override { return &face; }
|
||||
@@ -278,7 +278,7 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa)
|
||||
}
|
||||
|
||||
|
||||
GlyphID FreeTypeFontCache::MapCharToGlyph(WChar key)
|
||||
GlyphID FreeTypeFontCache::MapCharToGlyph(char32_t key)
|
||||
{
|
||||
assert(IsPrintable(key));
|
||||
|
||||
@@ -289,7 +289,7 @@ GlyphID FreeTypeFontCache::MapCharToGlyph(WChar key)
|
||||
return FT_Get_Char_Index(this->face, key);
|
||||
}
|
||||
|
||||
const void *FreeTypeFontCache::InternalGetFontTable(uint32 tag, size_t &length)
|
||||
const void *FreeTypeFontCache::InternalGetFontTable(uint32_t tag, size_t &length)
|
||||
{
|
||||
FT_ULong len = 0;
|
||||
FT_Byte *result = nullptr;
|
||||
|
@@ -50,13 +50,13 @@ SpriteFontCache::~SpriteFontCache()
|
||||
this->ClearGlyphToSpriteMap();
|
||||
}
|
||||
|
||||
SpriteID SpriteFontCache::GetUnicodeGlyph(WChar key)
|
||||
SpriteID SpriteFontCache::GetUnicodeGlyph(char32_t key)
|
||||
{
|
||||
if (this->glyph_to_spriteid_map[GB(key, 8, 8)] == nullptr) return 0;
|
||||
return this->glyph_to_spriteid_map[GB(key, 8, 8)][GB(key, 0, 8)];
|
||||
}
|
||||
|
||||
void SpriteFontCache::SetUnicodeGlyph(WChar key, SpriteID sprite)
|
||||
void SpriteFontCache::SetUnicodeGlyph(char32_t key, SpriteID sprite)
|
||||
{
|
||||
if (this->glyph_to_spriteid_map == nullptr) this->glyph_to_spriteid_map = CallocT<SpriteID*>(256);
|
||||
if (this->glyph_to_spriteid_map[GB(key, 8, 8)] == nullptr) this->glyph_to_spriteid_map[GB(key, 8, 8)] = CallocT<SpriteID>(256);
|
||||
|
@@ -17,7 +17,7 @@
|
||||
class SpriteFontCache : public FontCache {
|
||||
private:
|
||||
SpriteID **glyph_to_spriteid_map; ///< Mapping of glyphs to sprite IDs.
|
||||
SpriteID GetUnicodeGlyph(WChar key);
|
||||
SpriteID GetUnicodeGlyph(char32_t key);
|
||||
|
||||
void ClearGlyphToSpriteMap();
|
||||
public:
|
||||
|
@@ -165,7 +165,7 @@ const Sprite *TrueTypeFontCache::GetGlyph(GlyphID key)
|
||||
return this->InternalGetGlyph(key, GetFontAAState(this->fs));
|
||||
}
|
||||
|
||||
const void *TrueTypeFontCache::GetFontTable(uint32 tag, size_t &length)
|
||||
const void *TrueTypeFontCache::GetFontTable(uint32_t tag, size_t &length)
|
||||
{
|
||||
const auto iter = this->font_tables.find(tag);
|
||||
if (iter != this->font_tables.end()) {
|
||||
|
@@ -56,14 +56,14 @@ protected:
|
||||
GlyphEntry *GetGlyphPtr(GlyphID key);
|
||||
void SetGlyphPtr(GlyphID key, const GlyphEntry *glyph, bool duplicate = false);
|
||||
|
||||
virtual const void *InternalGetFontTable(uint32 tag, size_t &length) = 0;
|
||||
virtual const void *InternalGetFontTable(uint32_t tag, size_t &length) = 0;
|
||||
virtual const Sprite *InternalGetGlyph(GlyphID key, bool aa) = 0;
|
||||
|
||||
public:
|
||||
TrueTypeFontCache(FontSize fs, int pixels);
|
||||
virtual ~TrueTypeFontCache();
|
||||
int GetFontSize() const override { return this->used_size; }
|
||||
void SetUnicodeGlyph(WChar key, SpriteID sprite) override { this->parent->SetUnicodeGlyph(key, sprite); }
|
||||
void SetUnicodeGlyph(char32_t key, SpriteID sprite) override { this->parent->SetUnicodeGlyph(key, sprite); }
|
||||
|
||||
virtual void InitializeUnicodeGlyphMap() override
|
||||
{
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
|
||||
const Sprite *GetGlyph(GlyphID key) override;
|
||||
const void *GetFontTable(uint32 tag, size_t &length) override;
|
||||
const void *GetFontTable(uint32_t tag, size_t &length) override;
|
||||
void ClearFontCache() override;
|
||||
uint GetGlyphWidth(GlyphID key) override;
|
||||
bool GetDrawGlyphShadow() override;
|
||||
|
Reference in New Issue
Block a user