v / vlib / fontstash / fontstash_funcs.c.v
53 lines · 40 sloc · 1.94 KB · a87a4d73b9ab25cfff0822f4e94cf2a2d9e64323
Raw
1module fontstash
2
3// Constructor and destructor.
4fn C.fonsCreateInternal(params &C.FONSparams) &C.FONScontext
5fn C.fonsDeleteInternal(s &C.FONScontext)
6
7fn C.fonsSetErrorCallback(s &C.FONScontext, callback fn (voidptr, int, int), uptr voidptr)
8
9// Returns current atlas size.
10fn C.fonsGetAtlasSize(s &C.FONScontext, width &int, height &int)
11
12// Expands the atlas size.
13fn C.fonsExpandAtlas(s &C.FONScontext, width i32, height i32) i32
14
15// Resets the whole stash.
16fn C.fonsResetAtlas(s &C.FONScontext, width i32, height i32) i32
17
18// Add fonts
19fn C.fonsGetFontByName(s &C.FONScontext, name &char) i32
20fn C.fonsAddFallbackFont(s &C.FONScontext, base i32, fallback i32) i32
21fn C.fonsAddFontMem(s &C.FONScontext, name &char, data &u8, dataSize i32, freeData i32) i32
22
23// State handling
24fn C.fonsPushState(s &C.FONScontext)
25fn C.fonsPopState(s &C.FONScontext)
26fn C.fonsClearState(s &C.FONScontext)
27
28// State setting
29fn C.fonsSetSize(s &C.FONScontext, size f32)
30fn C.fonsSetColor(s &C.FONScontext, color u32)
31fn C.fonsSetSpacing(s &C.FONScontext, spacing f32)
32fn C.fonsSetBlur(s &C.FONScontext, blur f32)
33fn C.fonsSetAlign(s &C.FONScontext, align i32)
34fn C.fonsSetFont(s &C.FONScontext, font i32)
35
36// Draw text
37fn C.fonsDrawText(s &C.FONScontext, x f32, y f32, str &char, end &char) f32
38
39// Measure text
40fn C.fonsTextBounds(s &C.FONScontext, x f32, y f32, str &char, end &char, bounds &f32) f32
41fn C.fonsLineBounds(s &C.FONScontext, y f32, miny &f32, maxy &f32)
42fn C.fonsVertMetrics(s &C.FONScontext, ascender &f32, descender &f32, lineh &f32)
43
44// Text iterator
45fn C.fonsTextIterInit(s &C.FONScontext, iter &C.FONStextIter, x f32, y f32, str &char, end &char) i32
46fn C.fonsTextIterNext(s &C.FONScontext, iter &C.FONStextIter, quad &C.FONSquad) i32
47
48// Pull texture changes
49fn C.fonsGetTextureData(s &C.FONScontext, width &int, height &int) &char
50fn C.fonsValidateTexture(s &C.FONScontext, dirty &int) i32
51
52// Draws the stash texture for debugging
53fn C.fonsDrawDebug(s &C.FONScontext, x f32, y f32)
54