#include <fontbase.h>
Inheritance diagram for OILFontMan:
Public Member Functions | |
OILFontMan () | |
Default constructor. | |
Static Public Member Functions | |
static BOOL | IsOkToCall (FontClass Class) |
Check whether this particular font class manager is up and running. | |
static BOOL | CacheNamedFont (String_64 *pFont, FontClass Class=FC_UNDEFINED, INT32 Pass=1) |
This function attempts to cache a font of some variety. It asks each fontmanager in turn to attempt to cache the font. So for something like 'Symbol' a true type font will be cached as this font manager is asked first. | |
static void | ValidateCache () |
This function attempts to recache all fonts of all varieties. | |
static void | FindClosestFont () |
Calls each of the font managers, when searching for a match to a panose number. | |
static FontBase * | CreateNewFont (FontClass Class, String_64 *pFontName) |
This function attempts to create a font instance and will be called by the font manager when new fonts are added. | |
static OUTLINETEXTMETRIC * | GetOutlineTextMetric (FontClass Class, LOGFONT *pLogFont) |
Returns the OUTLINETEXTMETRIC structure for a font. | |
static String_64 * | GetNativeFontName (FontClass Class, LOGFONT *pLogFont) |
Return the underlying native font name for a font. | |
static void | InvalidateCharMetrics () |
Facade routine for FontMetricsCache::InvalidateCharMetrics. | |
static BOOL | GetCharMetrics (wxDC *pDC, WCHAR ch, CharDescription &FontDesc, CharMetrics *pCharMetrics) |
Facade routine for FontMetricsCache::GetCharMetrics. | |
static MILLIPOINT | GetCharsKerning (wxDC *pDC, WCHAR chLeft, WCHAR chRight, CharDescription &FontDesc) |
Facade routine for FontKerningPairsCache::GetCharsKerning. | |
static UINT32 | GetOutlineCache (DocCoord **pCoords, PathVerb **pVerbs) |
The function returns pointers to a statically allocated cache consiting of a verb and coordinate array. The cache is generally used by the font manager gen outline routines to temporarily store outlines of characters. | |
static void | InitialiseOutlineCache () |
Resets the OILFontMan CharOutlineCache to zero. Must be called before any calls to AddMoveTo, AddLineTo, AddBezierTo, ClosePath. | |
static void | FinaliseOutlineCache () |
Tidies what is left by a series of calls to AddMoveTo, AddLineTo, AddCurveTo to make sure the path format is correct for our internal processors. | |
static BOOL | AddMoveTo (POINT &p0) |
Adds a new moveto element and point to the character outline cache at the insert position. | |
static BOOL | AddLineTo (POINT &p0) |
Adds a new lineto element and point to the character outline cache at the insert position. | |
static BOOL | AddBezierTo (POINT &p0, POINT &p1, POINT &p2) |
Adds a new bezierto element to the character outline cache at the insert position. | |
static BOOL | AddMoveTo (DocCoord &p0) |
static BOOL | AddLineTo (DocCoord &p0) |
static BOOL | AddBezierTo (DocCoord &p0, DocCoord &p1, DocCoord &p2) |
static BOOL | ClosePath () |
To close the cached path. | |
static BOOL | GetCharPath (FontClass Class, CharDescription &ChDesc, DocCoord **ppCoords, PathVerb **ppVerbs, UINT32 *pNumCoords, wxDC *pDC) |
Get the path associated with a given char. | |
static 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. The class given will be converted to RealClass on exit. |
Definition at line 169 of file fontbase.h.
|
Default constructor.
Definition at line 157 of file fontbase.cpp.
|
|
Definition at line 742 of file fontbase.cpp. 00743 { 00744 if ((CharOutlineCache::CacheSize)<(OILFONTLIMIT-3)) 00745 { 00746 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize] = p0; 00747 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_BEZIERTO; 00748 CharOutlineCache::CacheSize++; 00749 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize] = p1; 00750 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_BEZIERTO; 00751 CharOutlineCache::CacheSize++; 00752 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize] = p2; 00753 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_BEZIERTO; 00754 CharOutlineCache::CacheSize++; 00755 return TRUE; 00756 } 00757 ERROR3("CharOutlineCache overflow"); 00758 return FALSE; 00759 }
|
|
Adds a new bezierto element to the character outline cache at the insert position.
Definition at line 720 of file fontbase.cpp. 00721 { 00722 if ((CharOutlineCache::CacheSize)<(OILFONTLIMIT-3)) 00723 { 00724 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].x = p0.x; 00725 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].y = p0.y; 00726 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_BEZIERTO; 00727 CharOutlineCache::CacheSize++; 00728 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].x = p1.x; 00729 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].y = p1.y; 00730 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_BEZIERTO; 00731 CharOutlineCache::CacheSize++; 00732 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].x = p2.x; 00733 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].y = p2.y; 00734 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_BEZIERTO; 00735 CharOutlineCache::CacheSize++; 00736 return TRUE; 00737 } 00738 ERROR3("CharOutlineCache overflow"); 00739 return FALSE; 00740 }
|
|
Definition at line 693 of file fontbase.cpp. 00694 { 00695 if ((CharOutlineCache::CacheSize)<OILFONTLIMIT) 00696 { 00697 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize] = p0; 00698 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_LINETO; 00699 CharOutlineCache::CacheSize++; 00700 return TRUE; 00701 } 00702 ERROR3("CharOutlineCache overflow"); 00703 return FALSE; 00704 }
|
|
Adds a new lineto element and point to the character outline cache at the insert position.
Definition at line 679 of file fontbase.cpp. 00680 { 00681 if ((CharOutlineCache::CacheSize)<OILFONTLIMIT) 00682 { 00683 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].x = p0.x; 00684 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].y = p0.y; 00685 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_LINETO; 00686 CharOutlineCache::CacheSize++; 00687 return TRUE; 00688 } 00689 ERROR3("CharOutlineCache overflow"); 00690 return FALSE; 00691 }
|
|
Definition at line 651 of file fontbase.cpp. 00652 { 00653 if ((CharOutlineCache::CacheSize)<OILFONTLIMIT) 00654 { 00655 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize] = p0; 00656 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_MOVETO; 00657 CharOutlineCache::CacheSize++; 00658 CharOutlineCache::LastMoveTo = p0; 00659 return TRUE; 00660 } 00661 ERROR3("CharOutlineCache overflow"); 00662 return FALSE; 00663 }
|
|
Adds a new moveto element and point to the character outline cache at the insert position.
Definition at line 635 of file fontbase.cpp. 00636 { 00637 if ((CharOutlineCache::CacheSize)<OILFONTLIMIT) 00638 { 00639 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].x = p0.x; 00640 CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize].y = p0.y; 00641 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize] = PT_MOVETO; 00642 CharOutlineCache::CacheSize++; 00643 CharOutlineCache::LastMoveTo.x = p0.x; 00644 CharOutlineCache::LastMoveTo.y = p0.y; 00645 return TRUE; 00646 } 00647 ERROR3("CharOutlineCache overflow"); 00648 return FALSE; 00649 }
|
|
This function attempts to cache a font of some variety. It asks each fontmanager in turn to attempt to cache the font. So for something like 'Symbol' a true type font will be cached as this font manager is asked first.
Definition at line 250 of file fontbase.cpp. 00251 { 00252 // Sticks the font in a temporary cache 00253 switch (Pass) 00254 { 00255 // PASS1 - try to cache an exact match 00256 case 1: 00257 { 00258 switch (Class) 00259 { 00260 case FC_UNDEFINED: 00261 { 00262 #ifdef __WXGTK__ 00263 if (FTFontMan::CacheNamedFont(pFontName)) 00264 return TRUE; 00265 #endif 00266 PORTNOTE("text","We do not use TTFontMan in wxOil") 00267 #ifndef EXCLUDE_FROM_XARALX 00268 if (TTFontMan::CacheNamedFont(pFontName)) 00269 return TRUE; 00270 #endif 00271 PORTNOTE("text","Never cache ATM font") 00272 #ifndef EXCLUDE_FROM_XARALX 00273 return ATMFontMan::CacheNamedFont(pFontName); 00274 #else 00275 return FALSE; 00276 #endif 00277 break; 00278 } 00279 00280 case FC_TRUETYPE: 00281 { 00282 #ifndef EXCLUDE_FROM_XARALX 00283 return TTFontMan::CacheNamedFont(pFontName); 00284 #elif defined(__WXGTK__) 00285 return FTFontMan::CacheNamedFont(pFontName); 00286 #else 00287 PORTNOTE("text","We do not use TTFontMan in wxOil") 00288 return FALSE; 00289 #endif 00290 break; 00291 } 00292 00293 case FC_ATM: 00294 { 00295 #ifndef EXCLUDE_FROM_XARALX 00296 return ATMFontMan::CacheNamedFont(pFontName); 00297 #elif defined(__WXGTK__) 00298 return FTFontMan::CacheNamedFont(pFontName); 00299 #else 00300 PORTNOTE("text","Never cache ATM font") 00301 return FALSE; 00302 #endif 00303 break; 00304 } 00305 00306 default: 00307 ERROR3("Unknown font class passed to OILFontMan::CacheNamedFont()"); 00308 } 00309 break; 00310 } 00311 00312 // PASS2 - try to create a compatible font as a replacement 00313 case 2: 00314 { 00315 switch (Class) 00316 { 00317 case FC_UNDEFINED: 00318 { 00319 #ifdef __WXGTK__ 00320 if (FTFontMan::CacheCompatibleFont(pFontName)) 00321 return TRUE; 00322 #endif 00323 00324 PORTNOTE("text","We do not use TTFontMan in wxOil") 00325 #ifndef EXCLUDE_FROM_XARALX 00326 if (TTFontMan::CacheCompatibleFont(pFontName)) 00327 return TRUE; 00328 #endif 00329 PORTNOTE("text","Never cache ATM font") 00330 #ifndef EXCLUDE_FROM_XARALX 00331 return ATMFontMan::CacheCompatibleFont(pFontName); 00332 #else 00333 return FALSE; 00334 #endif 00335 break; 00336 } 00337 00338 case FC_TRUETYPE: 00339 { 00340 #ifndef EXCLUDE_FROM_XARALX 00341 return TTFontMan::CacheCompatibleFont(pFontName); 00342 #elif defined(__WXGTK__) 00343 return FTFontMan::CacheCompatibleFont(pFontName); 00344 #else 00345 PORTNOTE("text","We do not use TTFontMan in wxOil") 00346 return FALSE; 00347 #endif 00348 break; 00349 } 00350 00351 case FC_ATM: 00352 { 00353 #ifndef EXCLUDE_FROM_XARALX 00354 return ATMFontMan::CacheCompatibleFont(pFontName); 00355 #elif defined(__WXGTK__) 00356 return FTFontMan::CacheCompatibleFont(pFontName); 00357 #else 00358 PORTNOTE("text","Never cache ATM font") 00359 return FALSE; 00360 #endif 00361 } 00362 00363 default: 00364 ERROR3("Unknown font class passed to OILFontMan::CacheNamedFont()"); 00365 00366 } 00367 break; 00368 } 00369 00370 default: 00371 ERROR3("Unknown pass selector passed to OILFontMan::CacheNamedFont()"); 00372 } 00373 00374 return FALSE; 00375 }
|
|
To close the cached path.
Definition at line 774 of file fontbase.cpp. 00775 { 00776 if ((CharOutlineCache::CacheSize)<1) 00777 return FALSE; 00778 00779 // Just check the initialised value of LastMoveto for sanity 00780 if (CharOutlineCache::LastMoveTo.x == 0x7FFFFFFF) 00781 { 00782 ERROR3("No moveto in outline cache"); 00783 return FALSE; 00784 } 00785 00786 // find the last coordinate visited 00787 DocCoord LastCoord = CharOutlineCache::CacheCoords[CharOutlineCache::CacheSize-1]; 00788 00789 // if last coord does not close the path then add an extra element 00790 if (LastCoord != CharOutlineCache::LastMoveTo) 00791 if (!AddLineTo(CharOutlineCache::LastMoveTo)) 00792 return FALSE; 00793 00794 // finally close the element and record its position 00795 CharOutlineCache::CacheVerbs[CharOutlineCache::CacheSize-1] |= PT_CLOSEFIGURE; 00796 00797 return TRUE; 00798 }
|
|
This function attempts to create a font instance and will be called by the font manager when new fonts are added.
Definition at line 443 of file fontbase.cpp. 00444 { 00445 switch (Class) 00446 { 00447 case FC_TRUETYPE: 00448 #ifndef EXCLUDE_FROM_XARALX 00449 return TTFontMan::CreateNewFont(pFontName); 00450 #elif defined(__WXGTK__) 00451 return FTFontMan::CreateNewFont(pFontName, Class); 00452 #else 00453 PORTNOTE("text","We do not use TTFontMan in wxOil") 00454 return NULL; 00455 #endif 00456 break; 00457 case FC_ATM: 00458 #ifndef EXCLUDE_FROM_XARALX 00459 return ATMFontMan::CreateNewFont(pFontName); 00460 #elif defined(__WXGTK__) 00461 return FTFontMan::CreateNewFont(pFontName, Class); 00462 #else 00463 PORTNOTE("text","ATM deactivated") 00464 return NULL; 00465 #endif 00466 break; 00467 default: 00468 break; 00469 } 00470 ERROR3("OILFontMan::CreateNewFont() - Unknown font class"); 00471 return NULL; 00472 }
|
|
Tidies what is left by a series of calls to AddMoveTo, AddLineTo, AddCurveTo to make sure the path format is correct for our internal processors.
Definition at line 813 of file fontbase.cpp.
|
|
Calls each of the font managers, when searching for a match to a panose number.
Definition at line 414 of file fontbase.cpp. 00415 { 00416 #ifdef __WXGTK__ 00417 FTFontMan::FindClosestFont(); 00418 #endif 00419 PORTNOTE("text","We do not use TTFontMan in wxOil") 00420 #ifndef EXCLUDE_FROM_XARALX 00421 TTFontMan::FindClosestFont(); 00422 #endif 00423 PORTNOTE("text","ATM deactivated") 00424 #ifndef EXCLUDE_FROM_XARALX 00425 ATMFontMan::FindClosestFont(); 00426 #endif 00427 }
|
|
Facade routine for FontMetricsCache::GetCharMetrics.
Definition at line 559 of file fontbase.cpp. 00560 { 00561 return FontMetricsCache::GetCharMetrics(pDC, ch, FontDesc, pCharMetrics); 00562 }
|
|
Get the path associated with a given char.
Definition at line 837 of file fontbase.cpp. 00843 { 00844 // TRACEUSER("wuerthne",_T("OILFontMan::GetCharPath")); 00845 BOOL Success=FALSE; 00846 switch (fclass) 00847 { 00848 case FC_TRUETYPE: 00849 #ifndef EXCLUDE_FROM_XARALX 00850 Success = TextManager::GetTTCharPath(ChDesc, ppCoords, ppVerbs, pNumCoords, pDC); 00851 #elif defined(__WXGTK__) 00852 Success = FTFontMan::GetCharOutline(ChDesc, ppCoords, ppVerbs, pNumCoords, pDC); 00853 #else 00854 PORTNOTE("text","TrueType deactivated") 00855 #endif 00856 ERROR1IF(Success==FALSE, FALSE, _R(IDE_FONTMAN_NOTTOUTLINE)); 00857 break; 00858 00859 case FC_ATM: 00860 #ifndef EXCLUDE_FROM_XARALX 00861 Success = ATMFontMan::GetCharOutline(ChDesc, ppCoords, ppVerbs, pNumCoords, pDC); 00862 #elif defined(__WXGTK__) 00863 Success = FTFontMan::GetCharOutline(ChDesc, ppCoords, ppVerbs, pNumCoords, pDC); 00864 #else 00865 PORTNOTE("text","ATM deactivated") 00866 #endif 00867 ERROR1IF(Success==FALSE, FALSE, _R(IDE_FONTMAN_NOATMOUTLINE)); 00868 break; 00869 00870 default: 00871 ERROR3("Unknown font class in OILFontMan::GetCharPath"); 00872 break; 00873 } 00874 return Success; 00875 }
|
|
Facade routine for FontKerningPairsCache::GetCharsKerning.
Definition at line 572 of file fontbase.cpp. 00573 { 00574 return FontKerningPairsCache::GetCharsKerning(pDC, chLeft, chRight, FontDesc); 00575 }
|
|
Return the underlying native font name for a font.
Definition at line 532 of file fontbase.cpp. 00533 { 00534 IGNOREPARAM(Class); 00535 return &pLogFont->FaceName; 00536 }
|
|
The function returns pointers to a statically allocated cache consiting of a verb and coordinate array. The cache is generally used by the font manager gen outline routines to temporarily store outlines of characters.
Definition at line 593 of file fontbase.cpp. 00594 { 00595 if (pCoords!=NULL) 00596 (*pCoords)=(CharOutlineCache::CacheCoords); 00597 if (pVerbs!=NULL) 00598 (*pVerbs)=(CharOutlineCache::CacheVerbs); 00599 return (CharOutlineCache::CacheSize); 00600 }
|
|
Returns the OUTLINETEXTMETRIC structure for a font.
Definition at line 489 of file fontbase.cpp. 00490 { 00491 switch (Class) 00492 { 00493 case FC_TRUETYPE: 00494 #ifndef EXCLUDE_FROM_XARALX 00495 return TTFontMan::GetOutlineTextMetric(pLogFont); 00496 #elif defined(__WXGTK__) 00497 return FTFontMan::GetOutlineTextMetric(pLogFont); 00498 #else 00499 PORTNOTE("text","TT deactivated") 00500 return NULL; 00501 #endif 00502 break; 00503 case FC_ATM: 00504 #ifndef EXCLUDE_FROM_XARALX 00505 return ATMFontMan::GetOutlineTextMetric(pLogFont); 00506 #elif defined(__WXGTK__) 00507 return FTFontMan::GetOutlineTextMetric(pLogFont); 00508 #else 00509 PORTNOTE("text","ATM deactivated") 00510 return NULL; 00511 #endif 00512 break; 00513 default: 00514 ERROR3("OILFontMan::CreateNewFont() - Unknown font class"); 00515 break; 00516 } 00517 return NULL; 00518 }
|
|
Resets the OILFontMan CharOutlineCache to zero. Must be called before any calls to AddMoveTo, AddLineTo, AddBezierTo, ClosePath.
Definition at line 615 of file fontbase.cpp. 00616 { 00617 CharOutlineCache::CacheSize=0; 00618 CharOutlineCache::LastMoveTo.x = 0x7FFFFFFF; 00619 }
|
|
Facade routine for FontMetricsCache::InvalidateCharMetrics.
Definition at line 546 of file fontbase.cpp. 00547 { 00548 FontMetricsCache::InvalidateCharMetrics(); 00549 }
|
|
Check whether this particular font class manager is up and running.
Definition at line 199 of file fontbase.cpp. 00200 { 00201 switch (Class) 00202 { 00203 case FC_ATM: 00204 #ifndef EXCLUDE_FROM_XARALX 00205 return ATMFontMan::IsOkToCall(); 00206 #elif defined(__WXGTK__) 00207 return FTFontMan::IsOkToCall(); 00208 #else 00209 return FALSE; 00210 #endif 00211 break; 00212 case FC_TRUETYPE: 00213 #ifndef EXCLUDE_FROM_XARALX 00214 return TTFontMan::IsOkToCall(); 00215 #elif defined(__WXGTK__) 00216 return FTFontMan::IsOkToCall(); 00217 #else 00218 return FALSE; 00219 #endif 00220 break; 00221 default: 00222 ERROR3("Unknown font class passed to OILFontMan::IsOkToCall()"); 00223 break; 00224 } 00225 return FALSE; 00226 }
|
|
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. The class given will be converted to RealClass on exit.
Definition at line 177 of file fontbase.cpp. 00178 { 00179 BOOL ok = ((Class>((INT32)FC_UNDEFINED)) && (Class<((INT32)FC_ILLEGAL))); 00180 (ok) ? (RealClass=(FontClass)(Class)) : (RealClass=FC_UNDEFINED); 00181 return ok; 00182 }
|
|
This function attempts to recache all fonts of all varieties.
Definition at line 387 of file fontbase.cpp. 00388 { 00389 #ifdef __WXGTK__ 00390 FTFontMan::ValidateCache(); 00391 #endif 00392 PORTNOTE("text","We do not use TTFontMan in wxOil") 00393 #ifndef EXCLUDE_FROM_XARALX 00394 TTFontMan::ValidateCache(); 00395 #endif 00396 PORTNOTE("text","ATM deactivated") 00397 #ifndef EXCLUDE_FROM_XARALX 00398 ATMFontMan::ValidateCache(); 00399 #endif 00400 }
|