|
blip
0.1
|
A class for loading and caching TrueType fonts. More...
#include <FontManager.hpp>
Public Member Functions | |
| FontManager (uint_t fontCacheSize=4, uint_t glyphCacheSize=96) | |
| Construct a new FontManager with the given cache sizes. More... | |
| ~FontManager () | |
| Destructor. More... | |
| void | loadFont (ccxx::DataReader *reader, int size, int index=0) |
| Load a font from a DataReader. More... | |
| const Font * | lookupFont (const ccxx::String &name, int size, int style=0) const |
| Look up a font previously loaded with loadFont(). More... | |
A class for loading and caching TrueType fonts.
The class uses the FreeType library to decode the fonts. Fonts can be loaded from files, from memory buffers, or from Android asset files.
| FontManager | ( | uint_t | fontCacheSize = 4, |
| uint_t | glyphCacheSize = 96 |
||
| ) |
Construct a new FontManager with the given cache sizes.
| fontCacheSize | The size of the LRU font cache; this is the maximum number of distinct font faces that may be in memory at any one time. |
| glyphCacheSize | The size of the LRU glyph cache; this is the maximum number of character glyphs that may be in memory for each font face at any one time. |
| ~FontManager | ( | ) |
Destructor.
| void loadFont | ( | ccxx::DataReader * | reader, |
| int | size, | ||
| int | index = 0 |
||
| ) |
Load a font from a DataReader.
The font is added to the internal LRU cache, possibly evicting another font if the cache is already full.
| reader | The DataReader to read the font from. The FontManager takes ownership of the DataReader, which will remain in use as long as glyphs need to be read from the font file. The caller should not release the data resource that is backing this DataReader. |
| size | The desired point size. |
| index | The font face index, if the font file contains more than one font face. Normally this should be 0. |
| IOException | If an error occurred while reading the font. |
| const Font * lookupFont | ( | const ccxx::String & | name, |
| int | size, | ||
| int | style = 0 |
||
| ) | const |
Look up a font previously loaded with loadFont().
| name | The name of the font face. |
| size | The font's point size. |
| style | The font's style; either Font::PLAIN or a bitwise OR of Font::BOLD and Font::ITALIC. |