aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mgl/graphics/font.h1
-rw-r--r--src/graphics/font.c2
2 files changed, 3 insertions, 0 deletions
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;