Typeface

Low-level interface for drawing text. Represents a single typeface.

Unlike the rest of Fluid, Typeface doesn't define pixels as 1/96th of an inch. DPI must also be specified manually.

See: fluid.text.Text for an interface on a higher level.

Members

Functions

advance
Vector2 advance(dchar glyph)

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

defaultWordChunks
defaultWordChunks(Range range)

Default word splitter used by measure/draw.

dpi
Vector2 dpi(Vector2 scale)

Set font scale. This should be called at least once before drawing.

dpi
Vector2 dpi()

Get curently set DPI.

draw
void draw(Image image, Rectangle rectangle, String text, Color tint, bool wrap)

Draw text within the given rectangle in the image.

drawLine
void drawLine(Image target, Vector2 penPosition, string text, Color tint)

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

glyphCount
long glyphCount()

List glyphs in the typeface.

lineHeight
int lineHeight()

Get line height.

measure
Vector2 measure(Vector2 availableSpace, String text, bool wrap)
Vector2 measure(String text)

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

penPosition
Vector2 penPosition()

Get initial pen position.

Static functions

defaultTypeface
defaultTypeface()

Get the default Fluid typeface.

Meta