FreetypeTypeface

Represents a freetype2-powered typeface.

Constructors

this
this()

Load the default typeface.

this
this(FT_Face face)
this
this(string filename)

Load a font from a file.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

advance
Vector2 advance(dchar glyph)
Undocumented in source. Be warned that the author may not have intended to support it.
dpi
Vector2 dpi()
Undocumented in source. Be warned that the author may not have intended to support it.
dpi
deprecated Vector2 dpi(Vector2 dpi)
Undocumented in source. Be warned that the author may not have intended to support it.
drawLine
void drawLine(Image target, Vector2 penPosition, Rope text, ubyte paletteIndex)

Draw a line of text

glyphCount
long glyphCount()
Undocumented in source. Be warned that the author may not have intended to support it.
indentWidth
inout(int) indentWidth()
Undocumented in source. Be warned that the author may not have intended to support it.
isOwner
bool isOwner()
Undocumented in source. Be warned that the author may not have intended to support it.
isOwner
bool isOwner(bool value)
Undocumented in source. Be warned that the author may not have intended to support it.
lineHeight
int lineHeight()

Line height.

opEquals
bool opEquals(Object object)

Instances of Typeface have to be comparable in a memory-safe manner.

penPosition
Vector2 penPosition()

Get initial pen position.

setSize
void setSize(Vector2 dpi, float size)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

defaultTypeface
FreetypeTypeface defaultTypeface;
Undocumented in source.

Structs

AdvanceCacheKey
struct AdvanceCacheKey
Undocumented in source.

Variables

advanceCache
Vector2[AdvanceCacheKey] advanceCache;

Cache for character sizes.

face
FT_Face face;

Underlying face.

lineHeightFactor
float lineHeightFactor;

Adjust line height. 1 uses the original line height, 2 doubles it.

Inherited Members

From Typeface

glyphCount
long glyphCount()

List glyphs in the typeface.

penPosition
Vector2 penPosition()

Get initial pen position.

lineHeight
int lineHeight()

Get line height.

indentWidth
inout(int) indentWidth()

Width of an indent/tab character, in dots. Text sets indentWidth automatically.

advance
Vector2 advance(dchar glyph)

Get advance vector for the given glyph. Uses dots, not pixels, as the unit.

dpi
deprecated Vector2 dpi(Vector2 scale)

Set font scale. This should be called at least once before drawing. Text sets DPI automatically.

dpi
Vector2 dpi()

Get curently set DPI.

setSize
void setSize(Vector2 dpi, float size)

Set the font size. This should be called at least once before drawing. Text, if used, sets this automatically.

drawLine
void drawLine(Image target, Vector2 penPosition, Rope text, ubyte paletteIndex)

Draw a line of text. Note: This API is unstable and might change over time.

opEquals
bool opEquals(Object object)

Instances of Typeface have to be comparable in a memory-safe manner.

defaultTypeface
defaultTypeface()

Get the default Fluid typeface.

defaultWordChunks
alias defaultWordChunks = .breakWords

Default word splitter used by measure/draw.

lineSplitter
lineSplitter(Range text)
lineSplitterIndex
lineSplitterIndex(Range text)

Updated version of std.string.lineSplitter that includes trailing empty lines.

measure
Vector2 measure(Vector2 availableSpace, String text, bool wrap)
Vector2 measure(String text)
void measure(TextRuler ruler, String text, bool wrap)

Measure space the given text would span. Uses dots as the unit.

eachWord
auto eachWord(TextRuler ruler, String text, bool wrap)

Helper function

draw
void draw(Image image, Rectangle rectangle, String text, ubyte paletteIndex, bool wrap)

Draw text within the given rectangle in the image.

drawTab
void drawTab(Vector2 penPosition)

Helper function for typeface implementations, providing a "draw" function for tabs, adjusting the pen position automatically.

Meta