|
||
class CFontCache : public CBase;
Font cache.
When a CFont* needs to be found for a particular TFontSpec
, the cache can be searched to see if the TFontSpec
is already in the cache. If the TFontSpec
is in the cache, its corresponding CFont* can be returned. Otherwise GetNearestFontInTwips() must be used to search all of
the available fonts for the nearest CFont- a procedure which takes much longer than a simple cache search.
The current font cache should be destroyed and a new cache created whenever the zoom factor or device map changes, as these
changes break the relation between CFont
and TFontSpec
.
CBase
-
Base class for all classes to be instantiated on the heap.
CFontCache
- Font cache.
Defined in CFontCache
:
AddEntryL(CFont *,const TFontSpec &)
Adds a font entry to the cache.CFontCache()
Default constructor.CFontCache(TInt)
Constructor specifying the number of cache entries.RemoveFirstEntry()
Removes the first entry from the font cache and returns it.Search(const TFontSpec &)
Searches the cache for a specified font.iNumHits
The number of cache hits since the font cache was created i.e. successful result...iNumMisses
The number of cache misses since the font cache was created i.e. unsuccessful re...~CFontCache()
Destructor.Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.Extension_(TUint,TAny *&,TAny *)
Extension function operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...IMPORT_C CFontCache();
Default constructor.
This constructs a CFontCache of size KMaxFontCacheEntries.
IMPORT_C CFontCache(TInt aMaxEntries);
Constructor specifying the number of cache entries.
|
IMPORT_C ~CFontCache();
Destructor.
This destroys the cashe and releases its allocated memory.
IMPORT_C CFont* Search(const TFontSpec &aFontSpec);
Searches the cache for a specified font.
The CFont
returned is that which corresponds to the font specification aFontSpec.
|
|
IMPORT_C CFont* AddEntryL(CFont *aFont, const TFontSpec &aFontSpec);
Adds a font entry to the cache.
The font, and the font specification required to extract it from the cache, are both specified. If the cache is already full, the font replaces the oldest entry already in the cache, which is returned.
|
|
IMPORT_C CFont* RemoveFirstEntry();
Removes the first entry from the font cache and returns it.
|
TInt iNumHits;
The number of cache hits since the font cache was created i.e. successful results from CFontCache::Search(const TFontSpec &)
.
TInt iNumMisses;
The number of cache misses since the font cache was created i.e. unsuccessful results from CFontCache::Search(const TFontSpec &)
.