Win32Prn() > Font methods |
Selects the current font.
:setFont( <cFontName> , ; [<nPointSize>] , ; [<nFontWidth>] , ; [<nFontWeight>], ; [<lUnderline>] , ; [<lItalic>] , ; [<nCharSet>] ) --> lSuccess
Alternatively, a two element array can be passed. It is used to calculate the font width in the unit "Characters Per Inch" (CPI) by dividing the second element by the first element. For example:
aFontWidth := { 3, 50 } nCPI := aFontWidth[2]/aFontWidth[1] ? nCPI // 16.67 characters per inch
When the array {0,0} is passed, the default font width is selected.
Note: when the second element contains a negative value, fixed character spacing is enforced, even if the font is a proportional font.
Constants for font weights
Constant | Value |
---|---|
FW_DONTCARE | 0 |
FW_THIN | 100 |
FW_EXTRALIGHT | 200 |
FW_LIGHT | 300 |
FW_NORMAL | 400 |
FW_MEDIUM | 500 |
FW_SEMIBOLD | 600 |
FW_BOLD | 700 |
FW_EXTRABOLD | 800 |
FW_HEAVY | 900 |
Constants for character sets
Constant | Value |
---|---|
ANSI_CHARSET | 0 |
DEFAULT_CHARSET *) | 1 |
SYMBOL_CHARSET | 2 |
SHIFTJIS_CHARSET | 128 |
HANGEUL_CHARSET | 129 |
HANGUL_CHARSET | 129 |
GB2312_CHARSET | 134 |
CHINESEBIG5_CHARSET | 136 |
OEM_CHARSET | 255 |
JOHAB_CHARSET | 130 |
HEBREW_CHARSET | 177 |
ARABIC_CHARSET | 178 |
GREEK_CHARSET | 161 |
TURKISH_CHARSET | 162 |
VIETNAMESE_CHARSET | 163 |
THAI_CHARSET | 222 |
EASTEUROPE_CHARSET | 238 |
RUSSIAN_CHARSET | 204 |
*) default |
Method :setFont() selects the current font. This font is used by methods :textOut() or :textOutAt() for printing text. When the font with the desired properties exists and can be selected, the method returns .T. (true). Note that the operating system may select a font that does not match the passed parameters exactly, but chooses a "best fit" font instead.
Use method :getFonts() to obtain a font information array holding data of all fonts available.
http://www.xHarbour.com