FONT

IUP - Portable User Interface

FONT (since 3.0)

Character font of the text shown in the element. See FONT definition up to IUP 2.x.

Value

Font description containing typeface, style and size.

The common format definition is similar to the the Pango library Font Description, used by GTK+2. It is defined as having 3 parts: <font family>, <font styles> <font size>.

Font family can be a list of fonts face names, but this is only accepted in GTK. So the font family can be reduced to font face.

The supported font style is a combination of: Bold, Italic, Underline and Strikeout. Underline and Strikeout are supported only in the Windows and GTK drivers. The Pango format include many other definitions not supported by the common format, they are supported only by the GTK driver. Unsupported values are simply ignored.

Font size is in points (1/72 inch) or in pixels (using negative values).

The Old Character Fonts name are still supported in all drivers. The old Windows format is still supported in the Windows driver. And the X-Windows Logical Font Description format (XLFD) is supported in the Motif driver.

Returned values will be the same value when changing the attribute, except for the old character font names that will be converted to the new common format definition.

Windows

Default: "Tahoma, 10"

The native handle can be obtained using the "HFONT" attribute.

Motif

Default: "Fixed, 11"         (if not defined in a user resource file, see bellow)

The native handle can be obtained using the "XMFONTLIST" and "XFONTSTRUCT" attributes.

You can use the xfontsel program to obtain a string in the X-Windows Logical Font Description format (XLFD). Noticed that the first size entry of the X-Windows font string format (pxlsz) is in pixels and the next one (ptSz) is in deci-points (multiply the value in points by 10).

Be aware that the resource files ".Xdefaults" and "Iup" in the user home folder can affect the default font and many others visual appearance in Motif.

GTK

Default: "Sans, 10".

The native handle can be obtained using the "PANGOFONTDESC" attribute.

Style can also be a combination of: Small-Caps, [Ultra-Light|Light|Medium|Semi-Bold|Bold|Ultra-Bold|Heavy], [Ultra-Condensed|Extra-Condensed|Condensed|Semi-Condensed|Semi-Expanded|Expanded|Extra-Expanded|Ultra-Expanded].

Examples:

"Times, Bold 18"
"Arial,Helvetica, 24" (list of fonts for GTK)
"Courier New, Italic Underline -30" (size in pixels)

Affects

All elements, since the SIZE attribute depends on the FONT attribute.

Boxes and Fill (they do not have a native mapping) use the native parent FONT attribute. When set it will only affect their children.

Auxiliary Attributes

They will change the FONT attribute, and can not be retrieved. They are used only to set partial FONT parameters of style and size. To do that the FONT attribute is parsed, changed and updated to the new value in the common format definition. This means that if the attribute was set in X-Windows format or in the old Windows and IUP formats, the previous value will be replaced by a new value in the common format definition. Pango additional styles will also be removed.

FONTSTYLE

Replaces or returns the style of the current FONT attribute.

FONTSIZE

Replaces or returns the size of the current FONT attribute.

FONTFACE (read-only)

Returns the face name of the current FONT attribute.

FOUNDRY (Motif Only)

Allows to select a foundry for the FONT being selected. Must be set before setting the FONT attribute.