api

ttf.ch

Declarations in ttf.ch

1 declarationsfont

Declarations

Public only
font#
Publicnamespace
namespace font
read_u16_be#
function
func read_u16_be(data : *u8, offset : size_t) : u16
TTF/OTF font parser
read_u32_be#
function
func read_u32_be(data : *u8, offset : size_t) : u32
read_i16_be#
function
func read_i16_be(data : *u8, offset : size_t) : i16
read_i32_be#
function
func read_i32_be(data : *u8, offset : size_t) : i32
Font#
Publicstruct
struct Font { var data : vector<u8> var tables : vector<FontTable> var units_per_em : u16 var ascent : i16 var descent : i16 var num_glyphs : u16 var loaded : bool }
make#
PublicfunctionConstructor
func make() : Font
delete#
function
func delete(self : *Font) : void
FontTable#
Publicstruct
struct FontTable { var tag : u32 var offset : u32 var length : u32 }
font_load#
Publicfunction
func font_load(path : *char) : Result<Font, FontError>
parse_font_header#
function
func parse_font_header(font : *Font) : Result<Unit, FontError>
find_table#
function
func find_table(font : *Font, tag : u32) : Result<FontTable, FontError>
font_units_per_em#
Publicfunction
func font_units_per_em(font : *Font) : u16
font_ascent#
Publicfunction
func font_ascent(font : *Font) : i16
font_descent#
Publicfunction
func font_descent(font : *Font) : i16
font_num_glyphs#
Publicfunction
func font_num_glyphs(font : *Font) : u16
font_line_height#
Publicfunction
func font_line_height(font : *Font) : i32
cmap_lookup#
function
func cmap_lookup(font : *Font, codepoint : u32) : u16
---------------------------------------------------------------------------
cmap_format4_lookup#
function
func cmap_format4_lookup(font : *Font, base : size_t, codepoint : u32) : u16
font_get_glyph_metrics#
Publicfunction
func font_get_glyph_metrics(font : *Font, glyph_id : u16) : Result<GlyphMetrics, FontError>
---------------------------------------------------------------------------
font_get_glyph_outline#
Publicfunction
func font_get_glyph_outline(font : *Font, glyph_id : u16) : Result<GlyphOutline, FontError>
---------------------------------------------------------------------------
font_get_glyph#
Publicfunction
func font_get_glyph(font : *Font, codepoint : u32) : Result<u16, FontError>
TextMetrics#
Publicstruct
struct TextMetrics { var width : i32 var height : i32 var ascent : i32 var descent : i32 }
---------------------------------------------------------------------------
font_measure_text#
Publicfunction
func font_measure_text(font : *Font, text : *char, text_len : size_t, font_size : float) : TextMetrics