Class Font

(back to index)

Font constants

Property index

Font.boldFont.helveticaFont.screenFont.times
Font.courierFont.italicFont.symbolFont.zapf_dingbats

Function index

Font:get_fontFont:get_font_nameFont:set_fontFont:set_fonts

Description

FLTK manages fonts via an array indexed by small integers. Font provides named fonts and functions to manipulate the font array.

Detailed reference

Font.helvetica: Font

Base emphasis Helvetica (or Arial on Win32). You may add both Font.bold and Font.italic to get bold and oblique versions.

Font.times: Font

Base emphasis Times. You may add both Font.bold and Font.italic to get bold and italic versions.

Font.courier: Font

Base emphasis Courier. You may add both Font.bold and Font.italic to get bold and oblique versions.

Font.symbol: Font

The Symbol font. No emphasized versions are available.

Font.screen: Font

Base emphasis of a standard monospaced screen font. You may add Font.bold for a bold version, but no italic or oblique is available.

Font.zapf_dingbats: Font

The Zapf Dingbats font. No emphasized versions are available.

Font.bold: Font

Add this to other fonts to bold them. For example, Font.times + Font.bold

Font.italic: Font

Add this to other fonts to make them italic or oblique. For example, Font.courier + Font.italic

Font:get_font(Font f): string

Get the string for this face. This string is different for each face. Under X this value is passed to XListFonts to get all the sizes of this face

Font:set_font(Font f): integer

Set the font string of a Font.

Font:get_font_name(Font f): string name, Font emphasis

Get a human-readable string describing the family of this face. This is useful if you are presenting a choice to the user. There is no guarantee that each face has a different name.

The emphasis returned is 0, Font.bold, Font.italic or Font.bold+Font.italic. To locate a "family" of fonts, search forward and back for a set with non-zero attributes; these faces along with the face with a zero attribute before them constitute a family.

Font:set_fonts(string name): integer

FLTK will open the display, and add every font on the server to the face table. It will attempt to put "families" of faces together, so that the normal one is first, followed by bold, italic, and bold italic.

The optional argument is a string to describe the set of fonts to add. Passing nil will select only fonts that have the ISO8859-1 character set (and are thus usable by normal text). Passing "-*" will select all fonts with any encoding as long as they have normal X font names with dashes in them. Passing "*" will list every font that exists (on X this may produce some strange output). Other values may be useful but are system dependent. With WIN32 nil selects fonts with ISO8859-1 encoding and non-nil selects all fonts.

The return value is how many faces are in the table after this is done.


doctool generated at Sun Aug 12 22:23:18 2001