MyFontEnumerator Class Reference

List of all members.

Public Types

enum  CacheAction { FillCache, UpdateCache }

Public Member Functions

 MyFontEnumerator (CacheAction action)
bool OnFacename (const wxString &font)
 Callback function for font enumeration - fills/updates the font list cache.

Private Attributes

CacheAction m_action

Detailed Description

Definition at line 499 of file ftfonts.cpp.


Member Enumeration Documentation

enum MyFontEnumerator::CacheAction
 

Enumerator:
FillCache 
UpdateCache 

Definition at line 502 of file ftfonts.cpp.

00502 { FillCache, UpdateCache };


Constructor & Destructor Documentation

MyFontEnumerator::MyFontEnumerator CacheAction  action  )  [inline]
 

Definition at line 503 of file ftfonts.cpp.

00503 { m_action = action; }


Member Function Documentation

bool MyFontEnumerator::OnFacename const wxString &  font  ) 
 

Callback function for font enumeration - fills/updates the font list cache.

Author:
Martin Wuerthner <xara@mw-software.com>
Date:
06/03/06
Parameters:
font - the Facename of an enumerated font [INPUTS]

Definition at line 520 of file ftfonts.cpp.

00521 {
00522     // we need to pass an ENUMLOGFONT structure to the kernel
00523     // TRACEUSER("wuerthne", _T("OnFacename %s"), (const TCHAR*)font);
00524 
00525     // We can only handle names that have less than 64 characters. Longer
00526     // names are not sensible but there are silly fonts out there that have
00527     // names exceeding our limit (even though the one font that highlighted
00528     // this problem seemed to have its copyright message reported as the name
00529     // which would look silly on the menu anyway). Truncating the name does
00530     // not make any sense because we would not be able to handle it later on,
00531     // so the best we can do is to silently ignore the font.
00532     if (font.length() > 63) return TRUE;
00533     String_64 OurFontName = font;
00534     
00535     ENUMLOGFONT OurEnumLogFont;
00536     OurEnumLogFont.elfLogFont.FaceName = OurFontName;
00537 
00538     if (m_action == FillCache)
00539     {
00540         // first of all, add the font to our cache list - we do that even with fonts that
00541         // we cannot use, so we can easily see when the available font set has changed
00542         FTFontMan::AddFontToCache(OurEnumLogFont);
00543         // TRACEUSER("wuerthne", _T("%s added to font list cache"), (TCHAR*)OurFontName);
00544     }
00545     else if (m_action == UpdateCache)
00546     {
00547         // check whether the font is in the cache already
00548         // if it is, update its Referenced field as a side-effect
00549         if (!FTFontMan::FontIsCached(OurEnumLogFont))
00550         {
00551             // not yet cached, so add it now
00552             FTFontMan::AddFontToCache(OurEnumLogFont);
00553             TRACEUSER("wuerthne", _T("%s added to font list cache"), (TCHAR*)OurFontName);
00554         }
00555     }
00556     return TRUE;
00557 }


Member Data Documentation

CacheAction MyFontEnumerator::m_action [private]
 

Definition at line 506 of file ftfonts.cpp.


The documentation for this class was generated from the following file:
Generated on Sat Nov 10 03:56:22 2007 for Camelot by  doxygen 1.4.4