From 993eea20151d881735c667757e3b64e4f85ac687 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 27 Nov 2021 23:02:35 +0100 Subject: Add max glyph height property --- include/mgl/graphics/font.h | 1 + src/graphics/font.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/mgl/graphics/font.h b/include/mgl/graphics/font.h index 69ac462..f128fec 100644 --- a/include/mgl/graphics/font.h +++ b/include/mgl/graphics/font.h @@ -34,6 +34,7 @@ struct mgl_font { int ascent; int descent; int linegap; + int max_glyph_height; mgl_font_char_map char_map; int current_line_max_height; void *font_info; diff --git a/src/graphics/font.c b/src/graphics/font.c index cad5790..603b1d4 100644 --- a/src/graphics/font.c +++ b/src/graphics/font.c @@ -59,6 +59,7 @@ int mgl_font_load_from_file(mgl_font *self, const mgl_memory_mapped_file *mapped self->ascent = round_float(font_scale * ascent); self->descent = round_float(font_scale * descent); self->linegap = round_float(font_scale * linegap); + self->max_glyph_height = self->character_size - self->descent; /* TODO: Use stbtt_GetCodepointSDF */ return 0; @@ -72,6 +73,7 @@ void mgl_font_unload(mgl_font *self) { self->ascent = 0; self->descent = 0; self->linegap = 0; + self->max_glyph_height = 0; free(self->font_info); self->font_info = NULL; -- cgit v1.2.3-70-g09d2