Class FreeTypeFont

Font implementation based on FreeType.

class FreeTypeFont
  : Font;

Constructors

NameDescription
this (item, size) need to call create() after construction to initialize font

Fields

NameTypeDescription
_allowKerning bool
_refCount intcount of references to this object from Ref
_spaceWidth int
_textSizeBuffer int[]Buffer to reuse while measuring strings to avoid GC

Properties

NameTypeDescription
allowKerning[get] booloverride to allow kerning
baseline[get] intreturns baseline offset
face[get] stringreturns font face name
family[get] FontFamilyreturns font family
height[get] intreturns actual font height including interline space
isNull[get] boolreturns true if font object is not yet initialized / loaded
italic[get] boolreturns true if font is italic
size[get] intreturns font size (as requested from font engine)
weight[get] intreturns font weight
allowKerning[set] booloverride to enable kerning support
antialiased[get] boolreturn true if antialiasing is enabled, false if not enabled
isFixed[get] boolreturns true if font has fixed pitch (all characters have equal width)
refCount[get] intreturns current value of reference counter
spaceWidth[get] intreturns true if font is fixed

Methods

NameDescription
checkpoint () clear usage flags for all entries
cleanup () removes entries not used after last call of checkpoint() or cleanup()
clear () cleanup resources
clearGlyphCache () clears glyph cache
create () load font files
findGlyph (code, def_char, index, file) find glyph index for character
getCharGlyph (ch, withImage) get character glyph information
getGlyphIndex (code)
getKerningOffset (prevChar, currentChar) override to implement kerning offset calculation
addRef () increments reference counter
charWidth (ch) returns character width
drawMultilineText (buf, x, y, text, color, maxLines, maxWidth, tabSize, tabOffset, textFlags) draws multiline text with line splitting
drawStyledText (buf, x, y, text, charProps, tabSize, tabOffset, textFlags) Draw text string to buffer.
drawText (buf, x, y, text, color, tabSize, tabOffset, textFlags) Draw text string to buffer.
measureMultilineText (text, maxLines, maxWidth, tabSize, tabOffset, textFlags) measure multiline text with line splitting, returns width and height in pixels
measureText (text, widths, maxWidth, tabSize, tabOffset, textFlags) Measure text string, return accumulated widths[] (distance to end of n-th character), returns number of measured chars.
releaseRef () decrement reference counter, destroy object if no more references left
textSize (text, maxWidth, tabSize, tabOffset, textFlags) Measure text string as single line, returns width and height
textSizeImpl (font, text, maxWidth, tabSize, tabOffset, textFlags)

Aliases

NameDescription
~this
textSizeMemoized