fontstash #

Constants #

const (
	used_import = 1
)

#flag -lfreetype

fn create_internal #

fn create_internal(params &C.FONSparams) &C.FONScontext

Contructor and destructor.

fn delete_internal #

fn delete_internal(s &C.FONScontext)

enum FonsAlign #

enum FonsAlign {
	left = 1
	center = 2
	right = 4
	top = 8
	middle = 16
	bottom = 32
	baseline = 64
}

enum FonsErrorCode #

enum FonsErrorCode {
	atlas_full = 1
	scratch_full = 2
	states_overflow = 3
	states_underflow = 4
}

enum FonsFlags #

enum FonsFlags {
	top_left = 1
	bottom_left = 2
}

struct C.FONScontext #

struct C.FONScontext {}

fn (C.FONScontext) add_fallback_font #

fn (s &C.FONScontext) add_fallback_font(base int, fallback int) int

fn (C.FONScontext) add_font_mem #

fn (s &C.FONScontext) add_font_mem(name &char, data &byte, data_size int, free_data int) int

fn (C.FONScontext) clear_state #

fn (s &C.FONScontext) clear_state()

fn (C.FONScontext) draw_debug #

fn (s &C.FONScontext) draw_debug(x f32, y f32)

Draws the stash texture for debugging

fn (C.FONScontext) draw_text #

fn (s &C.FONScontext) draw_text(x f32, y f32, str &char, end &char) f32

Draw text

fn (C.FONScontext) expand_atlas #

fn (s &C.FONScontext) expand_atlas(width int, height int) int

Expands the atlas size.

fn (C.FONScontext) get_atlas_size #

fn (s &C.FONScontext) get_atlas_size(width &int, height &int)

Returns current atlas size.

fn (C.FONScontext) get_font_by_name #

fn (s &C.FONScontext) get_font_by_name(name &char) int

Add fonts

fn (C.FONScontext) get_texture_data #

fn (s &C.FONScontext) get_texture_data(width &int, height &int) &byte

Pull texture changes

fn (C.FONScontext) line_bounds #

fn (s &C.FONScontext) line_bounds(y f32, miny &f32, maxy &f32)

fn (C.FONScontext) pop_state #

fn (s &C.FONScontext) pop_state()

fn (C.FONScontext) push_state #

fn (s &C.FONScontext) push_state()

State handling

fn (C.FONScontext) reset_atlas #

fn (s &C.FONScontext) reset_atlas(width int, height int) int

Resets the whole stash.

fn (C.FONScontext) set_align #

fn (s &C.FONScontext) set_align(align int)

fn (C.FONScontext) set_blur #

fn (s &C.FONScontext) set_blur(blur f32)

fn (C.FONScontext) set_color #

fn (s &C.FONScontext) set_color(color u32)

fn (C.FONScontext) set_error_callback #

fn (s &C.FONScontext) set_error_callback(callback fn (voidptr, int, int), uptr voidptr)

fn (C.FONScontext) set_font #

fn (s &C.FONScontext) set_font(font int)

fn (C.FONScontext) set_size #

fn (s &C.FONScontext) set_size(size f32)

State setting

fn (C.FONScontext) set_spacing #

fn (s &C.FONScontext) set_spacing(spacing f32)

fn (C.FONScontext) text_bounds #

fn (s &C.FONScontext) text_bounds(x f32, y f32, str &char, end &char, bounds &f32) f32

Measure text

fn (C.FONScontext) text_iter_init #

fn (s &C.FONScontext) text_iter_init(iter &C.FONStextIter, x f32, y f32, str &char, end &char) int

Text iterator

fn (C.FONScontext) text_iter_next #

fn (s &C.FONScontext) text_iter_next(iter &C.FONStextIter, quad &C.FONSquad) int

fn (C.FONScontext) validate_texture #

fn (s &C.FONScontext) validate_texture(dirty &int) int

fn (C.FONScontext) vert_metrics #

fn (s &C.FONScontext) vert_metrics(ascender &f32, descender &f32, lineh &f32)

struct C.FONSfont #

struct C.FONSfont {}

struct C.FONSparams #

struct C.FONSparams {
	width   int
	height  int
	flags   char
	userPtr voidptr

	renderCreate fn (uptr voidptr, width int, height int) int

	renderResize fn (uptr voidptr, width int, height int) int

	renderUpdate fn (uptr voidptr, rect &int, data &byte)

	renderDraw fn (uptr voidptr, verts &f32, tcoords &f32, colors &u32, nverts int)

	renderDelete fn (uptr voidptr)
}

struct C.FONSquad #

struct C.FONSquad {
	x0 f32
	y0 f32
	s0 f32
	t0 f32
	x1 f32
	y1 f32
	s1 f32
	t1 f32
}

struct C.FONStextIter #

struct C.FONStextIter {
	x              f32
	y              f32
	nextx          f32
	nexty          f32
	scale          f32
	spacing        f32
	codepoint      u32
	isize          i16
	iblur          i16
	font           &C.FONSfont
	prevGlyphIndex int
	str            &byte
	next           &byte
	end            &byte
	utf8state      u32
}