|
|
Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBFontGlyphCache caches glyphs for font faces. More...
#include <tb_font_renderer.h>
Public Member Functions | |
| TBFontGlyph * | GetGlyph (const TBID &hash_id, UCS4 cp) |
| Get the glyph or nullptr if it is not in the cache. More... | |
| TBFontGlyph * | CreateAndCacheGlyph (const TBID &hash_id, UCS4 cp) |
| Create the glyph and put it in the cache. More... | |
| TBBitmapFragment * | CreateFragment (TBFontGlyph *glyph, int w, int h, int stride, uint32_t *data) |
| Create a bitmap fragment for the given glyph and render data. More... | |
| virtual void | OnContextLost () |
| Called when the context has been lost and all TBBitmaps need to be deleted. More... | |
| virtual void | OnContextRestored () |
| Called when the context has been restored again, and new TBBitmaps can be created again. More... | |
TBFontGlyphCache caches glyphs for font faces.
Rendered glyphs use bitmap fragments from its fragment manager.
| TBFontGlyph * tb::TBFontGlyphCache::CreateAndCacheGlyph | ( | const TBID & | hash_id, |
| UCS4 | cp | ||
| ) |
Create the glyph and put it in the cache.
Returns the glyph, or nullptr on fail.
| TBBitmapFragment * tb::TBFontGlyphCache::CreateFragment | ( | TBFontGlyph * | glyph, |
| int | w, | ||
| int | h, | ||
| int | stride, | ||
| uint32_t * | data | ||
| ) |
Create a bitmap fragment for the given glyph and render data.
This may drop other rendered glyphs from the fragment map. Returns the fragment, or nullptr on fail.
| TBFontGlyph * tb::TBFontGlyphCache::GetGlyph | ( | const TBID & | hash_id, |
| UCS4 | cp | ||
| ) |
Get the glyph or nullptr if it is not in the cache.
|
virtual |
Called when the context has been lost and all TBBitmaps need to be deleted.
NOTE: Only do cleanup here. It's not safe to do work on any bitmap since the context is already lost.
Implements tb::TBRendererListener.
|
virtual |
Called when the context has been restored again, and new TBBitmaps can be created again.
Implements tb::TBRendererListener.