CachedFontItem Class Reference

A font item cached by the font manager. More...

#include <fontman.h>

Inheritance diagram for CachedFontItem:

ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 CachedFontItem ()
 Default constructor.
 ~CachedFontItem ()
String_64GetFontName ()
 Get this items name.
WORD GetFontHandle ()
FontClass GetFontClass ()
 Get this items class.
BOOL Compare (String_64 *pFontName)
 See if this font has the same name as that passed as a param.
ENUMLOGFONTGetEnumLogFont ()
 Returns the ENUMLOGFONT structure for this cached font.
OUTLINETEXTMETRICGetOutlineTextMetric ()
 Returns the OUTLINETEXTMETRIC structure for this cached font.
void SetIsCorrupt (BOOL flag)
void SetIsReplaced (BOOL flag)
BOOL IsFullyCached ()
 See if this item has all its cached structures resident.
BOOL IsCorrupt ()
BOOL IsValid ()
BOOL IsReplaced ()

Private Member Functions

BOOL SetCacheData (ENUMLOGFONT *lpelf)
void DeleteMetrics ()
 Delete this items LOGFONT cached structure.
void DeleteFontClass ()
void Delete ()
void Dump ()
 Dump the contents of this cache entry out.

Private Attributes

FontBasepFontClass
WORD Handle
ENUMLOGFONTpEnumLogFont
OUTLINETEXTMETRICpOutlineTextMetric
BOOL FlagIsCorrupt
BOOL FlagIsReplaced

Friends

class FontManager
class FontComponent

Detailed Description

A font item cached by the font manager.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/95
See also:

Definition at line 131 of file fontman.h.


Constructor & Destructor Documentation

CachedFontItem::CachedFontItem  ) 
 

Default constructor.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95

Definition at line 170 of file fontman.cpp.

00171 {
00172     pFontClass          = NULL;
00173     Handle              = ILLEGALFHANDLE;
00174     pEnumLogFont        = NULL;
00175     pOutlineTextMetric  = NULL;
00176     FlagIsCorrupt       = FALSE;
00177     FlagIsReplaced      = FALSE;
00178 }

CachedFontItem::~CachedFontItem  ) 
 

Definition at line 180 of file fontman.cpp.

00181 {
00182     Delete();
00183 }


Member Function Documentation

BOOL CachedFontItem::Compare String_64 pFontName  ) 
 

See if this font has the same name as that passed as a param.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95
Parameters:
pFontName = A pointer to a font name [INPUTS]
Returns:
TRUE if the font name on entry matchs that of this cached font FALSE if not

Definition at line 360 of file fontman.cpp.

00361 {
00362     if( pFontClass == NULL )
00363     {
00364         TRACE( _T("A CachedFontItem structure exists without a FontClass!!!") );
00365         return FALSE;
00366     }
00367     
00368     return pFontClass->Compare( pFontName );
00369 }   

void CachedFontItem::Delete  )  [private]
 

Definition at line 317 of file fontman.cpp.

00318 {
00319     DeleteMetrics();    
00320     DeleteFontClass();
00321 }

void CachedFontItem::DeleteFontClass  )  [private]
 

Definition at line 308 of file fontman.cpp.

00309 {
00310     if (pFontClass!=NULL)
00311     {
00312         delete pFontClass;
00313         pFontClass=NULL;
00314     }
00315 }

void CachedFontItem::DeleteMetrics  )  [private]
 

Delete this items LOGFONT cached structure.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95
Parameters:
- [INPUTS]
Returns:
-

Definition at line 288 of file fontman.cpp.

00289 {
00290     if( NULL == pFontClass )
00291     {
00292         TRACE( _T("structure exists without a FontClass!!!") );
00293     }
00294     
00295     if (pEnumLogFont!=NULL)
00296     {
00297         delete pEnumLogFont;
00298         pEnumLogFont = NULL;
00299     }
00300     
00301     if (pOutlineTextMetric!=NULL)
00302     {
00303         delete pOutlineTextMetric;
00304         pOutlineTextMetric = NULL;
00305     }
00306 }

void CachedFontItem::Dump  )  [private]
 

Dump the contents of this cache entry out.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95

Definition at line 383 of file fontman.cpp.

00384 {
00385 #ifdef _DEBUG
00386     ERROR3IF(pFontClass==NULL, "A CachedFontItem structure exists without a FontClass!!!");
00387     TRACE( _T("Font item:\n Handle = %d\n"),Handle);
00388     if (IsFullyCached())
00389     {       
00390         TRACE( _T(" Fully cached\n"));
00391         OILFontMan::DumpEnumLogFont(pEnumLogFont);
00392     }
00393     else
00394     {
00395         TRACE( _T(" Not fully cached\n"));
00396     }
00397     pFontClass->Dump();
00398 #endif
00399 }

ENUMLOGFONT * CachedFontItem::GetEnumLogFont  ) 
 

