#include <ttfonts.h>
Inheritance diagram for TTFontMan:
Public Member Functions | |
TTFontMan () | |
Default constructor. | |
Static Public Member Functions | |
static void | EnumAllFonts (OILEnumFonts *pClass) |
Gives the kernel a way of enumerating fonts itself. | |
Static Private Member Functions | |
static BOOL | IsOkToCall () |
Determine whether we can make further calls to the TrueType Manager. | |
static BOOL | CacheNamedFont (String_64 *pFont) |
This function attempts to cache a font of the true type variety. It caches the font in the kernels font list, and hence can be accessed via FONTMANAGER-> calls. | |
static BOOL | CacheCompatibleFont (String_64 *pFont) |
This function attempts to cache a font of the ATM variety. | |
static void | ValidateCache () |
This function will attempt to recache all true type fonts within the kernels font manager cache. | |
static void | FindClosestFont () |
Enumerates all the fonts, looking for a match to a panose number. | |
static TTFont * | CreateNewFont (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 (LOGFONT *pLogFont) |
Retrieves the OUTLINETEXTMETRIC structure for a TrueType font. | |
Friends | |
class | OILFontMan |
Definition at line 143 of file ttfonts.h.
|
Default constructor.
Definition at line 171 of file ttfonts.cpp.
|
|
This function attempts to cache a font of the ATM variety.
Definition at line 240 of file ttfonts.cpp. 00241 { 00242 return FALSE; 00243 }
|
|
This function attempts to cache a font of the true type variety. It caches the font in the kernels font list, and hence can be accessed via FONTMANAGER-> calls.
Definition at line 208 of file ttfonts.cpp. 00209 { 00210 CDC Screen; 00211 if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) 00212 { 00213 Application* pApp = GetApplication(); 00214 FontManager* pFontMan = pApp->GetFontManager(); 00215 ERROR2IF(pFontMan == NULL,FALSE,"NULL FontManager ptr"); 00216 pFontMan->ClearTempFont(); 00217 EnumFontFamilies(Screen.m_hDC, 00218 NULL, 00219 (FONTENUMPROC) TTFontMan_CallBackCacheNamedFont, 00220 (LPARAM)pFontName); 00221 Screen.DeleteDC(); 00222 return pFontMan->TempFontValid(); 00223 } 00224 return FALSE; 00225 }
|
|
This function attempts to create a font instance and will be called by the font manager when new fonts are added.
Definition at line 306 of file ttfonts.cpp. 00307 { 00308 TTFont *pFont = new TTFont; 00309 if (pFont==NULL) 00310 return NULL; 00311 if (!pFont->Initialise(pFontName)) 00312 { 00313 delete pFont; 00314 return NULL; 00315 } 00316 return pFont; 00317 }
|
|
Gives the kernel a way of enumerating fonts itself.
Definition at line 438 of file ttfonts.cpp. 00439 { 00440 CDC Screen; 00441 if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) 00442 { 00443 EnumFontFamilies(Screen.m_hDC, 00444 NULL, 00445 (FONTENUMPROC) TTFontMan_CallBackDispatchFont, 00446 (LPARAM)pClass); 00447 Screen.DeleteDC(); 00448 } 00449 }
|
|
Enumerates all the fonts, looking for a match to a panose number.
Definition at line 279 of file ttfonts.cpp. 00280 { 00281 CDC Screen; 00282 if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) 00283 { 00284 EnumFontFamilies(Screen.m_hDC, 00285 NULL, 00286 (FONTENUMPROC) TTFontMan_CallBackFindClosestFont, 00287 NULL); 00288 Screen.DeleteDC(); 00289 } 00290 }
|
|
Retrieves the OUTLINETEXTMETRIC structure for a TrueType font.
Definition at line 333 of file ttfonts.cpp. 00334 { 00335 ERROR2IF(pLogFont==NULL, FALSE, "Parameter pLogFont==NULL."); 00336 00337 // watch closely now - it gets fairly involved down here 00338 00339 OUTLINETEXTMETRIC *pOutlineTextMetric = NULL; 00340 INT32 Value; 00341 00342 CDC DisplayDC; 00343 if (DisplayDC.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) 00344 { 00345 CFont *pNewCFont = new CFont; 00346 00347 if (pNewCFont->CreateFontIndirect(pLogFont) != NULL) 00348 { 00349 // ** ** ** ** 00350 // ** ** must remember to select the old CFont ** ** 00351 // *** back in again when we've *** 00352 // ** ** finished using this new CFont! ** ** 00353 // ** ** ** ** 00354 00355 CFont *pOldCFont = DisplayDC.SelectObject(pNewCFont); 00356 00357 if (pOldCFont != NULL) 00358 { 00359 TEXTMETRIC MyTextMetric; 00360 00361 if (DisplayDC.GetTextMetrics(&MyTextMetric) != 0) 00362 { 00363 if (MyTextMetric.tmPitchAndFamily & TMPF_TRUETYPE == TMPF_TRUETYPE) 00364 { 00365 // its a TrueType font, so get the OUTLINETEXTMETRIC structure and run 00366 00367 Value = DisplayDC.GetOutlineTextMetrics(NULL, NULL); 00368 00369 // claim a block of memory for the OUTLINETEXTMETRIC class 00370 pOutlineTextMetric = (OUTLINETEXTMETRIC *) malloc(Value); 00371 00372 // now get the OUTLINETEXTMETRIC structure itself 00373 Value = DisplayDC.GetOutlineTextMetrics(Value, pOutlineTextMetric); 00374 00375 if (Value==FALSE) 00376 { 00377 // failed to get the outline text metrics, so free the memory we claimed 00378 free(pOutlineTextMetric); 00379 pOutlineTextMetric=NULL; 00380 } 00381 } 00382 else 00383 { 00384 // not a truetype font, so do nothing. 00385 } 00386 } 00387 else 00388 { 00389 DisplayDC.SelectObject(pOldCFont); 00390 DisplayDC.DeleteDC(); 00391 delete pNewCFont; 00392 ERROR2(NULL, "Unable to retrieve TEXTMETRIC structure from DisplayDC.") 00393 } 00394 00395 // ** ** ** ** 00396 // ** ** select the old CFont back into the ** ** 00397 // *** DC now we've finished using the *** 00398 // ** ** new CFont! ** ** 00399 // ** ** ** ** 00400 00401 DisplayDC.SelectObject(pOldCFont); 00402 } 00403 else 00404 { 00405 delete pNewCFont; 00406 DisplayDC.DeleteDC(); 00407 ERROR2(NULL, "Unable to select font into IC."); 00408 } 00409 } 00410 else 00411 { 00412 delete pNewCFont; 00413 DisplayDC.DeleteDC(); 00414 ERROR2(NULL, "Unable to create font."); 00415 } 00416 delete pNewCFont; 00417 DisplayDC.DeleteDC(); 00418 } 00419 else 00420 { 00421 ERROR2(NULL, "Unable to create an IC."); 00422 } 00423 00424 return pOutlineTextMetric; 00425 }
|
|
Determine whether we can make further calls to the TrueType Manager. static BOOL TTFontMan::IsOkToCall()
Definition at line 186 of file ttfonts.cpp. 00187 { 00188 // Currently its always true as this is the winoil 00189 return TRUE; 00190 }
|
|
This function will attempt to recache all true type fonts within the kernels font manager cache.
Definition at line 256 of file ttfonts.cpp. 00257 { 00258 CDC Screen; 00259 if (Screen.CreateIC(TEXT("DISPLAY"), 0, 0, 0)) 00260 { 00261 EnumFontFamilies(Screen.m_hDC, 00262 NULL, 00263 (FONTENUMPROC) TTFontMan_CallBackValidateFont, 00264 NULL); 00265 Screen.DeleteDC(); 00266 } 00267 }
|
|
|