LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

What's the text's size (PIXEL) when I know the FONT & FONT's SIZE (PT/IN) ?

I would like to know what's the place (in PIXEL) occuped by a suite of characters in a zone of text (TextBox, String...) when I know the FONT and the FONT's SIZE (POINT) like 'Courrer 12 pt'.
The aim is to limit dynamically the number of characters written (for all possible fonts) in the zone even if there are no limit fixed in the widget (line's length, wrap,...).

Thanks.
0 Kudos
Message 1 of 3
(3,232 Views)
Hi,

There is a function to get that information: GetTextDisplaySize(); the font parameter is a metafon that contains the information on font, size and style. You can use the CreateMetaFont() to create the metafont with the information and pass it to the GetTextDisplaySize(). Let me know if you have any questions.

Regards,

Juan Carlos
N.I.
Message 2 of 3
(3,232 Views)
Thanks a lot for your reply. It's fine !

I 'm working on a generic "lib", so I suppose that
if I "create" a new font, I must "destroy" it when
the created font become useless.

How destroy a font build by 'CreateMetaFont()' ?
0 Kudos
Message 3 of 3
(3,232 Views)