Commit 4cfa26eafee1f8294acdc1a19f4556b6a3bf6b94

Thomas de Grivel 2024-01-28T20:40:15

flip glyphs vertically

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/libc3/window/sdl2/gl_text.c b/libc3/window/sdl2/gl_text.c
index 0e31752..7b1dd2a 100644
--- a/libc3/window/sdl2/gl_text.c
+++ b/libc3/window/sdl2/gl_text.c
@@ -132,7 +132,8 @@ bool gl_text_render_to_texture (s_gl_text *text)
       while (j < glyph->bitmap.width) {
         data_x = x + j;
         data_pixel = data + (data_y * data_w + data_x) * 4;
-        u8 value = glyph->bitmap.buffer[i * glyph->bitmap.width + j];
+        u8 value = glyph->bitmap.buffer[(glyph->bitmap.rows - 1 - i) *
+                                        glyph->bitmap.width + j];
         data_pixel[0] = 255;
         data_pixel[1] = 255;
         data_pixel[2] = 255;