Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBFontGlyphCache Class Reference

TBFontGlyphCache caches glyphs for font faces. More...

#include <tb_font_renderer.h>

Inheritance diagram for tb::TBFontGlyphCache:
tb::TBRendererListener

Public Member Functions

TBFontGlyphGetGlyph (const TBID &hash_id, UCS4 cp)
 Get the glyph or nullptr if it is not in the cache. More...
 
TBFontGlyphCreateAndCacheGlyph (const TBID &hash_id, UCS4 cp)
 Create the glyph and put it in the cache. More...
 
TBBitmapFragmentCreateFragment (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...
 

Detailed Description

TBFontGlyphCache caches glyphs for font faces.

Rendered glyphs use bitmap fragments from its fragment manager.

Member Function Documentation

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.

void tb::TBFontGlyphCache::OnContextLost ( )
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.

void tb::TBFontGlyphCache::OnContextRestored ( )
virtual

Called when the context has been restored again, and new TBBitmaps can be created again.

Implements tb::TBRendererListener.


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