|
OpenTTD
|
Font cache for basic fonts. More...
#include <fontcache.h>
Public Member Functions | |
| FontCache (FontSize fs) | |
| Create a new font cache. More... | |
| virtual | ~FontCache () |
| Clean everything up. More... | |
| FontSize | GetSize () const |
| Get the FontSize of the font. More... | |
| virtual int | GetHeight () const |
| Get the height of the font. More... | |
| int | GetAscender () const |
| Get the ascender value of the font. More... | |
| int | GetDescender () const |
| Get the descender value of the font. More... | |
| int | GetUnitsPerEM () const |
| Get the units per EM value of the font. More... | |
| virtual SpriteID | GetUnicodeGlyph (WChar key)=0 |
| Get the SpriteID mapped to the given key. More... | |
| virtual void | SetUnicodeGlyph (WChar key, SpriteID sprite)=0 |
| Map a SpriteID to the key. More... | |
| virtual void | InitializeUnicodeGlyphMap ()=0 |
| Initialize the glyph map. | |
| virtual void | ClearFontCache ()=0 |
| Clear the font cache. More... | |
| virtual const Sprite * | GetGlyph (GlyphID key)=0 |
| Get the glyph (sprite) of the given key. More... | |
| virtual uint | GetGlyphWidth (GlyphID key)=0 |
| Get the width of the glyph with the given key. More... | |
| virtual bool | GetDrawGlyphShadow ()=0 |
| Do we need to draw a glyph shadow? More... | |
| virtual GlyphID | MapCharToGlyph (WChar key)=0 |
| Map a character into a glyph. More... | |
| virtual const void * | GetFontTable (uint32 tag, size_t &length)=0 |
| Read a font table from the font. More... | |
| virtual const char * | GetFontName ()=0 |
| Get the name of this font. More... | |
| bool | HasParent () |
| Check whether the font cache has a parent. | |
Static Public Member Functions | |
| static FontCache * | Get (FontSize fs) |
| Get the font cache of a given font size. More... | |
Protected Attributes | |
| 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. | |
Static Private Attributes | |
| static FontCache * | caches [FS_END] = { new SpriteFontCache(FS_NORMAL), new SpriteFontCache(FS_SMALL), new SpriteFontCache(FS_LARGE), new SpriteFontCache(FS_MONO) } |
| All the font caches. | |
Font cache for basic fonts.
Definition at line 23 of file fontcache.h.
| FontCache::FontCache | ( | FontSize | fs | ) |
Create a new font cache.
| fs | The size of the font. |
Definition at line 40 of file fontcache.cpp.
|
virtual |
Clean everything up.
Definition at line 50 of file fontcache.cpp.
|
pure virtual |
Clear the font cache.
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetUnitsPerEM().
Get the font cache of a given font size.
| fs | The font size to look up. |
Definition at line 133 of file fontcache.h.
Referenced by GetCharacterHeight(), GetGlyph(), GetGlyphWidth(), GetUnicodeGlyph(), and SetUnicodeGlyph().
|
inline |
Get the ascender value of the font.
Definition at line 53 of file fontcache.h.
References ascender.
|
inline |
Get the descender value of the font.
Definition at line 59 of file fontcache.h.
References descender.
|
pure virtual |
Do we need to draw a glyph shadow?
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetGlyphWidth(), and GetUnitsPerEM().
|
pure virtual |
Get the name of this font.
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetUnitsPerEM().
|
pure virtual |
Read a font table from the font.
| tag | The of the table to load. |
| length | The length of the read data. |
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetUnitsPerEM().
Get the glyph (sprite) of the given key.
| key | The key to look up. |
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetGlyph(), and GetUnitsPerEM().
|
pure virtual |
Get the width of the glyph with the given key.
| key | The key to look up. |
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetGlyphWidth(), and GetUnitsPerEM().
|
inlinevirtual |
Get the height of the font.
Reimplemented in SpriteFontCache.
Definition at line 47 of file fontcache.h.
References height.
Referenced by GetCharacterHeight().
|
inline |
Get the FontSize of the font.
Definition at line 41 of file fontcache.h.
References fs.
Get the SpriteID mapped to the given key.
| key | The key to get the sprite for. |
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetUnicodeGlyph(), FreeTypeFontCache::GetUnicodeGlyph(), and GetUnitsPerEM().
|
inline |
Get the units per EM value of the font.
Definition at line 65 of file fontcache.h.
References ClearFontCache(), GetDrawGlyphShadow(), GetFontName(), GetFontTable(), GetGlyph(), GetGlyphWidth(), GetUnicodeGlyph(), InitializeUnicodeGlyphMap(), MapCharToGlyph(), SetUnicodeGlyph(), and units_per_em.
Map a character into a glyph.
| key | The character. |
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetGlyph(), GetGlyphWidth(), and GetUnitsPerEM().
Map a SpriteID to the key.
| key | The key to map to. |
| sprite | The sprite that is being mapped. |
Implemented in FreeTypeFontCache, and SpriteFontCache.
Referenced by GetUnitsPerEM(), SetUnicodeGlyph(), and FreeTypeFontCache::SetUnicodeGlyph().
1.8.13