Compare commits

...

6 commits

Author SHA1 Message Date
Matt Breckon faa388b3e0
Merge 2388d06726 into 0d6969c8c3 2025-09-08 12:24:06 +10:00
Matt Breckon 2388d06726 Definitely the last formatting fix :-( 2025-08-24 12:19:13 +01:00
Matt Breckon b284305e12 Another attempt at a formatting fix 2025-08-24 12:17:47 +01:00
Matt Breckon 80e28e7088 Last formatting fix 2025-08-24 12:16:30 +01:00
Matt Breckon 55453f8e45 Fix typos and remove code that came from another example renderer 2025-08-24 12:11:29 +01:00
Matt Breckon a6cf58c74c Add utf-8 codepoint support to example odin raylib renderer 2025-08-24 09:33:36 +01:00

View file

@ -21,9 +21,17 @@ measure_text :: proc "c" (text: clay.StringSlice, config: ^clay.TextElementConfi
font := raylib_fonts[config.fontId].font font := raylib_fonts[config.fontId].font
for i in 0 ..< text.length { byte_index := 0
glyph_index := text.chars[i] - 32 for byte_index < int(text.length) {
// handle utf-8 codepoints
codepoint_bytes: i32 = 0
codepoint := rl.GetCodepoint(
transmute(cstring)&text.chars[byte_index],
&codepoint_bytes,
)
byte_index += int(codepoint_bytes)
glyph_index := rl.GetGlyphIndex(font, codepoint)
glyph := font.glyphs[glyph_index] glyph := font.glyphs[glyph_index]
if glyph.advanceX != 0 { if glyph.advanceX != 0 {