OILPanose Class Reference

Specification of the OIL related Panose code Abstract, static class, holding OIL related Panose code. More...

#include <oilpanse.h>

List of all members.

Static Public Member Functions

static BOOL Init (CDC *pCDC)
 Initialises the static member varibles of this class. See Also: OILPanose::DeInit();.
static BOOL DeInit ()
 Deinitialises this, the OILPanose class. See Also: void OILPanose::Init().
static BOOL GetPanoseNumber (ENUMLOGFONT *pEnumLogFont, CCPanose *pPanose)
 Platform depenedent method of getting the Panose number for a font.

Static Private Attributes

static CDCpMyCDC = NULL
 Implementation of the OIL related Panose code Static member variables of the OILPanose class.
static BOOL IsInitialised = FALSE


Detailed Description

Specification of the OIL related Panose code Abstract, static class, holding OIL related Panose code.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/07/96 Base Class: -
See also:
CCPanose (the kernel Panose class)

Definition at line 124 of file oilpanse.h.


Member Function Documentation

BOOL OILPanose::DeInit void   )  [static]
 

Deinitialises this, the OILPanose class. See Also: void OILPanose::Init().

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/07/96
Parameters:
- [INPUTS]
Returns:
TRUE if sucessful, FALSE otherwise

Definition at line 169 of file oilpanse.cpp.

00170 {
00171     ERROR2IF(IsInitialised==FALSE, FALSE, "OILPanose::DeInit called when IsInitialised==FALSE");
00172 
00173     pMyCDC = NULL;
00174     IsInitialised = FALSE;
00175 
00176     return TRUE;
00177 }

BOOL OILPanose::GetPanoseNumber ENUMLOGFONT pEnumLogFont,
CCPanose pPanose
[static]
 

Platform depenedent method of getting the Panose number for a font.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/07/96
Parameters:
pEnumLogFont - pointer to an ENUMLOGFONT structure [INPUTS] pPanose - pointer to an CCPanose structure
Enters values into the CCPanose structure pointed to by pPanose. [OUTPUTS]

Definition at line 192 of file oilpanse.cpp.

