Home:  Support:  Search:

Can the CreatePointFont function be used to dynamically create instances of IDAutomation fonts within a C++ application?

Solution(s):

Yes it can. The following is an example of using the CreatePointFont function. Ensure that the variables are scoped properly to avoid any problems with the fonts being sized correctly through each pass of this routine.

/***********************************************************************
***************************/
private void CreateAFont()
{
//Create a font object in case  we want to test with a different kind of
font
CFont pageNumFont;

//The initial point size times a "magnifier" variable.
pageNumFont.CreatePointFont(200 * m_Flags.m_Zoom, "Arial Bold", pCDC);

//Here is the data that is going to be drawn on the screen
CString pageStyleNum = "898798789:;

//Create a font object
CFont OCRAfont;
long lPointSize = 100;
//Create a 10 Point font out of the advocra font using the device context
of the screen. The parameters are
//the point size of the font (multiplied by a factor of 10), the name of
the font, and a pointer to the device context that the font will be drawn on

OCRAfont.CreatePointFont(lPointSize , "Advocra", this->GetDC());

//Here is the bounding rectangle for the text that we are going to draw
CRect OCRArect(50, 100, 600, 200);

//Select the font that we would like to draw with
pCDC->SelectObject(&OCRAfont);
pCDC->DrawText(pageStyleNum, OCRArect, DT_SINGLELINE | DT_LEFT |
DT_NOCLIP);
}
/***********************************************************************
***************************/

 

© Copyright 2000-2008 IDAutomation.com, Inc., All Rights Reserved. Legal Notices

Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.