FontKerningPairsCache Class Reference

A cache for the kerning pairs for a font. More...

#include <fontimpl.h>

List of all members.

Static Public Member Functions

static MILLIPOINT GetCharsKerning (wxDC *pDC, WCHAR chLeft, WCHAR chRight, CharDescription &FontDesc)
 Get the kern between two chars of a font Note: The kern pairs are cached (see FontKerningPairsCacheEntry::GetCharsKerning).

Protected Types

enum  CacheInfo { NUMENTRIES = 3 }

Static Protected Attributes

static FontKerningPairsCacheEntry m_FontKerningPairsCacheData [NUMENTRIES]

Private Member Functions

 CC_DECLARE_MEMDUMP (FontKerningPairsCache)


Detailed Description

A cache for the kerning pairs for a font.

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/10/2000

Definition at line 256 of file fontimpl.h.


Member Enumeration Documentation

enum FontKerningPairsCache::CacheInfo [protected]
 

Enumerator:
NUMENTRIES 

Definition at line 271 of file fontimpl.h.

00271 { NUMENTRIES=3 };


Member Function Documentation

FontKerningPairsCache::CC_DECLARE_MEMDUMP FontKerningPairsCache   )  [private]
 

MILLIPOINT FontKerningPairsCache::GetCharsKerning wxDC *  pDC,
WCHAR  chLeft,
WCHAR  chRight,
CharDescription FontDesc
[static]
 

Get the kern between two chars of a font Note: The kern pairs are cached (see FontKerningPairsCacheEntry::GetCharsKerning).

Author:
Jonathan_Payne (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/20/2000
Parameters:
pDC = a pointer to a device context [INPUTS] chLeft = a character code of the left char of a kerning pair chRight = a character code of the right char of a kerning pair FontDesc = a font description
Returns:
Kern in millipoints (or zero if no kern or error)

Definition at line 1166 of file fontbase.cpp.

01168 {
01169     // TRACEUSER("wuerthne", _T("GetCharsKerning %04x %04x"), chLeft, chRight);
01170     ERROR2IF(pDC==NULL, 0, "FontKerningPairsCache::GetCharsKerning() - pDC==NULL");
01171     ERROR2IF(FontDesc.GetCharCode() != FONTEMCHAR, FALSE,
01172         "FontKerningPairsCache::GetCharsKerning() - FontDesc char should be 'FONTEMCHAR'");
01173 #ifndef DISABLE_TEXT_RENDERING
01174     // find out whether the font is in the cache (and if so which entry)
01175     INT32 CacheEntry = 0;
01176     while (CacheEntry < NUMENTRIES && m_FontKerningPairsCacheData[CacheEntry].GetFontDesc() != FontDesc)
01177         CacheEntry++;
01178 
01179     if (CacheEntry >= NUMENTRIES)
01180     {
01181         // TRACEUSER("wuerthne", _T("did not find cache entry, so allocate new one"));
01182         // the font is not in the cache, so throw out a random cache entry and prepare
01183         // the cache entry so we can start caching the kerning data for the new font
01184         CacheEntry = rand() % NUMENTRIES;
01185         m_FontKerningPairsCacheData[CacheEntry].Reinitialise(FontDesc);
01186     }
01187     return m_FontKerningPairsCacheData[CacheEntry].GetCharsKerning(chLeft, chRight);
01188 #else
01189     return 0;
01190 #endif
01191 }


Member Data Documentation

FontKerningPairsCacheEntry FontKerningPairsCache::m_FontKerningPairsCacheData [static, protected]
 

Definition at line 273 of file fontimpl.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:54:29 2007 for Camelot by  doxygen 1.4.4