CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csFontCache Class Reference
[Common Plugin Classes]

A cache for font glyphs. More...

#include <csplugincommon/canvas/fontcache.h>

Inheritance diagram for csFontCache:

csSoftFontCache csSoftFontCacheImpl< Tpixel, Tpixmixer > List of all members.

Public Member Functions

GlyphCacheDataCacheGlyph (KnownFont *font, utf32_char glyph, uint flags)
 Store glyph-specific information.
void UncacheGlyph (GlyphCacheData *cacheData)
 Uncache cached glyph data.
KnownFontGetCachedFont (iFont *font)
 Request whether a font is known already.
KnownFontCacheFont (iFont *font)
 Set up stuff to cache glyphs of this font.
void UncacheFont (iFont *font)
 Uncache this font.
GlyphCacheDataGetCacheData (KnownFont *font, utf32_char glyph, uint flags)
 Request cached data for a glyph of a known font.
GlyphCacheDataGetLeastUsed ()
 Get cached data for the least used glyph.
void PurgeEmptyPlanes ()
 Delete empty PlaneGlyphs from known fonts.
virtual void WriteString (iFont *font, int x, int y, int fg, int bg, const utf8_char *text, uint flags)
 Draw a string.

Public Attributes

int ClipX1
 the current clipping rect
int ClipY1
 the current clipping rect
int ClipX2
 the current clipping rect
int ClipY2
 the current clipping rect

Protected Types

typedef csArray< PlaneGlyphs *,
PlaneGlyphElementHandler > 
PlaneGlyphsArray
 Array of a number of glyphs.

Protected Member Functions

LRUEntryFindLRUEntry (KnownFont *font, utf32_char glyph)
 Find an LRU entry for a specific font/glyph pair.
LRUEntryFindLRUEntry (GlyphCacheData *cacheData)
 Find an LRU entry for a specific cache data.
virtual GlyphCacheDataInternalCacheGlyph (KnownFont *font, utf32_char glyph, uint flags)
 Cache canvas-dependent information for a specific font/glyph pair.
virtual void InternalUncacheGlyph (GlyphCacheData *cacheData)
 Uncache canvas-dependent information.
GlyphCacheDataCacheGlyphUnsafe (KnownFont *font, utf32_char glyph, uint flags)
 Store glyph-specific information, but omit some safety checks.
void SetupCacheData (GlyphCacheData *cacheData, KnownFont *font, utf32_char glyph, uint flags)
 Fill the basic cache data.
void AddCacheData (KnownFont *font, utf32_char glyph, GlyphCacheData *cacheData)
 Add a glyph to the cache.
void RemoveCacheData (GlyphCacheData *cacheData)
 Remove a glyph from the cache. @ Does not update PlaneGlyphs!
void RemoveLRUEntry (LRUEntry *entry)
 Remove a glyph from the cache.
GlyphCacheDataInternalGetCacheData (KnownFont *font, utf32_char glyph)
 Request cached data for a glyph of a known font.

Protected Attributes

LRUEntryhead
 First entry in LRU list.
LRUEntrytail
 Last entry in LRU list.
csBlockAllocator< LRUEntryLRUAlloc
 Allocator for LRU list entries.
csArray< KnownFont * > knownFonts
 Array of known fonts.

Detailed Description

A cache for font glyphs.

It is intended as a baseclass, which a canvas extends to store glyphs in a canvas-dependent way. It provides facilities to quickly locate data associated with a specific glyph of a specific font, as well as means to manage glyphs if only a limited space to store them is present.

Definition at line 53 of file fontcache.h.


Member Typedef Documentation

typedef csArray<PlaneGlyphs*, PlaneGlyphElementHandler> csFontCache::PlaneGlyphsArray [protected]
 

Array of a number of glyphs.

This is the "first" dimension of the glyphs array, and consists of a variable number of "planes". If a plane doesn't contain a glyph, it doesn't take up memory.

Definition at line 139 of file fontcache.h.


Member Function Documentation

