set_font ( : : WindowHandle, Font : )

Set the font used for text output.

set_font sets the font for the output window. The font is used by the operators write_string, read_string etc. Text windows as well as windows for image display use fonts. A default font is assigned when a window is opened. This font can be changed with set_font. On UNIX systems all available fonts can be queried with query_font. The default font can be modified with set_system('default_font',Fontname). Fonts are not used for file operations.

The syntax for the specification of a font (in Font) differs for UNIX and Windows NT environments: In Windows NT a string with the following components is used: -FontName-Height-Width-Italic-Underlined-Strikeout-[Bold-][CharSet-]

where ``Italic'', ``Underlined'', ``Strikeout'' and ``Bold'' can take the values 1 and 0 to activate or deactivate the corresponding feature. ``Charset'' can be used to select the character set, if it differs from the default one. You can use the names of the defines or the integer value.

All parameters beside ``FontName'' und ``Height'' are optional. But at the beginn and end a Minus is suspected. To use the default setting, a * can be used instead. -Arial-10-*-1-*-*-1-

Please refer to the Windows NT documentation for a detailed discussion.


Attention

For different machines the available fonts may differ a lot. Therefore it is suggested to use wildcards, tables of fonts and/or the operator query_font.


Parameters

WindowHandle (input_control)
window -> integer
Window identifier.

Font (input_control)
string -> string
Name of new font.


Example
// UNIX
set_font(WindowHandle,'-*-courier-*-*-*-*-18-*-*-*-*-*-*-*') 
// Windows NT
set_font(WindowHandle,'-Arial-18-*-*-*-*-')
write_string(WindowHandle,'Text with Font size of 18 pixels') 
new_line(WindowHandle)
set_font(WindowHandle,'-Arial-18-*-*-*-*-1-')
write_string(WindowHandle,'Text with Font size of 18 pixels and bold') 
new_line(WindowHandle)

Result

set_font returns 2 (H_MSG_TRUE) if the font name is correct. Otherwise an exception handling is raised.


Parallelization Information

set_font is reentrant, local, and processed without parallelization.


Possible Predecessors

open_window, open_textwindow


Possible Successors

query_font


See also

get_font, query_font, open_textwindow, open_window


Module

System



Copyright © 1996-2005 MVTec Software GmbH