wFont

A font is an object which determines the appearance of text.

Superclass:wGdiObject
Seealso:wDC
Consts:
Font FamilyDescription
wFontFamilyDefaultFF_DONTCARE
wFontFamilyRomanFF_ROMAN
wFontFamilySwissFF_SWISS
wFontFamilyModernFF_MODERN
wFontFamilyScriptFF_SCRIPT
wFontFamilyDecorativeFF_DECORATIVE
Font WeightDescription
wFontWeightThinFW_THIN
wFontWeightExtralightFW_EXTRALIGHT
wFontWeightLightFW_LIGHT
wFontWeightNormalFW_NORMAL
wFontWeightMediumFW_MEDIUM
wFontWeightSemiBoldFW_SEMIBOLD
wFontWeightBoldFW_BOLD
wFontWeightExtraBoldFW_EXTRABOLD
wFontWeightHeavyFW_HEAVY
Font EncodingDescription
wFontEncodingDefaultDEFAULT_CHARSET
wFontEncodingSystemDEFAULT_CHARSET
wFontEncodingCp1252ANSI_CHARSET
wFontEncodingCp932SHIFTJIS_CHARSET
wFontEncodingCp1361JOHAB_CHARSET
wFontEncodingCp936GB2312_CHARSET
wFontEncodingCp949HANGUL_CHARSET
wFontEncodingCp950CHINESEBIG5_CHARSET
wFontEncodingCp1250EASTEUROPE_CHARSET
wFontEncodingCp1251RUSSIAN_CHARSET
wFontEncodingCp1253GREEK_CHARSET
wFontEncodingCp1254HEBREW_CHARSET
wFontEncodingCp1255ARABIC_CHARSET
wFontEncodingCp1257BALTIC_CHARSET
wFontEncodingCp1258VIETNAMESE_CHARSET
wFontEncodingCp874THAI_CHARSET
wFontEncodingCp437OEM_CHARSET
wFontEncodingCp850OEM_CHARSET

Types

wFontError = object of wGdiObjectError
  
An error raised when wFont creation failed.

Procs

proc init(self: wFont; lf: var LOGFONT) {...}{.raises: [wFontError], tags: [RootEffect].}
Initializes a font from LOGFONT struct. Used internally.
proc Font(lf: var LOGFONT): wFont {...}{.inline, discardable, raises: [wFontError],
                               tags: [RootEffect].}
Constructor.
proc init(self: wFont; pointSize: float = NaN; family = wFontFamilyDefault;
         weight = wFontWeightNormal; italic = false; underline = false;
         strikeout = false; faceName = ""; encoding = wFontEncodingDefault) {...}{.
    raises: [IndexDefect, wFontError], tags: [RootEffect].}
Initializes a font object with the specified attributes.
ParametersDescription
pointSizeSize in points.
familyThe font family: a generic portable way of referring to fonts without specifying a facename.
weightFont weight, sometimes also referred to as font boldness.
italicThe value can be true or false.
underlineThe value can be true or false.
strikeoutThe value can be true or false.
faceNameAn optional string specifying the face name to be used.
encodingThe font encoding.
proc Font(pointSize: float = NaN; family = wFontFamilyDefault;
         weight = wFontWeightNormal; italic = false; underline = false;
         strikeout = false; faceName = ""; encoding = wFontEncodingDefault): wFont {...}{.
    inline, discardable, raises: [IndexDefect, wFontError], tags: [RootEffect].}
Constructor.
proc init(self: wFont; hFont: HANDLE; copy = true; shared = false) {...}{.
    raises: [IndexDefect, wFontError], tags: [RootEffect].}
Initializes a font from system font handle. If copy is false, the function only wrap the handle to wFont object. If shared is false, the handle will be destroyed together with wFont object by the GC. Otherwise, the caller is responsible for destroying it. If hFont is not a system font handle, this function regard it a the point size in int type.
proc Font(hFont: HANDLE; copy = true; shared = false): wFont {...}{.inline, discardable,
    raises: [IndexDefect, wFontError], tags: [RootEffect].}
Constructor.
proc init(self: wFont; font: wFont) {...}{.raises: [wNilAccess, IndexDefect, wFontError],
                                 tags: [RootEffect].}
Initializes a font from wFont object, aka. copy.
proc Font(font: wFont): wFont {...}{.inline, discardable,
                            raises: [wNilAccess, IndexDefect, wFontError],
                            tags: [RootEffect].}
Constructor.
proc getPointSize(self: wFont): float {...}{.inline, raises: [], tags: [].}
Gets the point size.
proc getFamily(self: wFont): int {...}{.inline, raises: [], tags: [].}
Gets the font family if possible.
proc getWeight(self: wFont): int {...}{.inline, raises: [], tags: [].}
Gets the font weight.
proc getItalic(self: wFont): bool {...}{.inline, raises: [], tags: [].}
Gets true if font is italic.
proc getUnderlined(self: wFont): bool {...}{.inline, raises: [], tags: [].}
Gets true if the font is underlined.
proc getStrikeout(self: wFont): bool {...}{.inline, raises: [], tags: [].}
Gets true if the font is strikeout.
proc getFaceName(self: wFont): string {...}{.inline, raises: [], tags: [].}
Gets the font family if possible.
proc getEncoding(self: wFont): int {...}{.inline, raises: [], tags: [].}
Gets the encoding of this font.
proc setPointSize(self: wFont; pointSize: float) {...}{.raises: [IndexDefect, wFontError],
    tags: [RootEffect].}
Sets the point size.
proc setFamily(self: wFont; family: int) {...}{.raises: [IndexDefect, wFontError],
                                      tags: [RootEffect].}
Sets the font family.
proc setWeight(self: wFont; weight: int) {...}{.raises: [IndexDefect, wFontError],
                                      tags: [RootEffect].}
Sets the font weight.
proc setItalic(self: wFont; italic: bool) {...}{.raises: [IndexDefect, wFontError],
                                       tags: [RootEffect].}
Sets the font italic style.
proc setUnderlined(self: wFont; underline: bool) {...}{.raises: [IndexDefect, wFontError],
    tags: [RootEffect].}
Sets underlining.
proc setStrikeout(self: wFont; strikeout: bool) {...}{.raises: [IndexDefect, wFontError],
    tags: [RootEffect].}
Sets strikeout attribute of the font.
proc setFaceName(self: wFont; faceName: string) {...}{.raises: [IndexDefect, wFontError],
    tags: [RootEffect].}
Sets the facename for the font.
proc setEncoding(self: wFont; encoding: int) {...}{.raises: [IndexDefect, wFontError],
    tags: [RootEffect].}
Sets the encoding for this font.

Templates

template wNormalFont(): untyped
Predefined normal font. Don't delete.
template wSmallFont(): untyped
Predefined small font. Don't delete.
template wLargeFont(): untyped
Predefined large font. Don't delete.
template wItalicFont(): untyped
Predefined italic font. Don't delete.
template wBoldFont(): untyped
Predefined bold font. Don't delete.
template wDefaultFont(): untyped
Predefined default font. Don't delete.