Admin Production ni-theme
Current Publication

GetTextDisplaySize

LabWindows/CVI

GetTextDisplaySize

int GetTextDisplaySize (char text[], char metaFont[], int *height, int *width);

Purpose

Returns the height and width of a string of text given the metafont you specify.

Parameters

Input
Name Type Description
text char [] Text string whose size is calculated.

Note   This function does not support multiline text strings. The function assumes that any special characters embedded in the string, such as tabs and line-feeds, appear as characters, subject to the character set used in the font.
metaFont char [] The font to use for the text string.

metaFont can be a predefined NI metafont or a user-defined metafont saved by a previous call to functions such as CreateMetaFont and CreateMetaFontEx.

The following are NI metafonts:

Predefined metafonts—Contain typeface information, point size, and text styles such as bold, underline, italic, and strikeout. These metafonts are used in the LabWindows/CVI environment. The predefined metafonts are VAL_MENU_META_FONT, VAL_DIALOG_META_FONT, VAL_EDITOR_META_FONT, VAL_APP_META_FONT, and VAL_MESSAGE_BOX_META_FONT.

LabWindows/CVI-supplied metafonts—Use typefaces that are not native to the operating system. These metafonts are installed while LabWindows/CVI is running. The LabWindows/CVI-supplied metafonts are VAL_7SEG_META_FONT and VAL_SYSTEM_META_FONT.
Output
Name Type Description
height int Height of the text in pixels.

You can pass NULL.
width int Width of the text in pixels.

You can pass NULL.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Examples

Refer to the following examples that use the GetTextDisplaySize function:

  • apps\marquee\marquee.cws

    Open example
  • userint\listdelx.cws

    Open example