|
OpenTTD
|
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 int | GetHeight () const |
| Get the height of the font. | |
| 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. | |
| virtual const char * | GetFontName () |
| Get the name of this font. | |
Public Member Functions inherited from FontCache | |
| FontCache (FontSize fs) | |
| Create a new font cache. | |
| virtual | ~FontCache () |
| Clean everything up. | |
| FontSize | GetSize () const |
| Get the FontSize of the font. | |
| int | GetAscender () const |
| Get the ascender value of the font. | |
| int | GetDescender () const |
| Get the descender value of the font. | |
| int | GetUnitsPerEM () const |
| Get the units per EM value of the font. | |
| bool | HasParent () |
| Check whether the font cache has a parent. | |
Private Member Functions | |
| void | ClearGlyphToSpriteMap () |
| Clear the glyph to sprite mapping. | |
Private Attributes | |
| SpriteID ** | glyph_to_spriteid_map |
| Mapping of glyphs to sprite IDs. | |
Additional Inherited Members | |
Static Public Member Functions inherited from FontCache | |
| static FontCache * | Get (FontSize fs) |
| Get the font cache of a given font size. | |
Protected Attributes inherited from FontCache | |
| FontCache * | parent |
| The parent of this font cache. | |
| const FontSize | fs |
| The size of the font. | |
| int | height |
| The height of the font. | |
| int | ascender |
| The ascender value of the font. | |
| int | descender |
| The descender value of the font. | |
| int | units_per_em |
| The units per EM value of the font. | |
Font cache for fonts that are based on a freetype font.
Definition at line 70 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 95 of file fontcache.cpp.
References InitializeUnicodeGlyphMap().
|
virtual |
Clear the font cache.
Implements FontCache.
Definition at line 170 of file fontcache.cpp.
References FontCache::fs, and Layouter::ResetFontCache().
|
virtual |
Do we need to draw a glyph shadow?
Implements FontCache.
Definition at line 194 of file fontcache.cpp.
|
inlinevirtual |
Get the name of this font.
Implements FontCache.
Definition at line 88 of file fontcache.cpp.
|
inlinevirtual |
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 87 of file fontcache.cpp.
Get the glyph (sprite) of the given key.
| key | The key to look up. |
Implements FontCache.
Definition at line 175 of file fontcache.cpp.
References GetUnicodeGlyph(), and ST_FONT.
|
virtual |
Get the width of the glyph with the given key.
| key | The key to look up. |
Implements FontCache.
Definition at line 182 of file fontcache.cpp.
References FontCache::fs, FS_NORMAL, GetUnicodeGlyph(), ScaleGUITrad(), and ST_FONT.
|
virtual |
Get the height of the font.
Reimplemented from FontCache.
Definition at line 189 of file fontcache.cpp.
References FontCache::height, and ScaleGUITrad().
Get the SpriteID mapped to the given key.
| key | The key to get the sprite for. |
Implements FontCache.
Definition at line 108 of file fontcache.cpp.
References GB(), and glyph_to_spriteid_map.
Referenced by GetGlyph(), and GetGlyphWidth().
Map a character into a glyph.
| key | The character. |
Implements FontCache.
Definition at line 86 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.
Definition at line 114 of file fontcache.cpp.
References GB(), and glyph_to_spriteid_map.
Referenced by InitializeUnicodeGlyphMap().
1.8.1.2