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.

Consts

wFontFamilyDefault = 0
wFontFamilyRoman = 16
wFontFamilySwiss = 32
wFontFamilyModern = 48
wFontFamilyScript = 64
wFontFamilyDecorative = 80
wFontWeightThin = 100
wFontWeightExtralight = 200
wFontWeightLight = 300
wFontWeightNormal = 400
wFontWeightMedium = 500
wFontWeightSemiBold = 600
wFontWeightBold = 700
wFontWeightExtraBold = 800
wFontWeightHeavy = 900
wFontEncodingDefault = 1
wFontEncodingSystem = 1
wFontEncodingCp1252 = 0
wFontEncodingCp932 = 128
wFontEncodingCp1361 = 130
wFontEncodingCp936 = 134
wFontEncodingCp949 = 129
wFontEncodingCp950 = 136
wFontEncodingCp1250 = 238
wFontEncodingCp1251 = 204
wFontEncodingCp1253 = 161
wFontEncodingCp1254 = 177
wFontEncodingCp1255 = 178
wFontEncodingCp1257 = 186
wFontEncodingCp1258 = 163
wFontEncodingCp874 = 222
wFontEncodingCp437 = 255
wFontEncodingCp850 = 255

Procs

proc final(self: wFont) {...}{.raises: [Exception], tags: [RootEffect].}
Default finalizer for wFont.
proc init(self: wFont; lf: var LOGFONT) {...}{.raises: [wFontError], tags: [].}
Initializes a font from LOGFONT struct. Used internally.
proc Font(lf: var LOGFONT): wFont {...}{.inline, discardable,
                               raises: [Exception, 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: [IndexError, wFontError], tags: [].}
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: [Exception, IndexError, wFontError],
    tags: [RootEffect].}
Constructor.
proc init(self: wFont; hFont: HANDLE; copy = true; shared = false) {...}{.
    raises: [IndexError, wFontError], tags: [].}
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: [Exception, IndexError, wFontError], tags: [RootEffect].}
Constructor.
proc init(self: wFont; font: wFont) {...}{.raises: [NilAccessError, IndexError, wFontError],
                                 tags: [].}
Initializes a font from wFont object, aka. copy.
proc Font(font: wFont): wFont {...}{.inline, discardable, raises: [Exception, NilAccessError,
    IndexError, 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: [IndexError, wFontError],
    tags: [].}
Sets the point size.
proc setFamily(self: wFont; family: int) {...}{.raises: [IndexError, wFontError], tags: [].}
Sets the font family.
proc setWeight(self: wFont; weight: int) {...}{.raises: [IndexError, wFontError], tags: [].}
Sets the font weight.
proc setItalic(self: wFont; italic: bool) {...}{.raises: [IndexError, wFontError], tags: [].}
Sets the font italic style.
proc setUnderlined(self: wFont; underline: bool) {...}{.raises: [IndexError, wFontError],
    tags: [].}
Sets underlining.
proc setStrikeout(self: wFont; strikeout: bool) {...}{.raises: [IndexError, wFontError],
    tags: [].}
Sets strikeout attribute of the font.
proc setFaceName(self: wFont; faceName: string) {...}{.raises: [IndexError, wFontError],
    tags: [].}
Sets the facename for the font.
proc setEncoding(self: wFont; encoding: int) {...}{.raises: [IndexError, wFontError],
    tags: [].}
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.