00193 {
00194     ERROR2IF(pEnumLogFont==NULL, FALSE, "Parameter pEnumLogFont == NULL.");
00195     ERROR2IF(pPanose==NULL, FALSE, "Parameter pPanose == NULL.");
00196     ERROR2IF(IsInitialised==FALSE, FALSE, "Class OILPanose not initialised.");
00197 
00198     BOOL ok = FALSE;
00199 
00200     // watch closely - it gets fairly involved down here
00201 
00202     CFont *pNewCFont;
00203 
00204     pNewCFont = new CFont;
00205 
00206     if (pNewCFont->CreateFontIndirect(&(pEnumLogFont->elfLogFont)) != NULL)
00207     {
00208         // success, managed to get create a new font. now select it into the CDC we have
00209         CFont *pOldCFont;
00210         pOldCFont = pMyCDC->SelectObject(pNewCFont);
00211 
00212         if (pOldCFont!=NULL)
00213         {
00214             // success, managed to select the font into the DC
00215 
00216             TEXTMETRIC MyTextMetric;
00217 
00218             if (pMyCDC->GetTextMetrics(&MyTextMetric) != 0)
00219             {
00220                 // great, we've got the TextMetric structure. now check to see if its
00221                 // a TrueType font or not - only TrueType fonts have Panose information
00222                 if ((MyTextMetric.tmPitchAndFamily & TMPF_TRUETYPE) == TMPF_TRUETYPE)
00223                 {
00224                     // its a TrueType font, so get the Panose number and run
00225                     INT32 Value;
00226                     OUTLINETEXTMETRIC *pOutlineTextMetric;
00227 
00228                     // find out how much space we need for the information
00229                     Value = pMyCDC->GetOutlineTextMetrics(NULL, NULL);
00230 
00231                     // claim a block of memory at least this size
00232                     pOutlineTextMetric = (OUTLINETEXTMETRIC *) malloc(Value);
00233                     ERROR2IF(pOutlineTextMetric==NULL, FALSE, "Out of memory.");
00234 
00235                     // now get the OutlineTextMetric structure
00236                     Value = pMyCDC->GetOutlineTextMetrics(Value, pOutlineTextMetric);
00237                     
00238                     ERROR3IF(Value==FALSE, "Unable to retrieve OUTLINETEXTMETRIC information");
00239 
00240                     // hurray, we've finally found what we were looking for - celebrate! ;)
00241                     // now copy the information into the CCPanose strucure
00242                     pPanose->SetFamilyType(pOutlineTextMetric->otmPanoseNumber.bFamilyType); 
00243                     pPanose->SetSerifStyle(pOutlineTextMetric->otmPanoseNumber.bSerifStyle); 
00244                     pPanose->SetWeight(pOutlineTextMetric->otmPanoseNumber.bWeight); 
00245                     pPanose->SetProportion(pOutlineTextMetric->otmPanoseNumber.bProportion); 
00246                     pPanose->SetContrast(pOutlineTextMetric->otmPanoseNumber.bContrast); 
00247                     pPanose->SetStrokeVariation(pOutlineTextMetric->otmPanoseNumber.bStrokeVariation); 
00248                     pPanose->SetArmStyle(pOutlineTextMetric->otmPanoseNumber.bArmStyle); 
00249                     pPanose->SetLetterform(pOutlineTextMetric->otmPanoseNumber.bLetterform); 
00250                     pPanose->SetMidline(pOutlineTextMetric->otmPanoseNumber.bMidline); 
00251                     pPanose->SetXHeight(pOutlineTextMetric->otmPanoseNumber.bXHeight); 
00252                     
00253                     // finally free the memory we had claimed
00254                     free((void *) pOutlineTextMetric);
00255                 }
00256                 else
00257                 {
00258                     // its not a TrueType font, so set the Panose number to some safe value
00259                     pPanose->SetAllToAny();
00260                 }
00261 
00262             }
00263             else
00264             {
00265                 ERROR3("Unable to retrieve TEXTMETRIC structure from CDC.");
00266                 ok = FALSE;
00267             }
00268 
00269             pMyCDC->SelectObject(pOldCFont);
00270         
00271             
00272         }
00273         else
00274         {
00275             ERROR3("Unable to select CFont object into the CDC.");
00276             ok = FALSE;
00277         }
00278     }
00279     else
00280     {
00281         ERROR3("Unable to create font.");
00282         ok = FALSE;
00283     }
00284 
00285     delete pNewCFont;
00286 
00287     return ok;
00288 }

BOOL OILPanose::Init CDC ptr  )  [static]
 

Initialises the static member varibles of this class. See Also: OILPanose::DeInit();.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/07/96
Parameters:
pCDC - pointer to a CDC to use [INPUTS]
Returns:
TRUE if successful, FALSE otherwise
Since DC's are in _very_ short supply, you must only call Init when needed, and call DeInit as soon as possible afterwards. There's no problem under NT, but both Win95 and Win3.11 have a limited supply of DCs.

Definition at line 145 of file oilpanse.cpp.

00146 {
00147     ERROR2IF(ptr==NULL, FALSE, "Parameter ptr == NULL");
00148     ERROR2IF(IsInitialised==TRUE, FALSE, "OILPanose::Init called when IsInitialised==TRUE.");
00149 
00150     pMyCDC = ptr;
00151     IsInitialised=TRUE;
00152 
00153     return TRUE;
00154 }


Member Data Documentation

BOOL OILPanose::IsInitialised = FALSE [static, private]
 

Definition at line 128 of file oilpanse.h.

CDC * OILPanose::pMyCDC = NULL [static, private]
 

Implementation of the OIL related Panose code Static member variables of the OILPanose class.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/07/96

Definition at line 127 of file oilpanse.h.


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