aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-27 23:02:35 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-27 23:02:35 +0100
commit993eea20151d881735c667757e3b64e4f85ac687 (patch)
tree5c3eaa326425045f99de73fe21d524ed6f743593
parent08fe64b91e7e43db54628f922f07864a8d8e5402 (diff)
Add max glyph height property
-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;