Font

Describes a font as defined in a data file, can be used to draw text on the screen.

Members

Methods

vec2i getDimension( string& text ) const

Calculate the amount of space needed to draw a string with this font. Returns vec2i : Amount of space needed.

vec2i getDimension( int c, int lastC ) const

Calculate the amount of space needed to draw a character with kerning. Returns vec2i : Amount of space needed.

uint getBaseline( ) const

Returns uint : Baseline height for this font.

uint getLineHeight( ) const

Returns uint : Line height for this font.

void draw( vec2i& pos, string& text ) const

Draw text on screen with this font.

void draw( vec2i& pos, string& text, Color& color ) const

Draw text on screen with this font.

vec2i draw( vec2i& pos, int c, int lastC, Color& color ) const

Draw a character on screen using kerning with the previous character. Returns vec2i : The size of the area the character was drawn in.

void draw( recti& pos, string& text, string& ellipsis = locale::ELLIPSIS, Color& color = colors::White, double horizAlign = 0, double vertAlign = 0.5 ) const

Draw text on screen with this font, appending an ellipsis if the text is too long.

void draw( recti& pos, string& text, Color& stroke, string& ellipsis = locale::ELLIPSIS, Color& color = colors::White, double horizAlign = 0, double vertAlign = 0.5, int strokeWidth = 1 ) const

Draw text on screen with this font, appending an ellipsis if the text is too long.

vec2i draw( recti& pos, vec2i& offset, int lineHeight, string& text, Color& color, bool preserveLineHeight = false ) const

Draw text on screen with this font, word wrapping within the area. Returns vec2i : Dimensions of the text that was drawn.

vec2i getEndPosition( recti& pos, vec2i& offset, int lineHeight, string& text, bool preserveLineHeight = false ) const

Get the position the cursor would end up at after drawing this text with word wrap. Returns vec2i : Dimension of the text that would be drawn.