Hello,
I wrote a simple function which draws a string with the its bounding box
centered to the given pCenter parameter:
void drawCenteredText (wxPdfDocument& pPDF, wxString const& pString,
Vector2f const& pCenter)
{
float lHeightMM = float (pPDF.GetFontSize ()) / 72.f * 2.54f / 10.f;
//Height in mm.
double lWidthMM = pPDF.GetStringWidth (pString);//Width in mm.
pPDF.SetXY (pCenter.x - lWidthMM / 2.f, pCenter.y - lHeightMM / 2.f);
pPDF.Cell (0, 0, pString);
}
To roughly center the string I need to know how much the actual font
height is in millimeters, and for that purpose i use a formula that
converts points to mm, assuming that a point is 1/72 inch, and then I
convert inch to mm. Is there any better way than this approach?
Greetings,
Luca
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
wxCode-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxcode-users