#include <GlyphCache.h>
Public Member Functions | |
int | Create (int iCacheSize, int glyphBitmapWidth, int glyphBitmapHeight, FontSmoothMethod smoothMethod, FontSmoothAmount smoothAmount, float sizeRatio) |
int | Release () |
int | LoadFontFromFile (const AZStd::string &fileName) |
int | LoadFontFromMemory (unsigned char *fileBuffer, int dataSize) |
int | ReleaseFont () |
int | SetEncoding (FT_Encoding encoding) |
FT_Encoding | GetEncoding () |
int | GetGlyphBitmapSize (int *width, int *height) |
void | SetGlyphBitmapSize (int width, int height, float sizeRatio) |
int | PreCacheGlyph (uint32_t character, const AtomFont::GlyphSize &glyphSize=AtomFont::defaultGlyphSize, const FFont::FontHintParams &glyphFlags=FFont::FontHintParams()) |
int | UnCacheGlyph (uint32_t character, const AtomFont::GlyphSize &glyphSize=AtomFont::defaultGlyphSize) |
int | GlyphCached (uint32_t character, const AtomFont::GlyphSize &glyphSize=AtomFont::defaultGlyphSize) |
CacheSlot * | GetLRUSlot () |
CacheSlot * | GetMRUSlot () |
int | GetGlyph (GlyphBitmap **glyph, int *horizontalAdvance, int *width, int *height, int32_t &m_characterOffsetX, int32_t &m_characterOffsetY, uint32_t character, const AtomFont::GlyphSize &glyphSize=AtomFont::defaultGlyphSize, const FFont::FontHintParams &glyphFlags=FFont::FontHintParams()) |
bool | GetMonospaced () const |
Vec2 | GetKerning (uint32_t leftGlyph, uint32_t rightGlyph) |
float | GetAscenderToHeightRatio () |
The glyph cache maps UTF32 codepoints to their corresponding FreeType data.
This cache is used to associate font glyph info (read from FreeType) with UTF32 codepoints. Ultimately the glyph info will be read into a font texture (FontTexture) to avoid future FreeType lookups.
If a FontTexture is missing a glyph that is currently stored in the glyph cache, the cached data can be returned instead of having to be rendered from FreeType again.
int AZ::GlyphCache::GetGlyph | ( | GlyphBitmap ** | glyph, |
int * | horizontalAdvance, | ||
int * | width, | ||
int * | height, | ||
int32_t & | m_characterOffsetX, | ||
int32_t & | m_characterOffsetY, | ||
uint32_t | character, | ||
const AtomFont::GlyphSize & | glyphSize = AtomFont::defaultGlyphSize , |
||
const FFont::FontHintParams & | glyphFlags = FFont::FontHintParams() |
||
) |
Obtains glyph information for the given UTF32 codepoint. This information is obtained from a CacheSlot that corresponds to the given codepoint. If the codepoint doesn't exist within the cache table (m_cacheTable), then the information is obtain from FreeType directly via FontRenderer.
Ultimately the glyph bitmap is copied into a font texture (FontTexture). Once the glyph is copied into the font texture then the font texture is referenced directly rather than relying on the glyph cache or FreeType.