Public Member Functions | Private Member Functions | Private Attributes

SpriteFontCache Class Reference

Font cache for fonts that are based on a freetype font. More...

Inheritance diagram for SpriteFontCache:
FontCache

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 SpriteGetGlyph (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.
virtual const char * GetFontName ()
 Get the name of this 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.

Detailed Description

Font cache for fonts that are based on a freetype font.

Definition at line 67 of file fontcache.cpp.


Constructor & Destructor Documentation

SpriteFontCache::SpriteFontCache ( FontSize  fs  ) 

Create a new sprite font cache.

Parameters:
fs The font size to create the cache for.

Definition at line 91 of file fontcache.cpp.

References InitializeUnicodeGlyphMap().


Member Function Documentation

void SpriteFontCache::ClearFontCache (  )  [virtual]

Clear the font cache.

Implements FontCache.

Definition at line 166 of file fontcache.cpp.

References FontCache::fs, and Layouter::ResetFontCache().

bool SpriteFontCache::GetDrawGlyphShadow (  )  [virtual]

Do we need to draw a glyph shadow?

Returns:
True if it has to be done, otherwise false.

Implements FontCache.

Definition at line 185 of file fontcache.cpp.

virtual const char* SpriteFontCache::GetFontName (  )  [inline, virtual]

Get the name of this font.

Returns:
The name of the font.

Implements FontCache.

Definition at line 84 of file fontcache.cpp.

virtual const void* SpriteFontCache::GetFontTable ( uint32  tag,
size_t &  length 
) [inline, virtual]

Read a font table from the font.

Parameters:
tag The of the table to load.
length The length of the read data.
Returns:
The loaded table data.

Implements FontCache.

Definition at line 83 of file fontcache.cpp.

const Sprite * SpriteFontCache::GetGlyph ( GlyphID  key  )  [virtual]

Get the glyph (sprite) of the given key.

Parameters:
key The key to look up.
Returns:
The sprite.

Implements FontCache.

Definition at line 171 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.

Parameters:
key The key to look up.
Returns:
The width.

Implements FontCache.

Definition at line 178 of file fontcache.cpp.

References FontCache::fs, GetUnicodeGlyph(), and ST_FONT.

virtual SpriteID SpriteFontCache::GetUnicodeGlyph ( WChar  key  )  [virtual]

Get the SpriteID mapped to the given key.

Parameters:
key The key to get the sprite for.
Returns:
The sprite.

Implements FontCache.

Referenced by GetGlyph(), and GetGlyphWidth().

virtual GlyphID SpriteFontCache::MapCharToGlyph ( WChar  key  )  [inline, virtual]

Map a character into a glyph.

Parameters:
key The character.
Returns:
The glyph ID used to draw the character.

Implements FontCache.

Definition at line 82 of file fontcache.cpp.

virtual void SpriteFontCache::SetUnicodeGlyph ( WChar  key,
SpriteID  sprite 
) [virtual]

Map a SpriteID to the key.

Parameters:
key The key to map to.
sprite The sprite that is being mapped.

Implements FontCache.

Referenced by InitializeUnicodeGlyphMap().


The documentation for this class was generated from the following file: