Get required size of text object from font

If you are a C/C++/C# developer and have any questions about using our products from your application here is the place to post them.
Post Reply
beandog
Posts: 33
Joined: Wed Dec 14 2005

Get required size of text object from font

Post by beandog »

Is there a way to get the minimum required height (in page units, twips I think) for a Text object, given a font?
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

The situation you have described is typically resolved by using the windows API call GetTextExtentPoint32.

I have included a code snippet below.

int len = strlen( lpszText );
GetTextExtentPoint32(dc, lpszText, len , &szTextSize);


*plXpos = PixelsToTwips(szTextSize.cx ,0 );
*plYpos = PixelsToTwips(szTextSize.cy ,1 );

Hope this helps?
Post Reply