package vendor:fontstash
⌘K
Ctrl+K
or
/
Index
Variables (0)
This section is empty.
Procedures (31)
- AddFallbackFont
- AddFontMem
- AddFontPath
- BeginState
- ClearState
- CodepointWidth
- Destroy
- EndState
- ExpandAtlas
- GetFontByName
- Init
- LineBounds
- PopState
- PushState
- Reset
- ResetAtlas
- ResetFallbackFont
- SetAH
- SetAV
- SetAlignHorizontal
- SetAlignVertical
- SetBlur
- SetColor
- SetFont
- SetSize
- SetSpacing
- TextBounds
- TextIterInit
- TextIterNext
- ValidateTexture
- VerticalMetrics
Procedure Groups (1)
Types
AlignHorizontal ¶
AlignHorizontal :: enum int { LEFT, CENTER, RIGHT, }
Related Procedures With Parameters
AlignVertical ¶
AlignVertical :: enum int { TOP, MIDDLE, BOTTOM, BASELINE, }
Related Procedures With Parameters
Font ¶
Font :: struct { name: string, // allocated info: stb_truetype.fontinfo, loadedData: []u8, freeLoadedData: bool, // in case you dont want loadedData to be removed ascender: f32, descender: f32, lineHeight: f32, glyphs: [dynamic]Glyph, lut: [256]int, fallbacks: [20]int, nfallbacks: int, }
Related Procedures With Parameters
FontContext ¶
FontContext :: struct { fonts: [dynamic]Font, // always assuming user wants to resize nodes: [dynamic]AtlasNode, // actual pixels textureData: []u8, // allocated using context.allocator width: int, height: int, // 1 / texture_atlas_width, 1 / texture_atlas_height itw: f32, ith: f32, // state states: []State, state_count: int, // used states location: QuadLocation, // dirty rectangle of the texture region that was updated dirtyRect: [4]f32, // callbacks with userData passed userData: rawptr, // called when a texture is expanded and needs handling callbackResize: proc(data: rawptr, w, h: int), // called in state_end to update the texture region that changed callbackUpdate: proc(data: rawptr, dirtyRect: [4]f32, textureData: rawptr), }
Related Procedures With Parameters
- AddFallbackFont
- AddFontMem
- AddFontPath
- BeginState
- ClearState
- Destroy
- EndState
- ExpandAtlas
- GetFontByName
- Init
- LineBounds
- PopState
- PushState
- Reset
- ResetAtlas
- ResetFallbackFont
- SetAlignHorizontal
- SetAlignVertical
- SetBlur
- SetColor
- SetFont
- SetSize
- SetSpacing
- TextBounds
- TextIterInit
- TextIterNext
- ValidateTexture
- VerticalMetrics
- AddFont (procedure groups)
State ¶
State :: struct { font: int, size: f32, color: [4]u8, spacing: f32, blur: f32, ah: AlignHorizontal, av: AlignVertical, }
state used to share font options
TextIter ¶
TextIter :: struct { x: f32, y: f32, nextx: f32, nexty: f32, scale: f32, spacing: f32, isize: i16, iblur: i16, font: ^Font, previousGlyphIndex: i32, // unicode iteration utf8state: rune, // utf8 codepoint: rune, text: string, codepointCount: int, // byte indices str: int, next: int, end: int, }
text iteration with custom settings
Related Procedures With Parameters
Related Procedures With Returns
Constants
BLUR_APREC ¶
BLUR_APREC :: 16
BLUR_ZPREC ¶
BLUR_ZPREC :: 7
HASH_LUT_SIZE ¶
HASH_LUT_SIZE :: 256
INIT_ATLAS_NODES ¶
INIT_ATLAS_NODES :: 256
INIT_GLYPHS ¶
INIT_GLYPHS :: 256
MAX_FALLBACKS ¶
MAX_FALLBACKS :: 20
MAX_STATES ¶
MAX_STATES :: 20
Variables
This section is empty.
Procedures
AddFallbackFont ¶
AddFallbackFont :: proc(ctx: ^FontContext, base, fallback: int) -> bool {…}
AddFontMem ¶
AddFontMem :: proc(ctx: ^FontContext, name: string, data: []u8, freeLoadedData: bool) -> int {…}
push a font to the font stack optionally init with ascii characters at a wanted size
AddFontPath ¶
AddFontPath :: proc(ctx: ^FontContext, name: string, path: string) -> int {…}
CodepointWidth ¶
only useful for single glyphs where you quickly want the width
Destroy ¶
Destroy :: proc(ctx: ^FontContext) {…}
EndState ¶
EndState :: proc(ctx: ^FontContext) {…}
checks for texture updates after potential __getGlyph calls
ExpandAtlas ¶
ExpandAtlas :: proc(ctx: ^FontContext, width, height: int, allocator := context.allocator) -> bool {…}
Init ¶
Init :: proc(ctx: ^FontContext, w, h: int, loc: QuadLocation) {…}
LineBounds ¶
LineBounds :: proc(ctx: ^FontContext, y: f32) -> (miny, maxy: f32) {…}
get top and bottom line boundary
PushState ¶
PushState :: proc(using ctx: ^FontContext, loc := #caller_location) {…}
push a state, copies the current one over to the next one
Reset ¶
Reset :: proc(ctx: ^FontContext) {…}
ResetAtlas ¶
ResetAtlas :: proc(ctx: ^FontContext, width, height: int, allocator := context.allocator) -> bool {…}
ResetFallbackFont ¶
ResetFallbackFont :: proc(ctx: ^FontContext, base: int) {…}
SetAH ¶
SetAH :: SetAlignHorizontal
SetAV ¶
SetAV :: SetAlignVertical
SetAlignHorizontal ¶
SetAlignHorizontal :: proc(ctx: ^FontContext, ah: AlignHorizontal) {…}
SetAlignVertical ¶
SetAlignVertical :: proc(ctx: ^FontContext, av: AlignVertical) {…}
SetBlur ¶
SetBlur :: proc(ctx: ^FontContext, blur: f32) {…}
SetColor ¶
SetColor :: proc(ctx: ^FontContext, color: [4]u8) {…}
SetFont ¶
SetFont :: proc(ctx: ^FontContext, font: int) {…}
SetSize ¶
SetSize :: proc(ctx: ^FontContext, size: f32) {…}
SetSpacing ¶
SetSpacing :: proc(ctx: ^FontContext, spacing: f32) {…}
TextBounds ¶
TextBounds :: proc(ctx: ^FontContext, text: string, x: f32 = 0, y: f32 = 0, bounds: ^[4]f32 = nil) -> f32 {…}
width of a text line, optionally the full rect
TextIterInit ¶
TextIterInit :: proc(ctx: ^FontContext, x: f32, y: f32, text: string) -> (res: TextIter) {…}
init text iter struct with settings
TextIterNext ¶
TextIterNext :: proc(ctx: ^FontContext, iter: ^TextIter, quad: ^Quad) -> (ok: bool) {…}
step through each codepoint
ValidateTexture ¶
ValidateTexture :: proc(using ctx: ^FontContext, dirty: ^[4]f32) -> bool {…}
true when the dirty rectangle is valid and needs a texture update on the gpu
VerticalMetrics ¶
VerticalMetrics :: proc(ctx: ^FontContext) -> (ascender, descender, lineHeight: f32) {…}
Procedure Groups
AddFont ¶
AddFont :: proc{ AddFontPath, AddFontMem, }
Source Files
Generation Information
Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-20 21:10:47.463633500 +0000 UTC