FreeTypeFont

Font implementation based on FreeType.

Constructors

this
this(FontFileItem item, int size)

need to call create() after construction to initialize font

Destructor

~this
~this()

do cleanup

Members

Functions

checkpoint
void checkpoint()

clear usage flags for all entries

cleanup
void cleanup()

removes entries not used after last call of checkpoint() or cleanup()

clear
void clear()

cleanup resources

clearGlyphCache
void clearGlyphCache()

clears glyph cache

create
bool create()

load font files

findGlyph
bool findGlyph(dchar code, dchar def_char, FT_UInt index, FreeTypeFontFile file)

find glyph index for character

getCharGlyph
Glyph* getCharGlyph(dchar ch, bool withImage)
Undocumented in source. Be warned that the author may not have intended to support it.
getGlyphIndex
uint getGlyphIndex(dchar code)
Undocumented in source. Be warned that the author may not have intended to support it.
getKerningOffset
int getKerningOffset(dchar prevChar, dchar currentChar)

override to implement kerning offset calculation

Properties

allowKerning
bool allowKerning [@property getter]

override to allow kerning

baseline
int baseline [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
face
string face [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
family
FontFamily family [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
height
int height [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
instanceCount
int instanceCount [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
isNull
bool isNull [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
italic
bool italic [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
size
int size [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
weight
int weight [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_instanceCount
int _instanceCount;
Undocumented in source.

Inherited Members

From Font

~this
~this()
Undocumented in source.
size
int size [@property getter]

returns font size (as requested from font engine)

height
int height [@property getter]

returns actual font height including interline space

weight
int weight [@property getter]

returns font weight

baseline
int baseline [@property getter]

returns baseline offset

italic
bool italic [@property getter]

returns true if font is italic

face
string face [@property getter]

returns font face name

family
FontFamily family [@property getter]

returns font family

isNull
bool isNull [@property getter]

returns true if font object is not yet initialized / loaded

antialiased
bool antialiased [@property getter]

return true if antialiasing is enabled, false if not enabled

isFixed
bool isFixed [@property getter]

returns true if font has fixed pitch (all characters have equal width)

_spaceWidth
int _spaceWidth;
Undocumented in source.
spaceWidth
int spaceWidth [@property getter]

returns true if font is fixed

charWidth
int charWidth(dchar ch)

returns character width

_allowKerning
bool _allowKerning;
Undocumented in source.
allowKerning
bool allowKerning [@property getter]

override to enable kerning support

allowKerning
bool allowKerning [@property setter]

override to enable kerning support

getKerningOffset
int getKerningOffset(dchar prevChar, dchar currentChar)

override to implement kerning offset calculation

measureText
int measureText(dchar[] text, int[] widths, int maxWidth, int tabSize, int tabOffset, uint textFlags)

Measure text string, return accumulated widths[] (distance to end of n-th character), returns number of measured chars.

_textSizeBuffer
int[] _textSizeBuffer;

Buffer to reuse while measuring strings to avoid GC

textSize
Point textSize(dstring text, int maxWidth, int tabSize, int tabOffset, uint textFlags)

Measure text string as single line, returns width and height

textSizeMemoized
alias textSizeMemoized = memoize!(Font.textSizeImpl)
Undocumented in source.
textSizeImpl
Point textSizeImpl(Font font, dchar[] text, int maxWidth, int tabSize, int tabOffset, uint textFlags)
Undocumented in source. Be warned that the author may not have intended to support it.
drawText
void drawText(DrawBuf buf, int x, int y, dchar[] text, uint color, int tabSize, int tabOffset, uint textFlags)

Draw text string to buffer.

drawColoredText
void drawColoredText(DrawBuf buf, int x, int y, dchar[] text, CustomCharProps[] charProps, int tabSize, int tabOffset, uint textFlags)

Draw text string to buffer.

measureMultilineText
Point measureMultilineText(dchar[] text, int maxLines, int maxWidth, int tabSize, int tabOffset, uint textFlags)

measure multiline text with line splitting, returns width and height in pixels

drawMultilineText
void drawMultilineText(DrawBuf buf, int x, int y, dchar[] text, uint color, int maxLines, int maxWidth, int tabSize, int tabOffset, uint textFlags)

draws multiline text with line splitting

getCharGlyph
Glyph* getCharGlyph(dchar ch, bool withImage)

get character glyph information

checkpoint
void checkpoint()

clear usage flags for all entries

cleanup
void cleanup()

removes entries not used after last call of checkpoint() or cleanup()

clearGlyphCache
void clearGlyphCache()

clears glyph cache

clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta