Invokes the common font selecting dialog box.
Dlg Font form, hDC, Flags[,Color[,Min, Max[,"Style"]]]
form:Form object
hDC, Flags, Color, Min, Max:integer expression
This command calls the common font-selector Dialog in COMMDLG.DLL.
form is a form object, like Me, Win_1, Dlg_1, frm1.
hDC is a device context of a printer, will be used only when declared with corresponding flags. When using screen fonts only, hDC should beset to a Null.
Flags is a long integer, which gives the bit-wise parameter for the font selection. These bits are:
CF_SCREENFONTS | $000001 | Indicates Screen font. |
CF_PRINTERFONTS | $000002 | Indicates Printer font. |
CF_BOTH | $000003 | Indicates Screen and Printer fonts. |
CF_INITTOLOGFONTSTRUCT | $000040 | Use the form's LOGFONT structure |
CF_EFFECTS | $000100 | Permits effects like: underlined, crossed out and color selections. |
CF_APPLY | $000200 | enables APPLY-button, with which the actual style and point size will be represented in the example field . |
CF_ANSIONLY | $000400 | Only enable fonts with the ANSI Characters set. |
CF_NOVECTORFONTS | $000800 | Only non-vectored fonts. |
CF_NOSIMULATIONS | $001000 | No GDI font simulations. |
CF_LIMITSIZE | $002000 | type-size limitation uses Min and Max parameters. |
CF_FIXEDPITCHONLY | $004000 | Only moonscape fonts. |
CF_WYSIWYG | $008000 | Only fonts that are available on the screen and the printer. Use with CF_BOTH and F_SCALABLEONLY. |
CF_FORCEFONTEXIST | $010000 | Show only fonts with a corresponding file. CF_SCALABLEONLY$020000 Only fonts which can assume any size (as vectored or TrueType) |
CF_TTONLY | $040000 | Only TrueType fonts (available in Windows 3.1 and higher) |
CF_NOFACESEL | $080000 | No Font selection. Used for selecting multiple fonts. |
CF_NOSTYLESEL | $100000 | No style selection. (i.e.: bold, italic...) |
CF_NOSIZESEL | $200000 | No size selection. This bit is automatically set, if "Style" is declared. |
CF_USESTYLE | $000080 |
These bits are not allowed in GFA-Basic:
CF_SHOWHELP | $000004 |
CF_ENABLEHOOK | $000008 |
CF_ENABLETEMPLATE | $000010 |
CF_ENABLETEMPLATEHANDLE | $000020 |
Color declares the color for the selected font. CF_EFFECTS must be set. Color value is must be stored in _ECX.
Min and Max are minimum and maximum point sizes. CF_LIMITSIZE must be set.
"Style" notes that the font style name is to be returned. If "Style" or "" is declared, the pointer to the style name is placed in _EBX. (i.e. Print (Char{_EBX}) may display Bold Italic.) _DX holds the size of a font in tenths of a point. _SI holds the type of the selected fonts. The possible values can any combination of:
SIMULATED_FONTTYPE | $8000 | GDI Simulated Font. |
PRINTER_FONTTYPE | $4000 | Printer Font. |
SCREEN_FONTTYPE | $2000 | Screen Font |
BOLD_FONTTYPE | $0100 | TrueType Bold Font. |
ITALIC_FONTTYPE | $0200 | TrueType Italic Font. |
REGULAR_FONTTYPE | $0400 | TrueType Regular Font. |
In the font field, normal (Windows 3.0) Fonts will not be marked. TrueType Fonts will be marked with a double T and printer fonts with a small printer symbol.
_AX is a null if there is an error.
OpenW 1
Global col%, fnt%
Dim a%(16), hfnt As Handle, s$
Dlg Font Win_1, 1, cdfScreenFonts, a%(1), col%
Font To hfnt // create font handle
RFont Name s$ // obtain font name
SetFont hfnt // select font
Print "test", s$ // test
SetFont 13 // select SystemFont
Print "test" // test
DelFont fnt // delete font object
This command is implemented for compatibility reasons only. Use CommDlg object instead.
CommDlg, Dlg Color, Dlg Open, Dlg Print, Font, Font To, SetFont, GetFont, RFont, Dlg Font, _hFont, _font$, _font$=, FreeFont, DelFont
{Created by Sjouke Hamstra; Last updated: 15/07/2022 by James Gaite; Other Contributors: Jean-Marie Melanson}