From 956c86fe4728e6e5239202f1402fd65260ece7c8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 30 Mar 2022 16:10:56 +0200 Subject: Proper y offset for text, add option to create hidden window and add function to make it visible (map, unmap) --- src/graphics/font.c | 2 +- src/graphics/text.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/graphics') diff --git a/src/graphics/font.c b/src/graphics/font.c index 8c55044..9a99f22 100644 --- a/src/graphics/font.c +++ b/src/graphics/font.c @@ -227,7 +227,7 @@ int mgl_font_get_glyph(mgl_font *self, uint32_t codepoint, mgl_font_glyph *glyph render_offset.y = self->font_atlas.pointer_position.y; mgl_font_glyph new_glyph; - new_glyph.position = (mgl_vec2i){ xoff/GLYPH_UPSAMPLE, yoff/GLYPH_UPSAMPLE }; + new_glyph.position = (mgl_vec2i){ xoff/GLYPH_UPSAMPLE, self->ascent + yoff/GLYPH_UPSAMPLE }; new_glyph.size = (mgl_vec2i){ width/GLYPH_UPSAMPLE, height/GLYPH_UPSAMPLE }; new_glyph.texture_position = (mgl_vec2i){ render_offset.x, render_offset.y }; new_glyph.texture_size = (mgl_vec2i){ width, height }; diff --git a/src/graphics/text.c b/src/graphics/text.c index 61c2919..92c578c 100644 --- a/src/graphics/text.c +++ b/src/graphics/text.c @@ -217,7 +217,7 @@ void mgl_text_draw(mgl_context *context, mgl_text *text) { mgl_text_get_bounds(text); TextDrawUserdata text_draw_userdata; - text_draw_userdata.position = (mgl_vec2f){ text->position.x, text->position.y + text->font->character_size }; + text_draw_userdata.position = (mgl_vec2f){ text->position.x, text->position.y }; text_draw_userdata.text = text; text_draw_userdata.context = context; text_draw_userdata.prev_codepoint = 0; -- cgit v1.2.3