Fonts and Font Argument Format

From STX Wiki
Jump to navigation Jump to search

For all commands in which a font setting is necessary, the following format can be used to specify the font and its attributes:

fontname:pointSize:attributes

fontname the name of the font (as displayed in the windows font dialog)
pointSize the size of a character in points
attributes attributes, any combination of following attribute characters:N, M or B font-weight (Normal, Medium or Bold)

I,U font-style (Italic and Underline)

The fontname is the only mandatory value. All other arguments have default values. If you omit the argument then the default value is used. If fontname contains blanks or non-standard ASCII characters, the whole font specification must be enclosed in quotes (because it must be one argument).

Font Table

To maintain compatibility with earlier program versions, an index or an abbreviation can be used for some fonts. If fontname is abbreviated, the first match in the list below is used (e.g. Ti = Times New Roman).

Note that you can get a list of currently supported fonts using the command STXCONSTANTS.

index fontname
0 Courier
1 Courier New
2 Fixedsys
3 Terminal
4 Arial
5 Times New Roman
6 MS Sans Serif
7 MS Serif
8 Arial Unicode MS
9 Lucida Sans Unicode
10 Microsoft Sans Serif
11 Tahoma

Notes

If you are using different fonts in a dialog you should first create all controls using the same font, and then assign individual fonts to the controls if desired. Do not change the dialog font during control creation. Using this method makes it simpler to specify control positions and sizes, because they are always based on the current dialog font.

It is not possible to specify a font without the fontname (i.e. to change size or attributes only).

It is also not possible to retrieve information about the font settings of dialogs, controls, displays or graphs.

Examples

Arial:8:MI

is equivalent to

4:8:MI

because Arial is part of the internal font table

'Times New Roman:10'
'Courier New::B'