mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-04 08:36:17 +00:00 
			
		
		
		
	Merge 2388d06726 into fd97d8179e
				
					
				
			This commit is contained in:
		
						commit
						9ef53bbd88
					
				| 
						 | 
				
			
			@ -21,9 +21,17 @@ measure_text :: proc "c" (text: clay.StringSlice, config: ^clay.TextElementConfi
 | 
			
		|||
 | 
			
		||||
    font := raylib_fonts[config.fontId].font
 | 
			
		||||
 | 
			
		||||
    for i in 0 ..< text.length {
 | 
			
		||||
        glyph_index := text.chars[i] - 32
 | 
			
		||||
    byte_index := 0
 | 
			
		||||
    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]
 | 
			
		||||
 | 
			
		||||
        if glyph.advanceX != 0 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue