Font cache for fonts that are based on a freetype font. More...
Public Member Functions | |
SpriteFontCache (FontSize fs) | |
Create a new sprite font cache. | |
~SpriteFontCache () | |
Free everything we allocated. | |
virtual SpriteID | GetUnicodeGlyph (WChar key) |
Get the SpriteID mapped to the given key. | |
virtual void | SetUnicodeGlyph (WChar key, SpriteID sprite) |
Map a SpriteID to the key. | |
virtual void | InitializeUnicodeGlyphMap () |
Initialize the glyph map. | |
virtual void | ClearFontCache () |
Clear the font cache. | |
virtual const Sprite * | GetGlyph (GlyphID key) |
Get the glyph (sprite) of the given key. | |
virtual uint | GetGlyphWidth (GlyphID key) |
Get the width of the glyph with the given key. | |
virtual bool | GetDrawGlyphShadow () |
Do we need to draw a glyph shadow? | |
virtual GlyphID | MapCharToGlyph (WChar key) |
Map a character into a glyph. | |
virtual const void * | GetFontTable (uint32 tag, size_t &length) |
Read a font table from the font. | |
Private Member Functions | |
void | ClearGlyphToSpriteMap () |
Clear the glyph to sprite mapping. | |
Private Attributes | |
SpriteID ** | glyph_to_spriteid_map |
Mapping of glyphs to sprite IDs. |
Font cache for fonts that are based on a freetype font.
Definition at line 67 of file fontcache.cpp.
SpriteFontCache::SpriteFontCache | ( | FontSize | fs | ) |
Create a new sprite font cache.
fs | The font size to create the cache for. |
Definition at line 90 of file fontcache.cpp.
References InitializeUnicodeGlyphMap().
virtual void SpriteFontCache::ClearFontCache | ( | ) | [inline, virtual] |
bool SpriteFontCache::GetDrawGlyphShadow | ( | ) | [virtual] |
Do we need to draw a glyph shadow?
Implements FontCache.
Definition at line 179 of file fontcache.cpp.
virtual const void* SpriteFontCache::GetFontTable | ( | uint32 | tag, | |
size_t & | length | |||
) | [inline, virtual] |
Read a font table from the font.
tag | The of the table to load. | |
length | The length of the read data. |
Implements FontCache.
Definition at line 83 of file fontcache.cpp.
Get the glyph (sprite) of the given key.
key | The key to look up. |
Implements FontCache.
Definition at line 165 of file fontcache.cpp.
References GetUnicodeGlyph(), and ST_FONT.
uint SpriteFontCache::GetGlyphWidth | ( | GlyphID | key | ) | [virtual] |
Get the width of the glyph with the given key.
key | The key to look up. |
Implements FontCache.
Definition at line 172 of file fontcache.cpp.
References FontCache::fs, GetUnicodeGlyph(), and ST_FONT.
Get the SpriteID mapped to the given key.
key | The key to get the sprite for. |
Implements FontCache.
Referenced by GetGlyph(), and GetGlyphWidth().
Map a character into a glyph.
key | The character. |
Implements FontCache.
Definition at line 82 of file fontcache.cpp.
Map a SpriteID to the key.
key | The key to map to. | |
sprite | The sprite that is being mapped. |
Implements FontCache.
Referenced by InitializeUnicodeGlyphMap().