summaryrefslogtreecommitdiff
path: root/src/text.cc
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-02-11 22:16:20 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-02-11 22:16:20 +0100
commit673211e7d3d4f1921a3323bdc2818caf4e73a696 (patch)
tree2d8fea741d1577e54c76c8392df3bce7c7d0eacb /src/text.cc
parentf1e9a3fa502843f0f3092e4bbb016c14eec43fcc (diff)
improving glyphs
Diffstat (limited to 'src/text.cc')
-rw-r--r--src/text.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/text.cc b/src/text.cc
index ff9b833..2bfc7a3 100644
--- a/src/text.cc
+++ b/src/text.cc
@@ -97,12 +97,18 @@ enum font_error_e wayc_font_lookup(struct font_s* font, struct atlas_s* atlas,
FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
FT_Bitmap bitmap = slot->bitmap;
+ if (bitmap.pitch != (i32)bitmap.width) wayc_panic("unsupported pitch");
+
ivec2 size = {(i32)bitmap.width, (i32)bitmap.rows};
wayc_atlas_set(atlas, IMAGE_DATA_TYPE_UNSIGNED_BYTE, font->cursor, size[0],
size[1], IMAGE_FORMAT_RED_ALIGNMENT, bitmap.buffer);
struct glyph_s glyph = {};
+ glyph.bearing_x = slot->bitmap_left;
+ glyph.bearing_y = slot->bitmap_top;
+ glyph.advance = (f32)slot->advance.x / WAYC_SCALE;
+
glm_ivec2(font->cursor, glyph.uv0);
glm_ivec2_add(glyph.uv0, size, glyph.uv1);