STLL  0.0
Simple Text Layouting Library
STLL::FontCache_c Class Reference

this class encapsulates open fonts of a single library, it makes sure that each font is open only once More...

Public Member Functions

 FontCache_c (std::shared_ptr< FreeTypeLibrary_c > l)
 Create a cache using a specific library. More...
 
 FontCache_c (void)
 Create a cache using an instance of the FreeType library that is created specifically for this cache instance. More...
 
Font_c getFont (const FontResource_c &res, uint32_t size)
 Get a font face from this cache with the given resource and size. More...
 
std::shared_ptr< FontFace_cgetFont (const internal::FontFileResource_c &res, uint32_t size)
 
void clear (void)
 remove all fonts from the cache, fonts that are still in use will be kept, but all others are removed More...
 

Detailed Description

this class encapsulates open fonts of a single library, it makes sure that each font is open only once

Constructor & Destructor Documentation

STLL::FontCache_c::FontCache_c ( std::shared_ptr< FreeTypeLibrary_c l)
inline

Create a cache using a specific library.

I am not really sure where is might be useful to use multiple caches on one library... though

STLL::FontCache_c::FontCache_c ( void  )
inline

Create a cache using an instance of the FreeType library that is created specifically for this cache instance.

This is usually the thing you need, create one instance of this class per thread of your application that needs to access the library

Member Function Documentation

void STLL::FontCache_c::clear ( void  )
inline

remove all fonts from the cache, fonts that are still in use will be kept, but all others are removed

Font_c STLL::FontCache_c::getFont ( const FontResource_c res,
uint32_t  size 
)

Get a font face from this cache with the given resource and size.

If there is already one instance of this font open, it will be used otherwise a new one will be opened.

Parameters
resThe resource to use to create the font instance
idxthe index, which font do we want to get from the ressource
sizeThe requested size
Returns
The instance of the font face
std::shared_ptr<FontFace_c> STLL::FontCache_c::getFont ( const internal::FontFileResource_c &  res,
uint32_t  size 
)

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