void csFontCache::AddCacheData KnownFont font,
utf32_char  glyph,
GlyphCacheData cacheData
[protected]
 

Add a glyph to the cache.

KnownFont* csFontCache::CacheFont iFont font  ) 
 

Set up stuff to cache glyphs of this font.

GlyphCacheData* csFontCache::CacheGlyph KnownFont font,
utf32_char  glyph,
uint  flags
 

Store glyph-specific information.

GlyphCacheData* csFontCache::CacheGlyphUnsafe KnownFont font,
utf32_char  glyph,
uint  flags
[protected]
 

Store glyph-specific information, but omit some safety checks.

LRUEntry* csFontCache::FindLRUEntry GlyphCacheData cacheData  )  [protected]
 

Find an LRU entry for a specific cache data.

LRUEntry* csFontCache::FindLRUEntry KnownFont font,
utf32_char  glyph
[protected]
 

Find an LRU entry for a specific font/glyph pair.

GlyphCacheData* csFontCache::GetCacheData KnownFont font,
utf32_char  glyph,
uint  flags
 

Request cached data for a glyph of a known font.

KnownFont* csFontCache::GetCachedFont iFont font  ) 
 

Request whether a font is known already.

GlyphCacheData* csFontCache::GetLeastUsed  ) 
 

Get cached data for the least used glyph.

virtual GlyphCacheData* csFontCache::InternalCacheGlyph KnownFont font,
utf32_char  glyph,
uint  flags
[protected, virtual]
 

Cache canvas-dependent information for a specific font/glyph pair.

Reimplemented in csSoftFontCache.

GlyphCacheData* csFontCache::InternalGetCacheData KnownFont font,
utf32_char  glyph
[protected]
 

Request cached data for a glyph of a known font.

virtual void csFontCache::InternalUncacheGlyph GlyphCacheData cacheData  )  [protected, virtual]
 

Uncache canvas-dependent information.

Reimplemented in csSoftFontCache.

void csFontCache::PurgeEmptyPlanes  ) 
 

Delete empty PlaneGlyphs from known fonts.

void csFontCache::RemoveCacheData GlyphCacheData cacheData  )  [protected]
 

Remove a glyph from the cache. @ Does not update PlaneGlyphs!

@

void csFontCache::RemoveLRUEntry LRUEntry entry  )  [protected]
 

Remove a glyph from the cache.

void csFontCache::SetupCacheData GlyphCacheData cacheData,
KnownFont font,
utf32_char  glyph,
uint  flags
[protected]
 

Fill the basic cache data.

void csFontCache::UncacheFont iFont font  ) 
 

Uncache this font.

void csFontCache::UncacheGlyph GlyphCacheData cacheData  ) 
 

Uncache cached glyph data.

virtual void csFontCache::WriteString iFont font,
int  x,
int  y,
int  fg,
int  bg,
const utf8_char text,
uint  flags
[virtual]
 

Draw a string.

Reimplemented in csSoftFontCacheImpl< Tpixel, Tpixmixer >.


Member Data Documentation

int csFontCache::ClipX1
 

the current clipping rect

Definition at line 152 of file fontcache.h.

int csFontCache::ClipX2
 

the current clipping rect

Definition at line 152 of file fontcache.h.

int csFontCache::ClipY1
 

the current clipping rect

Definition at line 152 of file fontcache.h.

int csFontCache::ClipY2
 

the current clipping rect

Definition at line 152 of file fontcache.h.

LRUEntry* csFontCache::head [protected]
 

First entry in LRU list.

Definition at line 89 of file fontcache.h.

csArray<KnownFont*> csFontCache::knownFonts [protected]
 

Array of known fonts.

Definition at line 156 of file fontcache.h.

csBlockAllocator<LRUEntry> csFontCache::LRUAlloc [protected]
 

Allocator for LRU list entries.

Definition at line 94 of file fontcache.h.

LRUEntry* csFontCache::tail [protected]
 

Last entry in LRU list.

Definition at line 91 of file fontcache.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1