FixImage Documentation
Back to summary
import "image/font";
Font class
TrueType font.
Initialization
static function load(data: Byte[]): Font
-
Loads the font from given byte buffer. The byte buffer is accessed later for
obtaining the individual glyphs.
Properties
function get_ascent(): Float
-
Returns the ascent of the font in normalized coordinates (must multiply with actual font size).
function get_descent(): Float
-
Returns the descent of the font in normalized coordinates (must multiply with actual font size).
function get_height(): Float
-
Returns the height of the font in normalized coordinates (must multiply with actual font size).
Text shapes
function get_char_shape(char: Integer, off_x: Float, off_y: Float, size_x: Float, size_y: Float): Shape
-
Returns a new shape for given character, scaled and offseted.
function get_string_shape(s: String, off_x: Float, off_y: Float, size_x: Float, size_y: Float): Shape
-
Returns a new shape for given string, scaled and offseted.
function append_char_shape(shape: Shape, char: Integer, off_x: Float, off_y: Float, size_x: Float, size_y: Float)
-
Appends the shape of a given character to provided shape, scaled and offseted.
function append_string_shape(shape: Shape, s: String, off_x: Float, off_y: Float, size_x: Float, size_y: Float)
-
Appends the shape of a given string to provided shape, scaled and offseted.
Positioning
function get_char_advance(char: Integer): Float
-
Returns the character horizontal advance in normalized coordinates (must multiply with actual font size).
function get_string_advance(s: String): Float
-
Returns the string horizontal advance in normalized coordinates (must multiply with actual font size).
function get_string_position(s: String, x: Float): Float
-
Returns the fractional position inside the string based on normalized coordinate (the coordinate must
be divided by actual font size).