Returns the ENUMLOGFONT structure for this cached font.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95
Parameters:
- [INPUTS]
Returns:
A pointer to the ENUMLOGFONT structure for this font

Definition at line 201 of file fontman.cpp.

00202 {
00203     ERROR2IF(pFontClass==NULL, NULL, "structure exists without a FontClass!!!");
00204 
00205     if (pEnumLogFont!=NULL)
00206         return pEnumLogFont;
00207 
00208     return NULL;
00209 }

FontClass CachedFontItem::GetFontClass  ) 
 

Get this items class.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95
Parameters:
- [INPUTS]
Returns:
A font class

Definition at line 270 of file fontman.cpp.

00271 {
00272     ERROR3IF(pFontClass==NULL, "structure exists without a FontClass!!!");
00273     return pFontClass->GetFontClass();
00274 }

WORD CachedFontItem::GetFontHandle  )  [inline]
 

Definition at line 143 of file fontman.h.

00143 { return Handle; }

String_64 * CachedFontItem::GetFontName  ) 
 

Get this items name.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95
Parameters:
- [INPUTS]
Returns:
A font name

Definition at line 252 of file fontman.cpp.

00253 {
00254     ERROR2IF(pFontClass==NULL, NULL, "structure exists without a FontClass!!!");
00255     return pFontClass->GetFontName();
00256 }

OUTLINETEXTMETRIC * CachedFontItem::GetOutlineTextMetric  ) 
 

Returns the OUTLINETEXTMETRIC structure for this cached font.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/08/96
Parameters:
- [INPUTS]
Returns:
A pointer to the OUTLINETEXTMETRIC structure for this font, or NULL if one doesn't exist (non-truetype fonts).

Definition at line 224 of file fontman.cpp.

00225 {
00226     ERROR2IF(pFontClass==NULL, NULL, "this.pFontClass==NULL.");
00227     ERROR2IF(pEnumLogFont==NULL, NULL, "this.pEnumLogFont==NULL.");
00228 
00229     if (pOutlineTextMetric==NULL)
00230     {
00231         // ask the font class for this structure, and cache it
00232         FontClass Class = GetFontClass();
00233         pOutlineTextMetric=OILFontMan::GetOutlineTextMetric(Class, &(pEnumLogFont->elfLogFont));
00234     }
00235 
00236     // return the result.
00237     return pOutlineTextMetric;
00238 }

BOOL CachedFontItem::IsCorrupt  )  [inline]
 

Definition at line 153 of file fontman.h.

00153 { return FlagIsCorrupt; }

BOOL CachedFontItem::IsFullyCached  ) 
 

See if this item has all its cached structures resident.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/09/95
Parameters:
- [INPUTS]
Returns:
TRUE if this item is fully cached, FALSE if not

Definition at line 335 of file fontman.cpp.

00336 {
00337     PORTNOTE("text","CachedFontItem::IsFullyCached - do nothing");
00338 #ifndef DISABLE_TEXT_RENDERING
00339     // TRACEUSER("wuerthne", _T("CachedFontItem::IsFullyCached called") );
00340     ERROR2IF(pFontClass==NULL, FALSE, "A CachedFontItem structure exists without a FontClass!!!");
00341     return (pEnumLogFont!=NULL);
00342 #else
00343     return TRUE;
00344 #endif
00345 }

BOOL CachedFontItem::IsReplaced  )  [inline]
 

Definition at line 155 of file fontman.h.

00155 { return FlagIsReplaced; };

BOOL CachedFontItem::IsValid  )  [inline]
 

Definition at line 154 of file fontman.h.

00154 { return IsFullyCached(); };

BOOL CachedFontItem::SetCacheData ENUMLOGFONT lpelf  )  [private]
 

void CachedFontItem::SetIsCorrupt BOOL  flag  )  [inline]
 

Definition at line 149 of file fontman.h.

00149 { FlagIsCorrupt = flag; };

void CachedFontItem::SetIsReplaced BOOL  flag  )  [inline]
 

Definition at line 150 of file fontman.h.

00150 { FlagIsReplaced = flag; };


Friends And Related Function Documentation

friend class FontComponent [friend]
 

Definition at line 134 of file fontman.h.

friend class FontManager [friend]
 

Definition at line 133 of file fontman.h.


Member Data Documentation

BOOL CachedFontItem::FlagIsCorrupt [private]
 

Definition at line 170 of file fontman.h.

BOOL CachedFontItem::FlagIsReplaced [private]
 

Definition at line 171 of file fontman.h.

WORD CachedFontItem::Handle [private]
 

Definition at line 167 of file fontman.h.

ENUMLOGFONT* CachedFontItem::pEnumLogFont [private]
 

Definition at line 168 of file fontman.h.

FontBase* CachedFontItem::pFontClass [private]
 

Definition at line 166 of file fontman.h.

OUTLINETEXTMETRIC* CachedFontItem::pOutlineTextMetric [private]
 

Definition at line 169 of file fontman.h.


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