The normal screen, helvetica, roman and times font families available in the Unix/X11 version are available using the same names. The system will try to use an as close as possible equivalent Windows TrueType font for these.
The Windows `stock' fonts as available from the GetStockObject() API are available under the special `family' "win". They are in table 11
|font(win, ansi_fixed)||Default ANSI encoded fixed font|
|font(win, ansi_var)||Default ANSI encoded variable font|
|font(win, device_default)||Default device font|
|font(win, oem_fixed)||Computers `native' fixed font (PC)|
|font(win, system)||Variable pitched system font|
|font(win, system_fixed)||Fixed system font|
|Table 11 : Windows font name mapping|
Note that these fonts do not have a specified point-size. Their
point-size depends on the Windows installation. The get-method
will return the
<-height of the font.
Other Windows fonts may be accessed using a similar method as in Unix/X11: provide a fourth argument describing the font using the hosts conventions. For the Win32 API, this is a textual description of the Windows API structure LOGFONT passed to CreateFontIndirect(). The description is a `:' (colon) separated list of attributes of the structure. The attributes need not be specified in the order of the structure-layout. Omited attributes are set to their default.
Attributes come in four types: numeric, boolean, enumerated and string. In general, an attribute is specified as:
<name>(<value>)<name> is matches case-insensitive against the name of the structure field without the leading `lf' string. For numeric types, the argument is interpreted as a decimal number (spaces are not allowed). For a boolean argument, the (value) part is omitted. By default the boolean attributes are FALSE. Including the attribute name in the specification sets the field to TRUE. Enumerated fields are specified using their symbolic name. Name-matching is case-insensitive. Common parts of the API identifier to make the symbol unique (for example _CHARSET in ANSI_CHARSET) are removed. String arguments simply take the value between the brackets. Spaces are included in the output, case is not changed and there is no escape for the closing-brace.
The default settings are in table 12, the attributes are in table 13.
|<points> × font.scale|
|bold if <style> is bold, normal otherwise|
|TRUE if <style> is italic or oblique|
|fixed if <family> is screen|
|swiss if <family> is helvetica, roman if <family> is times, modern if <family> is screen dontcare otherwise.|
|Table 12 : Windows font defaults|
|point-size of the requested font|
|average width of the characters|
|angle in 1/10 degrees of the baseline|
|angle for each character|
|0..1000 scale for thickness|
|request italic look|
|underline all characters|
|Quality of output
|Style of the
|Use specific font database|
|Table 13 : Windows font attributes|
The following example binds the Windows `WingDings' symbol-font:
1 ?- new(F, font(wingdings, roman, 20, 'charset(symbol)')).
The following example uses this font to create an image from such a character:
:- send(@display, font_alias, wingdings, font(wingdings, roman, 20, 'charset(symbol)')). wingding_image(Index, Image) :- new(Image, image(@nil, 32, 32)), new(T, text(string('%c', Index), center, wingdings)), send(T, center, point(16, 16)), send(Image, draw_in, T), send(T, done). test :- wingding_image(60, Floppy), send(label(test, Floppy), open).