package vendor:stb/easy_font
⌘K
Ctrl+K
or
/
Overview
An Odin-native source port of stb_easy_font.h.
Example:
quads: [999]easy_font.Quad = ---
color := rl.GREEN
c := transmute(easy_font.Color)color
num_quads := easy_font.print(10, 60, TEXT, c, quads[:])
for q in quads[:num_quads] {
tl := q.tl.v
br := q.br.v
color = transmute(rl.Color)q.tl.c
r := rl.Rectangle{x = tl.x, y = tl.y, width = br.x - tl.x, height = br.y - tl.y}
// Yes, we could just use the `color` from above, but this shows how to get it back from the vertex.
// And in practice this code will likely not live as close to the `easy_font` call.
rl.DrawRectangleRec(r, color)
}
Changelog:
2022-04-03 Bug fixes Add `print(x, y, text, color, quad_buffer)` version that takes `[]quad`. (Same internal memory layout as []u8 API, but more convenient for the caller.) Add optional `scale := f32(1.0)` param to `print` to embiggen the glyph quads. 2021-09-14 Original Odin version
Credits:
Original port: gingerBill Bugfixes: Florian Behr & Jeroen van Rijn Additions: Jeroen van Rijn
Index
Types (4)
Constants (0)
This section is empty.
Variables (0)
This section is empty.
Types
Color ¶
Color :: [4]u8
Related Procedures With Parameters
- draw_segs_quad_buffer
- draw_segs_vertex_buffer
- print_quad_buffer
- print_vertex_buffer
- draw_segs (procedure groups)
- print (procedure groups)
Constants
This section is empty.
Variables
This section is empty.
Procedures
draw_segs_quad_buffer ¶
draw_segs_quad_buffer :: proc( x, y: f32, segs: []u8, vertical: bool, c: [4]u8, buf: []Quad, start_offset: int, scale: f32 = f32(1.0), ) -> (quads: int) {…}
Same memory layout, but takes a []quad instead of []byte
Related Procedure Groups
draw_segs_vertex_buffer ¶
draw_segs_vertex_buffer :: proc( x, y: f32, segs: []u8, vertical: bool, c: [4]u8, vbuf: []u8, start_offset: int, scale: f32 = f32(1.0), ) -> (offset: int) {…}
Compatible with original C API
Related Procedure Groups
font_spacing ¶
font_spacing :: proc(spacing: f32) {…}
print_quad_buffer ¶
print_quad_buffer :: proc( x, y: f32, text: string, color: [4]u8, quad_buffer: []Quad, scale: f32 = f32(1.0), ) -> (quads: int) {…}
Same memory layout, but takes a []quad instead of []byte
Related Procedure Groups
print_vertex_buffer ¶
print_vertex_buffer :: proc( x, y: f32, text: string, color: [4]u8, vertex_buffer: []u8, scale: f32 = f32(1.0), ) -> int {…}
Compatible with original C API
Related Procedure Groups
Procedure Groups
draw_segs ¶
draw_segs :: proc{ draw_segs_quad_buffer, draw_segs_vertex_buffer, }
print ¶
print :: proc{ print_quad_buffer, print_vertex_buffer, }
Source Files
Generation Information
Generated with odin version dev-2025-10 (vendor "odin") Windows_amd64 @ 2025-10-28 21:13:10.711737700 +0000 UTC