Types
PFontObject = ref TFontObject
TFontObject = object of TObject
TTTFRenderMode = enum solid, shaded, blended
PTTFFont = ref TTTFFont
TTTFFont = object of TFontObject fFont: PFont size*: int color*: TColor ## font color background*: TColor ## background color (only for shaded render mode). mode*: TTTFRenderMode ## TTF render mode (solid, shaded, blended) utf8*: bool ## use UTF-8
- font size
PBitmapFont = ref TBitmapFont
TBitmapFont = object of TFontObject fFont: PSprite fColor: TColor fUseColor: bool
Procs
proc init(obj: PTTFFont; filename: cstring; size: cint = 16; color: TColor = color(255, 255, 255); background: TColor = color(0, 0, 0); mode: TTTFRenderMode = solid; utf8: bool = true)
proc free(obj: PTTFFont)
proc newTTFFont(filename: cstring; size: cint = 16; color: TColor = color(255, 255, 255); background: TColor = color(0, 0, 0); mode: TTTFRenderMode = solid; utf8: bool = true): PTTFFont
-
filename: ttf file to load from.
size: font size.
color: font color.
background: background color (only for shaded render mode).
mode: TTF render mode (solid, shaded, blended).
utf8: true to use UTF-8.
proc init(obj: PBitmapFont; filename: cstring; w, h: int)
proc init(obj: PBitmapFont; surface: PSurface; w, h: int)
proc init(obj: PBitmapFont; filename: cstring; w, h: int; color: TColor)
proc init(obj: PBitmapFont; surface: PSurface; w, h: int; color: TColor)
proc free(obj: PBitmapFont)
proc newBitmapFont(filename: cstring; w, h: int): PBitmapFont
-
filename: image (charmap) to load from.
w: width of single char in pixels.
h: height of single char in pixels.
proc newBitmapFont(surface: PSurface; w, h: int): PBitmapFont
proc newBitmapFont(filename: cstring; w, h: int; color: TColor): PBitmapFont
-
filename: image (charmap) to load from.
w: width of single char in pixels.
h: height of single char in pixels.
color: font color.
proc newBitmapFont(surface: PSurface; w, h: int; color: TColor): PBitmapFont
proc render(obj: PFontObject; text: varargs[string]): PSurface
- Render multiple lines of text.
Methods
method render(obj: PFontObject; text: string): PSurface {.inline.}
method free(obj: PFontObject)
method width(obj: PFontObject; text: string): int {.inline.}
method height(obj: PFontObject): int {.inline.}
method width(obj: PTTFFont; text: string): int {.inline.}
method height(obj: PTTFFont): int {.inline.}
method render(obj: PTTFFont; text: string): PSurface {.inline.}
method width(obj: PBitmapFont; text: string): int {.inline.}
method height(obj: PBitmapFont): int {.inline.}
method color(obj: PBitmapFont): TColor {.inline.}
method color=(obj: PBitmapFont; value: TColor) {.inline.}
method render(obj: PBitmapFont; text: string): PSurface {.inline.}