Class Font

Instance of font with specific size, weight, face, etc.

Allows to measure text string and draw it on DrawBuf

Use FontManager.instance.getFont() to retrieve font instance.

Inherits from

Fields

Name Type Description
_refCount int count of references to this object from Ref

Properties

Name Type Description
antialiased [get] bool return true if antialiasing is enabled, false if not enabled
baseline [get] int returns baseline offset
face [get] string returns font face name
family [get] FontFamily returns font family
height [get] int returns actual font height including interline space
isFixed [get] bool returns true if font has fixed pitch (all characters have equal width)
isNull [get] bool returns true if font object is not yet initialized / loaded
italic [get] bool returns true if font is italic
size [get] int returns font size (as requested from font engine)
spaceWidth [get] int returns true if font is fixed
weight [get] int returns font weight
refCount [get] int returns current value of reference counter

Methods

Name Description
charWidth returns character width
checkpoint clear usage flags for all entries
cleanup removes entries not used after last call of checkpoint() or cleanup()
clear
clearGlyphCache clears glyph cache
drawColoredText Draw text string to buffer.
drawMultilineText draws multiline text with line splitting
drawText Draw text string to buffer.
getCharGlyph get character glyph information
measureMultilineText measure multiline text with line splitting, returns width and height in pixels
measureText Measure text string, return accumulated widths[] (distance to end of n-th character), returns number of measured chars.
textSize Measure text string as single line, returns width and height
addRef increments reference counter
releaseRef decrement reference counter, destroy object if no more references left

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0