Font To Command

Purpose

Generates font parameters for SetFont

Syntax

Font keyword value [To hFont]

keyword:font attribute name
value:attribute setting
hFont:Handle

Description

By using the Font command a font other than the standard Windows font can be generated for SetFont (e.g. SYSTEM_FIXED_FONT). The parameters are quite numerous and the syntax is fairly flexible. Font is followed, in addition to many programming lines, by a number of keywords which are themselves followed by a parameter:

ITALIC n n = 0 normal font
n <> 0 italic font
UNDERLINE n n = 0 normal font
n <> 0 underlined
STRIKEOUT n n = 0 normal font
n <> 0 strikeout
CHARSET n n = 0 ANSI_CHARSET - Windows char set
n = 2 SYMBOL_CHARSET - symbol character set (Greek, mathematical or dingbats)
n = 128 SHIFTJIS_CHARSET - Japanese
n = 255 OEM_CHARSET - IBM character set
OUTPRECISION n At this time not implemented in Windows
n = 0 OUT_DEFAULT_PRECIS
n = 1 OUT_STRING_PRECIS
n = 2 OUT_CHARACTER_PRECIS
n = 3 OUT_STROKE_PRECIS
CLIPPRECISION n regulates the clipping of characters which are partially outside of the Clipping area.
n = 0 CLIP_DEFAULT_PRECIS
n = 1 OUT_CHARACTER_PRECIS
n = 2 OUT_STROKE_PRECIS
QUALITY n determines whether the Windows bitmaps are scaledin order to generate other font sizes.
n = 0 DEFAULT_QUALITY
n = 1 DRAFT_QUALITY
n = 2 PROOF_QUALITY (letter quality,
PITCH n specifies proportional (i.e., the "i" occupies asmaller character width than the "m".)
n = 0 DEFAULT_PITCH
n = 1 FIXED_PITCH
n = 2 VARIABLE_PITCH
FAMILY n font family:
n = 0 FF_DONTCARE doesn't matter, like SYSTEM_FIXED_FONT
n = 16 FF_ROMAN a font with serifs, small hooks
n = 32 FF_SWISS a simple font without decorations
n = 48 FF_MORN COURIER, PICA etc., similar to a typewriter font, fixed pitch, or OEM_FIXED_FONT
n = 64 FF_SCRIPT longhand font
n = 80 FF_DECORATIVE symbols, dingbats, Greek
WEIGHT n light, normal or bold
n = 0 FW_DONTCARE
n = 100 FW_THIN
n = 200 FW_EXTRALIGHT
n = 300 FW_LIGHT
n = 400 FW_NORMAL normal
n = 500 FW_MEDIUM
n = 600 FW_SEMIBOLD
n = 700 FW_BOLDBOLD
n = 800 FW_EXTRABOLD
n = 900 FW_HEAVY
WIDTH n character width
HEIGHT n character height
ORIENTATION n rotation angle of individual characters in 10ths of a degree, so for n = 1800 they are upside down
ESCAPEMENT n character rotation again in 10ths of a degree, Orientation and Escapement are only available for vector fonts. "Morn", "Roman", and "Script".

Font To hFontTo then follows as the last variable. It determines the creation of a logical font according the setting specified. This variable returns as a result a font handle. This font can then be used anywhere, where a font handle is required, for instance with SetFont. Afterwards, the font must be released with FreeFont or DelFont.

The parameters can span several lines (all starting with Font...) and may optionally be separated with commas.

Example

OpenW 1

Local fnt As Handle

Font "roman"

Font Italic 0, Weight 1000 , Width 20, Height 40

Font Orientation 0, StrikeOut 0, Underline 0, Escapement 450

Font Family FF_ROMAN, CharSet OEM_CHARSET , Pitch FIXED_PITCH

Font To fnt

SetFont fnt

Text 100, 100, "Hello"

SetFont SYSTEM_FONT

FreeFont fnt

Remarks

_Font$ returns a string with the parameters set with the Font command.

See Also

Font, Font To, SetFont, GetFont, RFont, Dlg Font, _hFont, _font$, _font$=, FreeFont, DelFont

{Created by Sjouke Hamstra; Last updated: 06/10/2014 by James Gaite}