ADi-FontEngine  1.0
PDF Optimized FontEngine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FontEngine::TFontCache Struct Reference

the font cache class More...

#include <FontEngineCache.h>

Classes

struct  TProgress
 the abstract font cache progress bar class More...
 
struct  TSearchIterator
 the font cache search iterator class More...
 

Public Types

typedef FontEngine::TPathVec TPathVec
 
typedef TCacheItem::TUnicodeRange TUnicodeRange
 
typedef TCacheItem::TCIDSet TCIDSet
 
typedef TCacheDBank::iterator TCacheDBankIT
 
typedef TCacheDBank::const_iterator TCacheDBankCIT
 
typedef std::pair
< TCacheDBankCIT,
TCacheDBankCIT
TCacheDBankRes
 
typedef TCacheDBank::TDataIndex TCacheDBankIdx
 
typedef std::multimap
< std::string, TCacheDBankIdx
TAltNameRefMMap
 
typedef
TAltNameRefMMap::const_iterator 
TAltNameRefMMapCIT
 
typedef std::pair
< TAltNameRefMMapCIT,
TAltNameRefMMapCIT
TAltNameRefMMapR
 
typedef TSearchIterator search_iterator
 
typedef const TSearchIterator const_search_iterator
 

Public Member Functions

 TFontCache (const TPathParamMap &ppm)
 ctor More...
 
bool isBinaerFormat () const
 return the current write mode More...
 
bool empty () const
 return the size state More...
 
unsigned int size () const
 return the size, this is the number of all font cache items include all non-font files More...
 
const TPathParamMapgetPathParamMap () const
 return the current parameter map, see description at TPathParamMap More...
 
const TCacheItemoperator[] (unsigned int idx) const
 return the font cache item from index, be sure that enough items present in font cache More...
 
void reset (const TPathParamMap *ppm=NULL)
 reset the font cache will clear all items More...
 
void create (const TPathVec &searchPath, bool multi_thread, const TProgress *prog=NULL)
 create font cache from different search pathes. The function will first clear the current font cache data More...
 
void update (const TPathVec &searchPath, bool multi_thread, const TProgress *prog=NULL)
 update font cache from different search pathes. More...
 
TCacheDBankRes findFontFile (const TPath &fpath) const
 find specific font in font cache with file path. More...
 
TCacheDBankRes findFontsExact (const std::string &fname) const
 find specific font in font cache with font name More...
 
TCacheDBankRes findFontFamilyExact (const std::string &family) const
 find specific font in font cache with font family name More...
 
const_search_iterator searchFirstAltFont (const std::string &fname) const
 search font in font cache with font name in alternate name set. Alternate names are collected from different usefull places inside font. More...
 
bool searchNextAltFont (const_search_iterator &sit) const
 search font in font cache with font name in alternate name set. Alternate names are collected from different usefull places inside font. More...
 
void read (const TPath &cachePath)
 read font cache from file. The function will first clear the current font cache data More...
 
void write (const TPath &cachePath, bool binaer)
 write font cache to file. More...
 
void read (std::istream &cache)
 read font cache from istream. The function will first clear the current font cache data More...
 
void write (std::ostream &cache, bool binaer)
 write font cache to ostream. More...
 

Static Public Member Functions

static std::string normalizeFontName (const std::string &utf8fname)
 helper function to normalize a font name, the function remove all character outside [a-z], [A-Z], [0-9] and <=128 More...
 

Detailed Description

the font cache class

Member Typedef Documentation

typedef std::multimap<std::string, TCacheDBankIdx> FontEngine::TFontCache::TAltNameRefMMap
typedef TAltNameRefMMap::const_iterator FontEngine::TFontCache::TAltNameRefMMapCIT

Constructor & Destructor Documentation

FontEngine::TFontCache::TFontCache ( const TPathParamMap ppm)
inline

ctor

Parameters
ppmparameter map, see description at TPathParamMap

Member Function Documentation

void FontEngine::TFontCache::create ( const TPathVec searchPath,
bool  multi_thread,
const TProgress prog = NULL 
)

create font cache from different search pathes. The function will first clear the current font cache data

Parameters
searchPatha vector of folder to search fonts
multi_threadtrue to allow creating of font cache with many threads
proga progress callback function, see TProgress
bool FontEngine::TFontCache::empty ( ) const
inline

