summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/text.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/text.cc b/src/text.cc
index b76bab2..51ddc9b 100644
--- a/src/text.cc
+++ b/src/text.cc
@@ -198,16 +198,20 @@ enum font_error_e wayc_font_raster(struct font_s* font, codepoint_t codepoint,
FT_GlyphSlot slot = font->face->glyph;
FT_Bitmap bitmap = slot->bitmap;
- // Pack glyph bitmap into atlas texture and get UV coordinates
- vec2 uv0, uv1;
- enum atlas_error_e aterr = wayc_atlas_insert(
- &font->atlas, bitmap.width, bitmap.rows, bitmap.buffer, &uv0, &uv1);
- if (aterr) return FONT_ERROR_ATLAS_FAILED;
-
vec2 bearing = {(f32)slot->bitmap_left, (f32)slot->bitmap_top};
vec2 size = {(f32)bitmap.width, (f32)bitmap.rows};
f32 advance = (f32)slot->advance.x / WAYC_SCALE;
+ // Pack glyph bitmap into atlas texture and get UV coordinates
+ vec2 uv0 = {0.0f, 0.0f};
+ vec2 uv1 = {0.0f, 0.0f};
+
+ if (bitmap.buffer != nullptr) {
+ enum atlas_error_e aterr = wayc_atlas_insert(
+ &font->atlas, bitmap.width, bitmap.rows, bitmap.buffer, &uv0, &uv1);
+ if (aterr) return FONT_ERROR_ATLAS_FAILED;
+ }
+
glm_vec2_copy(uv0, got.uv0);
glm_vec2_copy(uv1, got.uv1);
glm_vec2_copy(size, got.size);