From f5c4671bfbad96bf346bd7e9a21fc4317b4959df Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Sat, 3 Dec 2022 17:00:20 +0530 Subject: Adds most of the tools --- v_windows/v/vlib/fontstash/fontstash_funcs.c.v | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 v_windows/v/vlib/fontstash/fontstash_funcs.c.v (limited to 'v_windows/v/vlib/fontstash/fontstash_funcs.c.v') diff --git a/v_windows/v/vlib/fontstash/fontstash_funcs.c.v b/v_windows/v/vlib/fontstash/fontstash_funcs.c.v new file mode 100644 index 0000000..8e260e7 --- /dev/null +++ b/v_windows/v/vlib/fontstash/fontstash_funcs.c.v @@ -0,0 +1,53 @@ +module fontstash + +// Contructor and destructor. +fn C.fonsCreateInternal(params &C.FONSparams) &C.FONScontext +fn C.fonsDeleteInternal(s &C.FONScontext) + +fn C.fonsSetErrorCallback(s &C.FONScontext, callback fn (voidptr, int, int), uptr voidptr) + +// Returns current atlas size. +fn C.fonsGetAtlasSize(s &C.FONScontext, width &int, height &int) + +// Expands the atlas size. +fn C.fonsExpandAtlas(s &C.FONScontext, width int, height int) int + +// Resets the whole stash. +fn C.fonsResetAtlas(s &C.FONScontext, width int, height int) int + +// Add fonts +fn C.fonsGetFontByName(s &C.FONScontext, name &char) int +fn C.fonsAddFallbackFont(s &C.FONScontext, base int, fallback int) int +fn C.fonsAddFontMem(s &C.FONScontext, name &char, data &byte, dataSize int, freeData int) int + +// State handling +fn C.fonsPushState(s &C.FONScontext) +fn C.fonsPopState(s &C.FONScontext) +fn C.fonsClearState(s &C.FONScontext) + +// State setting +fn C.fonsSetSize(s &C.FONScontext, size f32) +fn C.fonsSetColor(s &C.FONScontext, color u32) +fn C.fonsSetSpacing(s &C.FONScontext, spacing f32) +fn C.fonsSetBlur(s &C.FONScontext, blur f32) +fn C.fonsSetAlign(s &C.FONScontext, align int) +fn C.fonsSetFont(s &C.FONScontext, font int) + +// Draw text +fn C.fonsDrawText(s &C.FONScontext, x f32, y f32, str &char, end &char) f32 + +// Measure text +fn C.fonsTextBounds(s &C.FONScontext, x f32, y f32, str &char, end &char, bounds &f32) f32 +fn C.fonsLineBounds(s &C.FONScontext, y f32, miny &f32, maxy &f32) +fn C.fonsVertMetrics(s &C.FONScontext, ascender &f32, descender &f32, lineh &f32) + +// Text iterator +fn C.fonsTextIterInit(s &C.FONScontext, iter &C.FONStextIter, x f32, y f32, str &char, end &char) int +fn C.fonsTextIterNext(s &C.FONScontext, iter &C.FONStextIter, quad &C.FONSquad) int + +// Pull texture changes +fn C.fonsGetTextureData(s &C.FONScontext, width &int, height &int) &char +fn C.fonsValidateTexture(s &C.FONScontext, dirty &int) int + +// Draws the stash texture for debugging +fn C.fonsDrawDebug(s &C.FONScontext, x f32, y f32) -- cgit v1.2.3