return the size state

Returns
true if the font cache is empty
TCacheDBankRes FontEngine::TFontCache::findFontFamilyExact ( const std::string &  family) const
inline

find specific font in font cache with font family name

Parameters
familythe font family name to search, must be encoded asUTF-8
Returns
a pair of TCacheDBankCIT, if both iterators equal no item could be found, else you can increment first while first and second are unequal.
TCacheDBankRes FontEngine::TFontCache::findFontFile ( const TPath fpath) const
inline

find specific font in font cache with file path.

Parameters
fpaththe file path
Returns
a pair of TCacheDBankCIT, if both iterators equal no item could be found, else you can increment first while first and second are unequal.
TCacheDBankRes FontEngine::TFontCache::findFontsExact ( const std::string &  fname) const
inline

find specific font in font cache with font name

Parameters
fnamethe primary font name to search, must be encoded asUTF-8
Returns
a pair of TCacheDBankCIT, if both iterators equal no item could be found, else you can increment first while first and second are unequal.
const TPathParamMap& FontEngine::TFontCache::getPathParamMap ( ) const
inline

return the current parameter map, see description at TPathParamMap

Returns
parameter map
bool FontEngine::TFontCache::isBinaerFormat ( ) const
inline

return the current write mode

Returns
true if the font cache was saved in binary format else a readable text format is used
static std::string FontEngine::TFontCache::normalizeFontName ( const std::string &  utf8fname)
static

helper function to normalize a font name, the function remove all character outside [a-z], [A-Z], [0-9] and <=128

Parameters
utf8fnamethe font name to normalize, must be encoded asUTF-8
Returns
the normalized font name
const TCacheItem& FontEngine::TFontCache::operator[] ( unsigned int  idx) const
inline

return the font cache item from index, be sure that enough items present in font cache

Parameters
idxthe font cache item index
Returns
font cache item from index
void FontEngine::TFontCache::read ( const TPath cachePath)
inline

read font cache from file. The function will first clear the current font cache data

Parameters
cachePathfile path to font cache file to read
void FontEngine::TFontCache::read ( std::istream &  cache)

read font cache from istream. The function will first clear the current font cache data

Parameters
cacheistream to font cache streamm to read
void FontEngine::TFontCache::reset ( const TPathParamMap ppm = NULL)
inline

reset the font cache will clear all items

Parameters
ppmparameter map pointer, see description at TPathParamMap
const_search_iterator FontEngine::TFontCache::searchFirstAltFont ( const std::string &  fname) const
inline

search font in font cache with font name in alternate name set. Alternate names are collected from different usefull places inside font.

Parameters
fnamethe primary font name to search, must be encoded asUTF-8
Returns
a const_search_iterator, see TSearchIterator
bool FontEngine::TFontCache::searchNextAltFont ( const_search_iterator sit) const
inline

search font in font cache with font name in alternate name set. Alternate names are collected from different usefull places inside font.

Parameters
sitconst_search_iterator from a previous call of searchFirstAltFont(..)
Returns
true if a next iterator could be found
unsigned int FontEngine::TFontCache::size ( ) const
inline

return the size, this is the number of all font cache items include all non-font files

Returns
the font cache size
void FontEngine::TFontCache::update ( const TPathVec searchPath,
bool  multi_thread,
const TProgress prog = NULL 
)

update font cache from different search pathes.

Parameters
searchPatha vector of folder to search fonts
multi_threadtrue to allow updating of font cache with many threads
proga progress callback function, see TProgress
void FontEngine::TFontCache::write ( const TPath cachePath,
bool  binaer 
)
inline

write font cache to file.

Parameters
cachePathfile path to font cache file to write
binaerif true use a compact binary format else a readable text format is used. Binary format will be faster and lesser
void FontEngine::TFontCache::write ( std::ostream &  cache,
bool  binaer 
)

write font cache to ostream.

Parameters
cacheostream path to font cache streamm to write
binaerif true use a compact binary format else a readable text format is used. Binary format will be faster and lesser

The documentation for this struct was generated from the following file:
InsideFont and ADI-FontEngine : Andreas Dippe, © 2013
http://www.insidefont.de