#include <fontman.h>
Inheritance diagram for FontManager:
Public Member Functions | |
FontManager () | |
Constructor for the font manager class. | |
~FontManager () | |
BOOL | Init () |
Get Camelots Font manager going. We simply cache the default font so unknown fonts can be sensibly replaced. | |
BOOL | LegalFontClass (INT32 Class, FontClass &RealClass) |
Check whether a numeric value actually indicates a valid class of font ie lies in the range of supported font types. This is used generally for loading purpose where the font class is loaded as a numeric value. | |
WORD | CacheNamedFont (String_64 *FontName, FontClass Class=FC_UNDEFINED) |
Given a font name try to cache all the data for that font so that we can actually us it. The cache will be checked first to make sure the font is not already installed. | |
CachedFontItem * | AddFont (String_64 *Name, FontClass Class, WORD &Handle) |
Creates a new font item for this named font. The font will not be fully cached. To cache all the data for the font, call CacheFontData(Handle). | |
CachedFontItem * | GetFont () |
Return the precached default font data to use for rendering. | |
CachedFontItem * | GetFont (WORD Handle) |
Return the font data to use for rendering. This function performs a specific job in avoiding caching the font data. If the font is already cached then fine, it is returned for use. If not, the default font is returned. | |
CachedFontItem * | GetFont (String_64 *pFontName, FontClass Class=FC_UNDEFINED) |
Return the font data to use for rendering. This function performs a specific job in avoiding caching the font data. If the font is already cached then fine, it is returned for use. If not, the default font is returned. | |
WORD | GetFontHandle (String_64 *pFontName, FontClass Class=FC_UNDEFINED) |
Get the handle on a cached font (if cached) otherwise return the default font handle. | |
String_64 * | GetFontName (WORD Handle) |
Return a pointer to the font name given its font handle. | |
BOOL | GetFontName (WORD Handle, String_64 &OutputString) |
FontClass | GetFontClass (WORD Handle) |
Return what class of font this handle is. | |
ENUMLOGFONT * | GetEnumLogFont (WORD Handle) |
Return the ENUMLOGFONT structure for this font handle. Note the function will automatically substitute the default font if the handle provided is invalid or the font it describes is not fully cached. | |
OUTLINETEXTMETRIC * | GetOutlineTextMetric (WORD Handle) |
Return the ENUMLOGFONT structure for this font handle Note the function will automatically substitute the default font if the handle provided is invalid or the font it describes is not fully cached. | |
CachedFontItem * | GetFirstFont () |
CachedFontItem * | GetNextFont (CachedFontItem *pItem) |
CachedFontItem * | GetCachedFont (WORD Handle) |
This function returns the font associated with the handle passed. If the font is not in the cache it will return NULL. It differs from GetFont in that it will not attempt to return the DefaultFontItem if it cannot find the item specified. | |
INT32 | DoesFontExist (String_64 *pFontName, BOOL SearchCache, BOOL SearchInstalled) |
First check in the cache if necessary, then through the installed set of fonts to find whether the named font actually exists. | |
BOOL | IsFontValid (WORD Handle) |
Check to see if the font described is actually valid, ie all the metrics for the font have been cached correctly. | |
BOOL | IsFontInstalled (String_64 *pFontName, FontClass Class=FC_UNDEFINED) |
Search through all the installed sets of fonts for the named font. | |
BOOL | IsFontDefault (WORD Handle) |
Check to see if the font handle described is the handle of the default font ie the font which is used to replace unknown fonts (fonts not resident on the host machine). | |
BOOL | IsFontDefault (CachedFontItem *pItem) |
BOOL | IsFontReplaced (WORD Handle) |
Check to see if the font described has been replaced. | |
BOOL | IsFontReplaced (String_64 *pFontName, FontClass Class=FC_UNDEFINED) |
BOOL | IsFontUsedInDoc (WORD Handle, Document *pDocument) |
Find out whether a given font is used in a document. | |
void | OnDocumentLoaded (Document *pDocument) |
Called after a document has been loaded - allows us to fix the current and default fonts if they are not installed. They are only changed if they are not used in the document. | |
void | GetCompatibleFont (const String_64 &EncodedName, String_64 &CompatibleFont, INT32 &Style) |
Find a compatible font to that specified in the encoded font name. An encoded name looks something like.... | |
void | EncodeFontName (String_64 &FontName, String_64 &Encoded, INT32 Styles) |
Output a font name with bold and italic flags attached. All spaces are converted to dashes. The font is first checked for the existance of style words bold and italic before new styles are added. | |
void | EncodeAndMapFontName (String_64 &FontName, String_64 &Encoded, INT32 Styles) |
This function first calls EncodeFontName, to generate an approximated PostScript font name, before calling a second function to get the PostScript font mapping. | |
INT32 | DecodeFontName (const String_64 &IStringRef, String_64 &OStringRef) |
Given a fontname encoded for EPS files, return the actual font name suitable for font matching and its style definintions (if applicable). | |
void | ClearTempFont () |
Throws away any font data stored in the temp font. | |
void | SetTempFont (FontClass Class, String_64 *pFontName, ENUMLOGFONT *lpelf) |
BOOL | TempFontValid () |
void | RefreshCache () |
Scans all the cached fonts and checks to see if any are invalid. If a font is invalid it is attempted to be made valid. This function is generally called when the external worlds fonts have changed via install/deinstall. | |
void | ValidateItem (FontClass Class, String_64 *pFontName, ENUMLOGFONT *lpelf) |
Used as a way of revalidating a cached font. This function is called from the various oil level font managers when we've asked them to refresh our cache. They simply need to scan their font lists and call this function with the new data. | |
void | DumpFontCache () |
Dubugging facitity - dumps out the contents of our cache. | |
void | DumpFont (WORD Handle) |
Dubugging facitity - dumps out the contents of a font from our cache. | |
WORD | FindTypeface (String_64 &TypeFaceName, FontClass Class) |
Used by the new file format, to check if a particular typeface (and font class) is installed and available. See Also: class FontComponent. | |
WORD | FindClosestFont (const CCPanose &PanoseNumber) |
Performs panose matching on the installed fonts. | |
BOOL | FindClosestFontFullTry (FontClass Class, String_64 *pTypeFaceName, ENUMLOGFONT *pEnumLogFont) |
void | InvalidateCharMetrics () |
Invalidate char metrics cache. | |
BOOL | GetCharMetrics (CNativeDC *pDC, WCHAR ch, CharDescription &FontDesc, CharMetrics *pCharMetrics) |
Get the char metrics for the given char and font Just dispenses the call to the FontMetricsCache. | |
MILLIPOINT | GetCharsKerning (CNativeDC *pDC, WCHAR chLeft, WCHAR chRight, CharDescription &FontDesc) |
Finds the kerning distance between two chars. | |
BOOL | GetCharPath (CharDescription &ChDesc, DocCoord **ppCoords, PathVerb **ppVerbs, UINT32 *pNumCoords, CNativeDC *pDC=NULL) |
Get the path associated with a given char. | |
Private Member Functions | |
WORD | FindClosestFontFull (const CCPanose &PanoseNumber) |
WORD | FindClosestFontQuick (const CCPanose &PanoseNumber) |
BOOL | FindClosestFontQuickTry (WORD FontHandle) |
CachedFontItem * | FindFont (WORD Handle) |
Find the entry in the font managers font cache which corresponds to this handle. | |
CachedFontItem * | FindFont (String_64 *pFontName, FontClass Class=FC_UNDEFINED) |
Find the entry in the font managers font list which corresponds to this fontname and font class Note: One might be tempted to include the default font item in the comparison and return the default font handle when the default font name is passed, but this does not happen and this is by design. See OnDocumentLoaded for further information. | |
WORD | GetNextHandle () |
Return a unique handle for the font cache handler Handles range from 1..n, 0 is explicitly reserved for the default handle, 0x7FFF is defined as an illegal handle. | |
CachedFontItem * | GetFirstFontType (FontClass fclass) |
Find the entry in the font managers font list which corresponds to the first 'FontClass' font cached. | |
BOOL | IsFullyCached (WORD Handle) |
Find out if the font is fully cached and ready to use. This will generally be true of all fonts added by CacheNamedFont. If the font is not fully cached then call CacheFontData(). It will not be if AddFont has been used to add the font to the font list. | |
BOOL | TempCacheNamedFont (String_64 *pFontName, FontClass=FC_UNDEFINED, INT32 Pass=1) |
Search through all the installed sets of fonts for the named font and place the result in a temp font. | |
BOOL | CacheDefaultFont () |
Cache the default font so we can use this as a replacement when unable to find strange fonts. | |
CachedFontItem * | AddTempFont (String_64 *pFontName, FontClass Class, WORD &hndle) |
Given the temp font data, this function goes and caches that data under the provided name and returns the font handle. | |
void | InvalidateCache () |
Scans all the cached fonts deletes all cached data. If the entries are not recached all visible fonts will be replaced by the default font. | |
void | ResetDefaultFont () |
Cache the default font so we can use this as a replacement when unable to find strange fonts. The cache is checked first to see if the default font is already there. | |
BOOL | IsFontUsedInSiblings (Node *pNode, WORD Handle, WORD CurrentHandle, UINT32 Level) |
Find out whether a given font is used in a document. | |
Private Attributes | |
WORD | FindClosestFontHandle |
CCPanose | FindClosestPanoseNumber |
UINT32 | FindClosestDistance |
String_64 | FindClosestTypeFaceName |
FontClass | FindClosestFontClass |
ENUMLOGFONT | FindClosestEnumLogFont |
WORD | UniqueHandle |
WORD | DefaultHandle |
List | TheFontList |
CachedFontItem | DefaultFontItem |
FontClass | TempFontClass |
String_64 | TempFontName |
ENUMLOGFONT | TempEnumLogFont |
Definition at line 187 of file fontman.h.
|
Constructor for the font manager class.
Definition at line 461 of file fontman.cpp. 00462 { 00463 UniqueHandle = FIRSTFONTHANDLE; 00464 DefaultHandle = DEFAULTHANDLE; 00465 TempFontClass = FC_UNDEFINED; 00466 }
|
|
Definition at line 468 of file fontman.cpp. 00469 { 00470 TheFontList.DeleteAll(); 00471 }
|
|
Creates a new font item for this named font. The font will not be fully cached. To cache all the data for the font, call CacheFontData(Handle).
Definition at line 596 of file fontman.cpp. 00597 { 00598 TRACEUSER("wuerthne", _T("FontManager::AddFont %s"), (TCHAR*)*Name); 00599 CachedFontItem* pItem = new CachedFontItem; 00600 if (pItem==NULL) 00601 return NULL; 00602 00603 FontBase* pClass = OILFontMan::CreateNewFont(fclass,Name); 00604 if (pClass==NULL) 00605 { 00606 delete pItem; 00607 pItem=NULL; 00608 return NULL; 00609 } 00610 00611 pItem->pFontClass = pClass; 00612 pItem->Handle = GetNextHandle(); 00613 TheFontList.AddTail(pItem); 00614 00615 retHandle = pItem->Handle; 00616 TRACEUSER("wuerthne", _T("AddFont, returning %d"), retHandle); 00617 00618 return pItem; 00619 }
|
|
Given the temp font data, this function goes and caches that data under the provided name and returns the font handle.
Definition at line 1925 of file fontman.cpp. 01926 { 01927 CachedFontItem* pItem = NULL; 01928 if (TempFontClass==FC_UNDEFINED) 01929 { 01930 if (Class!=FC_UNDEFINED) 01931 pItem = AddFont(pFontName, Class, hndle); 01932 else 01933 { 01934 // ERROR3("Trying to add a font of an unknown class"); 01935 pItem = AddFont(pFontName, FC_TRUETYPE, hndle); 01936 } 01937 } 01938 else 01939 { 01940 pItem = AddFont(pFontName, TempFontClass, hndle); 01941 if (pItem) 01942 pItem->SetCacheData(&TempEnumLogFont); 01943 } 01944 return pItem; 01945 }
|
|
Cache the default font so we can use this as a replacement when unable to find strange fonts.
Definition at line 1591 of file fontman.cpp. 01592 { 01593 PORTNOTE("text","FontManager::CacheDefaultFont - do nothing"); 01594 #ifndef DISABLE_TEXT_RENDERING 01595 if (DefaultFontItem.pFontClass!=NULL) 01596 { 01597 ERROR3("CacheDefaultFont called but a default font is already resident"); 01598 return TRUE; 01599 } 01600 01601 // now scan all installed lists an set out local temp font data 01602 String_64 DefFont(DEFAULTFONTNAME); 01603 01604 if (!TempCacheNamedFont(&DefFont)) 01605 if (!TempCacheNamedFont(NULL)) 01606 return FALSE; 01607 01608 FontBase* pClass = OILFontMan::CreateNewFont(TempFontClass,&TempFontName); 01609 if (pClass==NULL) 01610 return FALSE; 01611 01612 DefaultFontItem.pFontClass = pClass; 01613 DefaultFontItem.Handle = DEFAULTHANDLE; 01614 01615 if (!DefaultFontItem.SetCacheData(&TempEnumLogFont)) 01616 { 01617 DefaultFontItem.Delete(); 01618 return FALSE; 01619 } 01620 01621 return TRUE; 01622 #else 01623 return TRUE; 01624 #endif 01625 }
|
|
Given a font name try to cache all the data for that font so that we can actually us it. The cache will be checked first to make sure the font is not already installed.
Definition at line 1668 of file fontman.cpp. 01669 { 01670 ERROR2IF(pFontName==NULL, ILLEGALFHANDLE, "Bad fontname passed to CacheNamedFont"); 01671 01672 // try to find the font in the cache first 01673 CachedFontItem *pItem = FindFont(pFontName, Class); 01674 if (pItem!=NULL) 01675 return pItem->Handle; 01676 01677 // now scan all installed lists and set our local temp font data 01678 if (!TempCacheNamedFont(pFontName, Class, 1)) 01679 { 01680 // ok we couldn't find the exact font. It may be possible 01681 // to create the font we are after. ATM for instance allows 01682 // named font instances to be created from their base multiple 01683 // master outlines. 01684 TempCacheNamedFont(pFontName, Class, 2); 01685 } 01686 01687 // add the font that has been returned to us, even if none has. 01688 // if no font has been installed then we will end up having a font cache 01689 // object which describes a font as invalid. This is fine as we now know 01690 // we've done a search for it and it does not exist so we'll use the default 01691 WORD hndle=ILLEGALFHANDLE; 01692 AddTempFont(pFontName, Class, hndle); 01693 01694 TRACEUSER("wuerthne", _T("FontManager::CacheNamedFont = %d"), hndle); 01695 return (hndle); 01696 }
|
|
Throws away any font data stored in the temp font.
Definition at line 1879 of file fontman.cpp. 01880 { 01881 TempFontClass=FC_UNDEFINED; 01882 TempFontName.Empty(); 01883 }
|
|
Given a fontname encoded for EPS files, return the actual font name suitable for font matching and its style definintions (if applicable).
Definition at line 2253 of file fontman.cpp. 02254 { 02255 String_32 Match; 02256 String_64 Temp; 02257 INT32 pos,Flags; 02258 02259 OStringRef.Empty(); 02260 Flags=0; 02261 Temp=IStringRef; 02262 02263 Match = _R(IDS_FONTMAN_MINUS_BOLDITALIC); // "-BoldItalic"; 02264 pos = Temp.Sub(Match,0,0); 02265 if (pos>-1) 02266 { 02267 Flags |= 3; 02268 Temp.Left(&OStringRef,pos); 02269 Temp=OStringRef; 02270 } 02271 02272 Match = _R(IDS_FONTMAN_MINUS_BOLD); // "-Bold"; 02273 pos = Temp.Sub(Match,0,0); 02274 if (pos>-1) 02275 { 02276 Flags |= 1; 02277 Temp.Left(&OStringRef,pos); 02278 Temp=OStringRef; 02279 } 02280 02281 Match = _R(IDS_FONTMAN_MINUS_ITALIC); // "-Italic"; 02282 pos = Temp.Sub(Match,0,0); 02283 if (pos>-1) 02284 { 02285 Flags |= 2; 02286 Temp.Left(&OStringRef,pos); 02287 Temp=OStringRef; 02288 } 02289 02290 // Remove the front _ char 02291 Match = _T("_"); 02292 if (Temp.Sub(Match,0,0)==0) 02293 Temp.Remove(0,1); 02294 02295 Temp.SwapChar('-',' '); 02296 OStringRef = Temp; 02297 return Flags; 02298 }
|
|
First check in the cache if necessary, then through the installed set of fonts to find whether the named font actually exists.
Definition at line 834 of file fontman.cpp. 00835 { 00836 if (SearchCache) 00837 if (FindFont(pFontName) != NULL) 00838 return 2; 00839 00840 if (SearchInstalled) 00841 if (IsFontInstalled(pFontName)) 00842 return 1; 00843 00844 return 0; 00845 }
|
|
Dubugging facitity - dumps out the contents of a font from our cache.
Definition at line 1862 of file fontman.cpp. 01863 { 01864 CachedFontItem *pItem = FindFont(Handle); 01865 if (pItem) 01866 pItem->Dump(); 01867 }
|
|
Dubugging facitity - dumps out the contents of our cache.
Definition at line 1842 of file fontman.cpp. 01843 { 01844 CachedFontItem *pItem = GetFirstFont(); 01845 while (pItem) 01846 { 01847 pItem->Dump(); 01848 pItem = GetNextFont(pItem); 01849 } 01850 }
|
|
This function first calls EncodeFontName, to generate an approximated PostScript font name, before calling a second function to get the PostScript font mapping.
Definition at line 2099 of file fontman.cpp. 02102 { 02103 String_64 Mapped; 02104 02105 // First encode the font name. 02106 EncodeFontName ( FontName, Encoded, Styles ); 02107 02108 // And then make the mapping. 02109 if ( Camelot.GetPrefDirect ( _T("EPSFontMapping"), ( TCHAR * ) Encoded, &Mapped ) ) 02110 { 02111 // There is a PostScript equivalent stored for this font, so use the mapped 02112 // version as the encoded name. 02113 Encoded = Mapped; 02114 } 02115 }
|
|
Output a font name with bold and italic flags attached. All spaces are converted to dashes. The font is first checked for the existance of style words bold and italic before new styles are added.
FontNames --------- Encodings: FaceName (Bold) (BoldItalic) GaramondE GaramondE-Bold GaramondE-BoldItalic EuropeExtraBold EuropeExtraBold-Bold EuropeExtraBold-BoldItalic European Bold Oblique European-Bold-Oblique European-Bold-Oblique deGaulleBlack Italic deGualleBlack-BoldItalic deGualleBlack-BoldItalic Definition at line 1995 of file fontman.cpp. 01996 { 01997 String_64 Copy(FontName); 01998 String_32 Match; 01999 02000 // Replace all spaces with a hyphen. 02001 Copy.SwapChar(_T(' '),_T('-')); 02002 02003 INT32 Length = Copy.Length(); 02004 02005 // Find the last hyphen in the font's name. 02006 INT32 LastHyphen = Copy.ReverseFind ( '-' ); 02007 02008 // If there is a -XX extension to the name, remove the hyphen. 02009 if ( LastHyphen == Length - 3 ) 02010 { 02011 Copy.Remove ( LastHyphen, 1 ); 02012 } 02013 02014 // Check for bold/italic. 02015 Match = _R(IDS_FONTMAN_MINUS_BOLD); //"-Bold"; 02016 INT32 Bld = (Copy.Sub(Match,0,0)); 02017 02018 Match = _R(IDS_FONTMAN_MINUS_ITALIC); //"-Italic"; 02019 INT32 Ital = (Copy.Sub(Match,0,0)); 02020 02021 switch (Styles) 02022 { 02023 case 1: 02024 { 02025 if (Bld<0 && Ital<0) 02026 { 02027 Copy += String_16(_R(IDS_FONTMAN_MINUS_BOLD)); // "-Bold"; 02028 break; 02029 } 02030 02031 if( ( Bld < 0 ) && ( Ital > -1 ) && ( Length - 7 == Ital ) ) 02032 { 02033 Copy.Insert( String_32(_R(IDS_FONTMAN_BOLD)), Ital ); 02034 } 02035 break; 02036 } 02037 02038 case 2: 02039 { 02040 if (Bld<0 && Ital<0) 02041 { 02042 Copy += String_16(_R(IDS_FONTMAN_MINUS_ITALIC)); // "-Italic"; 02043 break; 02044 } 02045 02046 if ((Ital<0) && (Bld>-1) && (Length-5==Bld)) 02047 Copy += String_16(_R(IDS_FONTMAN_ITALIC)); //"Italic"; 02048 break; 02049 } 02050 02051 case 3: 02052 { 02053 if (Bld<0 && Ital<0) 02054 { 02055 Copy += String_16(_R(IDS_FONTMAN_MINUS_BOLDITALIC)); // "-BoldItalic"; 02056 break; 02057 } 02058 02059 // If the font contains the word bold at the end, append italic 02060 if( ( Ital < 0 ) && ( Bld > -1 ) && ( Length - 5 == Bld ) ) 02061 { 02062 Copy += String_16(_R(IDS_FONTMAN_ITALIC)); //"Italic"; 02063 break; 02064 } 02065 02066 // If the font already has italic, insert Bold 02067 if( ( Bld < 0 ) && ( Ital > -1 ) && ( Length - 7 == Ital ) ) 02068 { 02069 Copy.Insert( String_32(_R(IDS_FONTMAN_BOLD)), Ital ); 02070 } 02071 break; 02072 02073 } 02074 } 02075 02076 // Set the encoded output string 02077 Encoded=Copy; 02078 }
|
|
Performs panose matching on the installed fonts.
Definition at line 1309 of file fontman.cpp. 01310 { 01311 // check, is this a 'simple' panose number with just Weight and Letterform components? 01312 if (PanoseNumber.GetFamilyType()==PAN_ANY && 01313 PanoseNumber.GetSerifStyle()==PAN_ANY && 01314 PanoseNumber.GetProportion()==PAN_ANY && 01315 PanoseNumber.GetContrast()==PAN_ANY && 01316 PanoseNumber.GetStrokeVariation()==PAN_ANY && 01317 PanoseNumber.GetArmStyle()==PAN_ANY && 01318 PanoseNumber.GetMidline()==PAN_ANY && 01319 PanoseNumber.GetXHeight()==PAN_ANY) 01320 { 01321 // These 'simple' panose numbers get saved out for old files and ATM fonts. Obviously 01322 // we can't do any sensible font matching, so just return the default font handle. 01323 return DEFAULTHANDLE; 01324 } 01325 else 01326 { 01327 // shove the data we need into class members. 01328 FindClosestFontHandle = ILLEGALFHANDLE; 01329 FindClosestPanoseNumber = PanoseNumber; 01330 FindClosestDistance = 0xffffffff; 01331 FindClosestTypeFaceName = _T(""); 01332 FindClosestFontClass = FC_UNDEFINED; 01333 01334 // normalise the panose number. 01335 FindClosestPanoseNumber.BodgeToNormal(); 01336 01337 // choose whichever panose font matching algorithm you require: 01338 PORTNOTE("text","TrueType/Win specific code removed") 01339 #ifndef EXCLUDE_FROM_XARALX 01340 // quick - just checks the seven fonts from the Microsoft(tm) Web Font Pack(tm) 01341 return FindClosestFontQuick(PanoseNumber); 01342 #endif 01343 01344 // full - checks all the fonts installed on the machine. 01345 return FindClosestFontFull(PanoseNumber); 01346 } 01347 }
|
|
Definition at line 1418 of file fontman.cpp. 01419 { 01420 WORD MyFontHandle; 01421 CachedFontItem *pCachedFontItem; 01422 01423 // this is particularly rubbish code, since we ask the OS for information about each font 01424 // (the OUTLINETEXTMETRIC structure) and then throw it away if its not needed, rather than 01425 // caching it for the next time. Of course, if this font manager actually held information 01426 // about all the fonts on the system, rather than those in use, it would all be much easier. 01427 01428 // call the OILFontMan to find the closest font. 01429 OILFontMan::FindClosestFont(); 01430 01431 // We've got the typeface name and font class of the best match, so get the font handle 01432 pCachedFontItem = FindFont(&FindClosestTypeFaceName, FindClosestFontClass); 01433 01434 if (pCachedFontItem!=NULL) 01435 { 01436 // the font is already cached, so grab the font handle from the CachedFontItem 01437 MyFontHandle=pCachedFontItem->Handle; 01438 } 01439 else 01440 { 01441 // the font hasn't been cached yet, so cache it now. 01442 pCachedFontItem = AddFont(&FindClosestTypeFaceName, FindClosestFontClass, MyFontHandle); 01443 pCachedFontItem->SetCacheData(&FindClosestEnumLogFont); 01444 } 01445 01446 // return with this font handle 01447 return MyFontHandle; 01448 }
|
|
Definition at line 1450 of file fontman.cpp. 01451 { 01452 ERROR2IF(pEnumLogFont==NULL, FALSE, "FindClosestTry called with pEnumLogFont==NULL."); 01453 01454 OUTLINETEXTMETRIC *pOutlineTextMetric; 01455 CCPanose MyPanoseNumber; 01456 UINT32 MyDistance; 01457 01458 pOutlineTextMetric = OILFontMan::GetOutlineTextMetric(Class, &(pEnumLogFont->elfLogFont)); 01459 01460 if (pOutlineTextMetric!=NULL) 01461 { 01462 MyPanoseNumber = (pOutlineTextMetric->otmPanoseNumber); 01463 MyPanoseNumber.BodgeToNormal(); 01464 01465 MyDistance = CCPanose::Distance(FindClosestPanoseNumber, MyPanoseNumber); 01466 01467 if (MyDistance<FindClosestDistance) 01468 { 01469 FindClosestDistance = MyDistance; 01470 FindClosestFontClass = Class; 01471 FindClosestTypeFaceName = *(pTypeFaceName); 01472 FindClosestEnumLogFont = *(pEnumLogFont); 01473 } 01474 01475 free(pOutlineTextMetric); 01476 } 01477 01478 return TRUE; 01479 }
|
|
Definition at line 1351 of file fontman.cpp. 01352 { 01353 WORD MyFontHandle; 01354 String_64 MyFontName; 01355 01356 // try "Arial" 01357 MyFontName = _T("Arial"); 01358 MyFontHandle = CacheNamedFont(&MyFontName, FC_TRUETYPE); 01359 FindClosestFontQuickTry(MyFontHandle); 01360 01361 // try "Arial Black" 01362 MyFontName = _T("Arial Black"); 01363 MyFontHandle = CacheNamedFont(&MyFontName, FC_TRUETYPE); 01364 FindClosestFontQuickTry(MyFontHandle); 01365 01366 // try "Comic Sans" 01367 MyFontName = _T("Comic Sans"); 01368 MyFontHandle = CacheNamedFont(&MyFontName, FC_TRUETYPE); 01369 FindClosestFontQuickTry(MyFontHandle); 01370 01371 // try "Courier New" 01372 MyFontName = _T("Courier New"); 01373 MyFontHandle = CacheNamedFont(&MyFontName, FC_TRUETYPE); 01374 FindClosestFontQuickTry(MyFontHandle); 01375 01376 // try "Impact" 01377 MyFontName = _T("Impact"); 01378 MyFontHandle = CacheNamedFont(&MyFontName, FC_TRUETYPE); 01379 FindClosestFontQuickTry(MyFontHandle); 01380 01381 // try "Times New Roman" 01382 MyFontName = _T("Times New Roman"); 01383 MyFontHandle = CacheNamedFont(&MyFontName, FC_TRUETYPE); 01384 FindClosestFontQuickTry(MyFontHandle); 01385 01386 // try "Verdana" 01387 MyFontName = _T("Verdana"); 01388 MyFontHandle = CacheNamedFont(&MyFontName, FC_TRUETYPE); 01389 FindClosestFontQuickTry(MyFontHandle); 01390 01391 return FindClosestFontHandle; 01392 }
|
|
Definition at line 1395 of file fontman.cpp. 01396 { 01397 OUTLINETEXTMETRIC *pOutlineTextMetric = GetOutlineTextMetric(MyFontHandle); 01398 01399 if (pOutlineTextMetric!=NULL) 01400 { 01401 CCPanose MyPanoseNumber = pOutlineTextMetric->otmPanoseNumber; 01402 01403 MyPanoseNumber.BodgeToNormal(); 01404 01405 UINT32 MyDistance = CCPanose::Distance(FindClosestPanoseNumber, MyPanoseNumber); 01406 01407 if (MyDistance<FindClosestDistance) 01408 { 01409 FindClosestFontHandle = MyFontHandle; 01410 FindClosestDistance = MyDistance; 01411 } 01412 } 01413 01414 return TRUE; 01415 }
|
|
Find the entry in the font managers font list which corresponds to this fontname and font class Note: One might be tempted to include the default font item in the comparison and return the default font handle when the default font name is passed, but this does not happen and this is by design. See OnDocumentLoaded for further information.
Definition at line 670 of file fontman.cpp. 00671 { 00672 CachedFontItem* pItem = GetFirstFont(); 00673 00674 if (Class==FC_UNDEFINED) 00675 { 00676 while (pItem!=NULL) 00677 { 00678 if (pItem->Compare(pFontName)) 00679 return pItem; 00680 pItem = GetNextFont(pItem); 00681 } 00682 } 00683 else 00684 { 00685 while (pItem!=NULL) 00686 { 00687 if (pItem->Compare(pFontName)) 00688 { 00689 if (pItem->GetFontClass() == Class) 00690 return pItem; 00691 } 00692 pItem = GetNextFont(pItem); 00693 } 00694 } 00695 return NULL; 00696 }
|
|
Find the entry in the font managers font cache which corresponds to this handle.
Definition at line 635 of file fontman.cpp. 00636 { 00637 // Check the cache first 00638 CachedFontItem* pItem = GetFirstFont(); 00639 while (pItem!=NULL) 00640 { 00641 if (pItem->Handle == Handle) 00642 return pItem; 00643 pItem = GetNextFont(pItem); 00644 } 00645 return NULL; 00646 }
|
|
Used by the new file format, to check if a particular typeface (and font class) is installed and available. See Also: class FontComponent.
Definition at line 1265 of file fontman.cpp. 01266 { 01267 WORD FontHandle = ILLEGALFHANDLE; 01268 01269 CachedFontItem *pItem=FindFont(&TypeFaceName, Class); 01270 01271 if (pItem!=NULL) 01272 { 01273 // font is in the cached font list. 01274 FontHandle=pItem->Handle; 01275 } 01276 // now scan the installed lists for this font, and set the local temp font data 01277 else if (TempCacheNamedFont(&TypeFaceName, Class, 1)) 01278 { 01279 AddTempFont(&TypeFaceName, Class, FontHandle); 01280 } 01281 // Okay, so we couldn't find the exact font. It may be possible to create the 01282 // font we are after. ATM for instance allows named font instances to be created 01283 // from the base multiple master outlines. 01284 else if (TempCacheNamedFont(&TypeFaceName, Class, 2)) 01285 { 01286 AddTempFont(&TypeFaceName, Class, FontHandle); 01287 } 01288 else 01289 // completly unsuccessful. :( 01290 { 01291 FontHandle=ILLEGALFHANDLE; 01292 } 01293 01294 return FontHandle; 01295 }
|
|
This function returns the font associated with the handle passed. If the font is not in the cache it will return NULL. It differs from GetFont in that it will not attempt to return the DefaultFontItem if it cannot find the item specified.
Definition at line 714 of file fontman.cpp. 00715 { 00716 if (Handle==DefaultHandle) return (&DefaultFontItem); 00717 return FindFont(Handle); 00718 }
|
|
Get the char metrics for the given char and font Just dispenses the call to the FontMetricsCache.
Definition at line 1508 of file fontman.cpp. 01509 { 01510 return OILFontMan::GetCharMetrics(pDC, ch, FontDesc, pCharMetrics); 01511 }
|
|
Get the path associated with a given char.
Definition at line 1552 of file fontman.cpp. 01557 { 01558 ERROR2IF(ppCoords==NULL,FALSE,"FontManager::GetCharPath pCoords==NULL"); 01559 ERROR2IF(ppVerbs==NULL,FALSE,"FontManager::GetCharPath ppVerbs==NULL"); 01560 ERROR2IF(pNumCoords==NULL,FALSE,"FontManager::GetCharPath pNumCoords==NULL"); 01561 01562 CachedFontItem* pItem = GetFont(ChDesc.GetTypefaceHandle()); 01563 if (pItem==NULL) 01564 return FALSE; 01565 01566 if (pItem->IsCorrupt()) 01567 return FALSE; 01568 01569 BOOL Success = OILFontMan::GetCharPath(pItem->GetFontClass(), ChDesc, ppCoords, ppVerbs, pNumCoords, pDC); 01570 if (!Success) 01571 pItem->SetIsCorrupt(TRUE); 01572 01573 return Success; 01574 }
|
|
Finds the kerning distance between two chars.
Definition at line 1526 of file fontman.cpp. 01527 { 01528 // TRACEUSER("wuerthne", _T("FontManager::GetCharsKerning called\n") ); 01529 return OILFontMan::GetCharsKerning(pDC, chLeft, chRight, FontDesc); 01530 }
|
|
Find a compatible font to that specified in the encoded font name. An encoded name looks something like.... void FontManager::GetCompatibleFont(const String_64& EncodedName, String_64& CompatibleFont, INT32& Style)
The algorithm used is based on diminishing returns, ie try to find the exact font first, then break the fontname up in various increasingly complex ways until a valid substitution is found. This substitution can then be used for font caching. Note if the fontmanager fails to find any match it will return the encodedname as a last resort. When this is cached, its metrics will be NULL and hence be replaced by the default font automatically be the font manager. extras: This function tries to use the font name as specified. If it does not exist the function will attempt to use the fontname without styles and create styles to fit but only if this new fontname exists. ie it will do the following FontName Styles NameExists StylesOutput (1) Times New Roman BoldItalic Yes BoldOff / ItalicOff (2) Times New Roman Bold/Italic Yes BoldOn / ItalicOn (3) Times New Roman BoldItalic No BoldOn / ItalicOn
Definition at line 2163 of file fontman.cpp. 02164 { 02165 // first make a copy of the encoded name 02166 String_64 TryFont(EncodedName); 02167 02168 // now set the return style 02169 Style=0; 02170 02171 // Usually the fontnames in the file are saved as /_FontName.Attr-BoldItalic format 02172 if( TryFont.Sub( String_32( _T("_") ),0 ,0 ) == 0 ) 02173 TryFont.Remove(0,1); 02174 02175 // remove our inserted - symbols which are encoded as separators on saving 02176 TryFont.SwapChar('-',' '); 02177 02178 // Try to find the specified font name, search internal and external caches 02179 INT32 found = DoesFontExist(&TryFont,TRUE,TRUE); 02180 if (found>0) 02181 { 02182 CompatibleFont=TryFont; 02183 return; 02184 } 02185 02186 // Ok, if we can't find the whole thing, try decoding 02187 String_64 DecodedName; 02188 Style = DecodeFontName(EncodedName, DecodedName); 02189 02190 // find out what styles this font has 02191 BOOL Bold,Italic; 02192 Bold=((Style & 1) != 0); 02193 Italic=((Style & 2) != 0); 02194 02195 // if both bold and italic found 02196 if (Bold && Italic) 02197 { 02198 String_64 HoldName(TryFont); 02199 // try to find bold first 02200 INT32 pos = HoldName.Sub( String_32( _T("Italic") ), 0, 0 ); 02201 HoldName.Remove(pos,6); 02202 found = DoesFontExist(&HoldName,TRUE,TRUE); 02203 if (found>0) 02204 { 02205 CompatibleFont=HoldName; 02206 return; 02207 } 02208 02209 // Then try Italic 02210 HoldName=TryFont; 02211 pos = HoldName.Sub( String_32( _T("Bold") ), 0, 0 ); 02212 HoldName.Remove(pos,4); 02213 found = DoesFontExist(&HoldName,TRUE,TRUE); 02214 if (found>0) 02215 { 02216 CompatibleFont=HoldName; 02217 return; 02218 } 02219 } 02220 02221 // Does the decoded name exist?, so we can make the rest up in styles? 02222 found = DoesFontExist(&DecodedName,TRUE,TRUE); 02223 if (found>0) 02224 { 02225 CompatibleFont=DecodedName; 02226 return; 02227 } 02228 02229 // otherwise, we have a font with an extension, eg Trinity.Bold 02230 // (1) Trinity.Bold - does not exist 02231 // (2) Trinity - does not exist 02232 // now we set the font to (1), which will be replaced by Times-Roman. 02233 // Now we should also set the font styles too to give us TimesRoman bold 02234 02235 CompatibleFont=TryFont; 02236 }
|
|
Return the ENUMLOGFONT structure for this font handle. Note the function will automatically substitute the default font if the handle provided is invalid or the font it describes is not fully cached.
Definition at line 1144 of file fontman.cpp. 01145 { 01146 // ok, we need to get the font data for this particular font item 01147 CachedFontItem *pItem = GetFont(Handle); 01148 if (pItem!=NULL) 01149 { 01150 return (pItem->GetEnumLogFont()); 01151 } 01152 else 01153 { 01154 return NULL; 01155 } 01156 }
|
|
Definition at line 555 of file fontman.cpp. 00556 { 00557 return (CachedFontItem*)TheFontList.GetHead(); 00558 }
|
|
Find the entry in the font managers font list which corresponds to the first 'FontClass' font cached.
Definition at line 1116 of file fontman.cpp. 01117 { 01118 CachedFontItem* pItem = GetFirstFont(); 01119 while (pItem!=NULL) 01120 { 01121 if (pItem->GetFontClass() == Class) 01122 return pItem; 01123 pItem = GetNextFont(pItem); 01124 } 01125 return NULL; 01126 }
|
|
Return the font data to use for rendering. This function performs a specific job in avoiding caching the font data. If the font is already cached then fine, it is returned for use. If not, the default font is returned.
Definition at line 806 of file fontman.cpp. 00807 { 00808 CachedFontItem* pItem = FindFont(pFontName, Class); 00809 if ((pItem!=NULL) && (pItem->IsFullyCached())) 00810 return pItem; 00811 return &DefaultFontItem; 00812 }
|
|
Return the font data to use for rendering. This function performs a specific job in avoiding caching the font data. If the font is already cached then fine, it is returned for use. If not, the default font is returned.
Definition at line 780 of file fontman.cpp. 00781 { 00782 CachedFontItem* pItem = FindFont(Handle); 00783 if ((pItem!=NULL) && (pItem->IsFullyCached())) 00784 return pItem; 00785 return &DefaultFontItem; 00786 }
|
|
Return the precached default font data to use for rendering.
Definition at line 760 of file fontman.cpp. 00761 { 00762 return &DefaultFontItem; 00763 }
|
|
Return what class of font this handle is.
Definition at line 1238 of file fontman.cpp. 01239 { 01240 CachedFontItem* pItem = GetCachedFont(Handle); 01241 if (pItem==NULL) 01242 { 01243 ERROR3("FontManager::GetFontClass() - given an illegal handle"); 01244 return FC_UNDEFINED; 01245 } 01246 return pItem->GetFontClass(); 01247 }
|
|
Get the handle on a cached font (if cached) otherwise return the default font handle.
Definition at line 737 of file fontman.cpp. 00738 { 00739 ERROR2IF(pFontName==NULL, 0, "FontManager::GetFontHandle() called with an illegal font name pointer"); 00740 CachedFontItem* pItem=FindFont(pFontName,Class); 00741 if (pItem!=NULL) 00742 return pItem->GetFontHandle(); 00743 00744 return DefaultHandle; 00745 }
|
|
Definition at line 1212 of file fontman.cpp. 01213 { 01214 CachedFontItem* pItem = GetCachedFont(Handle); 01215 if (pItem==NULL) 01216 { 01217 ERROR3("FontManager::GetFontName() - given an illegal handle"); 01218 return FALSE; 01219 } 01220 OutputString = *(pItem->GetFontName()); 01221 return TRUE; 01222 }
|
|
Return a pointer to the font name given its font handle.
Definition at line 1200 of file fontman.cpp. 01201 { 01202 CachedFontItem* pItem = GetCachedFont(Handle); 01203 if (pItem==NULL) 01204 { 01205 ERROR3("FontManager::GetFontName() - given an illegal handle"); 01206 return NULL; 01207 } 01208 return pItem->GetFontName(); 01209 }
|
|
Definition at line 572 of file fontman.cpp. 00573 { 00574 return (CachedFontItem*)TheFontList.GetNext(pItem); 00575 }
|
|
Return a unique handle for the font cache handler Handles range from 1..n, 0 is explicitly reserved for the default handle, 0x7FFF is defined as an illegal handle.
Definition at line 509 of file fontman.cpp. 00510 { 00511 WORD CurrHandle=UniqueHandle; 00512 UniqueHandle++; 00513 return (CurrHandle); 00514 }
|
|
Return the ENUMLOGFONT structure for this font handle Note the function will automatically substitute the default font if the handle provided is invalid or the font it describes is not fully cached.
Definition at line 1172 of file fontman.cpp. 01173 { 01174 // ok, we need to get the font data for this particular font item 01175 CachedFontItem *pItem = GetFont(Handle); 01176 if (pItem!=NULL) 01177 { 01178 return pItem->GetOutlineTextMetric(); 01179 } 01180 else 01181 { 01182 return NULL; 01183 } 01184 }
|
|
Get Camelots Font manager going. We simply cache the default font so unknown fonts can be sensibly replaced.
Reimplemented from SimpleCCObject. Definition at line 531 of file fontman.cpp. 00532 { 00533 // initialise the OIL cache of enumerated fonts by simply enumerating them 00534 // and ignoring the result - since we do not want to see the names, we do 00535 // not even have to create a subclass 00536 OILEnumFonts enumerator; 00537 enumerator.Execute(); 00538 if (!CacheDefaultFont()) 00539 { 00540 ERROR3("FontManager::Init() - Unable to cache the default font"); 00541 } 00542 return TRUE; 00543 }
|
|
Scans all the cached fonts deletes all cached data. If the entries are not recached all visible fonts will be replaced by the default font.
Definition at line 1820 of file fontman.cpp. 01821 { 01822 CachedFontItem *pItem = GetFirstFont(); 01823 while (pItem) 01824 { 01825 pItem->DeleteMetrics(); 01826 pItem->SetIsCorrupt(FALSE); 01827 pItem->SetIsReplaced(TRUE); 01828 pItem = GetNextFont(pItem); 01829 } 01830 }
|
|
Invalidate char metrics cache.
Definition at line 1489 of file fontman.cpp. 01490 { 01491 OILFontMan::InvalidateCharMetrics(); 01492 }
|
|
Definition at line 967 of file fontman.cpp. 00968 { 00969 return (pItem == (&DefaultFontItem)); 00970 }
|
|
Check to see if the font handle described is the handle of the default font ie the font which is used to replace unknown fonts (fonts not resident on the host machine).
Definition at line 962 of file fontman.cpp. 00963 { 00964 return (Handle==DefaultHandle); 00965 }
|
|
Search through all the installed sets of fonts for the named font.
Definition at line 1736 of file fontman.cpp. 01737 { 01738 return TempCacheNamedFont(pFontName, Class); 01739 }
|
|
Definition at line 916 of file fontman.cpp. 00917 { 00918 BOOL Result = FALSE; 00919 00920 // Check whether its the default font, if it is then obviously it's not been replaced. 00921 if (DefaultFontItem.Compare(pFontName)) 00922 { 00923 Result = FALSE; 00924 } 00925 else 00926 { 00927 CachedFontItem *pItem = FindFont(pFontName, Class); 00928 00929 if (pItem==NULL) 00930 { 00931 Result = TRUE; // font doesn't exist 00932 } 00933 else if (pItem->IsReplaced()) 00934 { 00935 Result = TRUE; // IsReplaced flag is set 00936 } 00937 else if (!pItem->IsValid()) 00938 { 00939 Result = TRUE; // The font isn't valid 00940 } 00941 } 00942 00943 return Result; 00944 }
|
|
Check to see if the font described has been replaced.
Definition at line 886 of file fontman.cpp. 00887 { 00888 BOOL Result = FALSE; 00889 00890 // check whether its the default font, if it is then obviously it's not been replaced. 00891 if (IsFontDefault(FontHandle)) 00892 { 00893 Result = FALSE; 00894 } 00895 else 00896 { 00897 CachedFontItem *pItem = FindFont(FontHandle); 00898 00899 if (pItem==NULL) 00900 { 00901 Result = TRUE; // font doesn't exist 00902 } 00903 else if (pItem->IsReplaced()) 00904 { 00905 Result = TRUE; // IsReplaced flag is set 00906 } 00907 else if (!pItem->IsValid()) 00908 { 00909 Result = TRUE; // The font isn't valid 00910 } 00911 } 00912 00913 return Result; 00914 }
|
|
Find out whether a given font is used in a document.
Definition at line 1023 of file fontman.cpp. 01024 { 01025 Node* pNode = pDocument->GetFirstNode(); 01026 return IsFontUsedInSiblings(pNode, Handle, ILLEGALFHANDLE, 0); 01027 }
|
|
Find out whether a given font is used in a document.
Definition at line 988 of file fontman.cpp. 00989 { 00990 // perform a standard child-first recursion keeping track of the current font 00991 while(pNode) 00992 { 00993 Node* pFirstChild = pNode->FindFirstChild(); 00994 if (pFirstChild && IsFontUsedInSiblings(pFirstChild, Handle, CurrentHandle, Level + 1)) return TRUE; 00995 if (IS_A(pNode, AttrTxtFontTypeface)) 00996 { 00997 AttrTxtFontTypeface* pAttr = (AttrTxtFontTypeface*)pNode; 00998 CurrentHandle = pAttr->Value.HTypeface; 00999 ENSURE(!(CurrentHandle == DEFAULTHANDLE && Level > 1), "FontManager::IsFontUsedInSiblings is based on the assumption that we do not have non-default attribute nodes referencing the default font"); 01000 } 01001 if (CurrentHandle == Handle && (IS_A(pNode, TextStory) || IS_A(pNode, TextLine) || IS_A(pNode, TextChar))) 01002 return TRUE; 01003 pNode = pNode->FindNext(); 01004 } 01005 return FALSE; 01006 }
|
|
Check to see if the font described is actually valid, ie all the metrics for the font have been cached correctly.
Definition at line 862 of file fontman.cpp. 00863 { 00864 CachedFontItem* pItem = GetCachedFont(Handle); 00865 return ( (pItem!=NULL) && (pItem->IsFullyCached()) ); 00866 }
|
|
Find out if the font is fully cached and ready to use. This will generally be true of all fonts added by CacheNamedFont. If the font is not fully cached then call CacheFontData(). It will not be if AddFont has been used to add the font to the font list.
Definition at line 1758 of file fontman.cpp. 01759 { 01760 CachedFontItem* pItem = GetCachedFont(Handle); 01761 if (pItem!=NULL) 01762 return pItem->IsFullyCached(); 01763 return FALSE; 01764 }
|
|
Check whether a numeric value actually indicates a valid class of font ie lies in the range of supported font types. This is used generally for loading purpose where the font class is loaded as a numeric value.
Definition at line 488 of file fontman.cpp. 00489 { 00490 return OILFontMan::LegalFontClass(Class, RealClass); 00491 }
|
|
Called after a document has been loaded - allows us to fix the current and default fonts if they are not installed. They are only changed if they are not used in the document.
One might consider a similar approach for the default font, but by definition, the default font is always installed (though it may or may not be Times New Roman), so there is no need to change anything. The default attributes are not saved with the document, so, in contrast to the current font, there cannot be any surprises with fonts that are not installed. The font name referenced by the default font does not matter because the default font attribute is never inherited by any text object in the document. This is down to the behaviour of FindFont(String_64*,FontClass), which never returns the default font handle, so any font attribute created by the text tool based on a font name (which involves calling FindFont at some stage) is always different from the default attribute (even if it happens to be the same font as the default font) and hence this attribute is not optimised away. Therefore, each and every text object has a non-default font attribute applied to it. Definition at line 1064 of file fontman.cpp. 01065 { 01066 // check if the current font is installed and change it in case it is not (only if the font is not used) 01067 NodeAttribute* pAttr = pDocument->GetAttributeMgr().GetCurrentAttribute(CC_RUNTIME_CLASS(BaseTextClass), 01068 CC_RUNTIME_CLASS(AttrTxtFontTypeface)); 01069 if (pAttr) 01070 { 01071 AttrTxtFontTypeface* pTypeface = (AttrTxtFontTypeface*)pAttr; 01072 WORD Handle = pTypeface->Value.HTypeface; 01073 TRACEUSER("wuerthne", _T("found current font attribute, handle = %d"), Handle); 01074 CachedFontItem *pItem = FindFont(Handle); 01075 if (pItem) 01076 { 01077 String_64* SurfaceFontName = pItem->GetFontName(); 01078 TRACEUSER("wuerthne", _T("current font name is %s"), (TCHAR*)*SurfaceFontName); 01079 ENUMLOGFONT *pEnumLogFont = pItem->GetEnumLogFont(); 01080 if (pEnumLogFont) 01081 { 01082 if (!IsFontInstalled(SurfaceFontName) && !IsFontUsedInDoc(Handle, pDocument)) 01083 { 01084 // the current font is not installed and not used in the document, 01085 // so find out what the replacement font is and use that instead 01086 TRACEUSER("wuerthne", _T("font replaced and not used")); 01087 String_64* NativeFontName = OILFontMan::GetNativeFontName(pItem->GetFontClass(), 01088 &pEnumLogFont->elfLogFont); 01089 WORD NewHandle = CacheNamedFont(NativeFontName, pItem->GetFontClass()); 01090 if (NewHandle != ILLEGALFHANDLE) 01091 { 01092 TRACEUSER("wuerthne", _T("change current font to handle %d"), NewHandle); 01093 // modify the current attribute directly 01094 pTypeface->Value.HTypeface = NewHandle; 01095 } 01096 } 01097 } 01098 } 01099 } 01100 }
|
|
Scans all the cached fonts and checks to see if any are invalid. If a font is invalid it is attempted to be made valid. This function is generally called when the external worlds fonts have changed via install/deinstall.
Definition at line 1779 of file fontman.cpp. 01780 { 01781 InvalidateCache(); 01782 OILFontMan::ValidateCache(); 01783 ResetDefaultFont(); 01784 }
|
|
Cache the default font so we can use this as a replacement when unable to find strange fonts. The cache is checked first to see if the default font is already there.
Definition at line 1642 of file fontman.cpp. 01643 { 01644 DefaultFontItem.Delete(); 01645 CacheDefaultFont(); 01646 }
|
|
Definition at line 1896 of file fontman.cpp. 01897 { 01898 ERROR3IF(lpelf==NULL,"FontManager::SetTempFont() given a null ENUMLOGFONT structure"); 01899 ERROR3IF(Class==FC_UNDEFINED, "FontManager::SetTempFont() given an illegal font class"); 01900 01901 TempFontClass=Class; 01902 TempFontName=(*pFontName); 01903 TempEnumLogFont=(*lpelf); 01904 }
|
|
Search through all the installed sets of fonts for the named font and place the result in a temp font.
Definition at line 1716 of file fontman.cpp. 01717 { 01718 return (OILFontMan::CacheNamedFont(pFontName, Class, Pass)); 01719 }
|
|
Definition at line 1958 of file fontman.cpp. 01959 { 01960 return (TempFontClass!=FC_UNDEFINED); 01961 }
|
|
Used as a way of revalidating a cached font. This function is called from the various oil level font managers when we've asked them to refresh our cache. They simply need to scan their font lists and call this function with the new data. void FontManager::ValidateItem(FontClass Class, String_64 * pFontName, ENUMLOGFONT * lpelf)
Definition at line 1799 of file fontman.cpp. 01800 { 01801 CachedFontItem *pItem = FindFont(pFontName,Class); 01802 if (pItem) 01803 { 01804 pItem->SetCacheData(lpelf); 01805 pItem->SetIsReplaced(FALSE); 01806 } 01807 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|