Using Fonts

You can specify fonts for user interface objects, such as panel titles, control text, and labels, programmatically or using the User Interface Editor. You can use a predefined font, a predefined metafont, a LabWindows/CVI-supplied metafont, a user-defined metafont, or a host font that is supplied on your system.

Note  When you change the font and point size of text, always set the font before setting the point size or style attributes.

The following table lists valid font values:

Type Value
Predefined fonts VAL_MENU_FONT
VAL_MESSAGE_BOX_FONT
VAL_DIALOG_FONT
VAL_EDITOR_FONT
VAL_APP_FONT
Predefined metafonts VAL_MENU_META_FONT
VAL_MESSAGE_BOX_META_FONT
VAL_DIALOG_META_FONT
VAL_EDITOR_META_FONT
VAL_APP_META_FONT
LabWindows/CVI-supplied metafonts VAL_7SEG_META_FONT
VAL_SYSTEM_META_FONT
User-defined metafonts Refer to the discussion following this table.
Host fonts Refer to the discussion following this table.

Predefined Fonts That Are Resident on the System

The predefined fonts contain typeface information only. Each value is an alias to an operating system font typeface. The computer operating system and user preferences determine this font typeface. Therefore, predefined fonts can appear differently on different computers, even if the computers have the same screen resolution.

Predefined Metafonts That Are Resident on the System

The predefined metafonts contain typeface information; point size; and text styles such as bold, underline, italic, and strikeout. Each value is an alias to an operating system font. Therefore, the computer operating system and user preferences determine this font. If you distribute graphical user interfaces that use predefined metafonts, the control sizes and proportions can differ from computer to computer, even if the computers have the same screen resolution. For example, a predefined metafont that is size 11 on one computer can be a size 13 font on a different computer that has the large fonts setting enabled. If you plan to distribute a user interface to a different computer, consider using host fonts.

The predefined metafonts are used in the LabWindows/CVI environment. VAL_MENU_META_FONT is a bold metafont that is used for menu and menu item names. VAL_DIALOG_META_FONT is a bold metafont that is used for labels in dialog boxes and function panels. VAL_EDITOR_META_FONT is a monospaced metafont that is the default font in Source windows. VAL_APP_META_FONT is a smaller, non-bold alternative to VAL_DIALOG_META_FONT. VAL_MESSAGE_BOX_META_FONT is used for simple message boxes.

Metafonts Supplied by LabWindows/CVI

National Instruments ships LabWindows/CVI with two metafonts that use typefaces that are not native to the operating systems. VAL_7SEG_META_FONT provides compatibility with LabWindows for DOS. VAL_SYSTEM_META_FONT provides compatibility with function panel help text and user interface panels from LabWindows for DOS that use extended IBM PC characters. Avoid using extended IBM characters because other fonts do not display them. Cut/paste operations with extended IBM characters fail across applications that use other fonts.

User-Defined Metafonts

You can create metafonts with CreateMetaFont. You then can apply the metafont to any control or panel attribute that takes a font value. When you apply a metafont, you set the typeface, point size, and text styles all at one time. Because metafonts contain character size information, strings that use metafonts are more likely to have the same width across platforms.

Note  Some LabWindows/CVI functions such as PlotText and GetTextDisplaySize require a metafont as an input parameter.

Host Fonts

In addition to fonts LabWindows/CVI provides and metafonts you create, you can use any host font supported on your system. For example, Arial, Courier New, and Times New Roman are available under Windows. Unlike metafonts, host fonts do not contain point size and text style information. You must specify this information.

If you are distributing an application across several computers, consider using common host fonts instead of predefined fonts. If you use a host font, a control will have the same size, in pixels, across computers with different user preferences.

Note   If you distribute an application that uses host fonts, these host fonts must be present on all machines to which you distribute the application.