From 7f761f9a2a14f88bff50365ad13793ddaee5290c Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 17 Mar 2017 20:08:36 -0400 Subject: [PATCH] fixed the font loading bug --- 4ed_system_shared.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/4ed_system_shared.cpp b/4ed_system_shared.cpp index 3d35642b..218d1038 100644 --- a/4ed_system_shared.cpp +++ b/4ed_system_shared.cpp @@ -680,6 +680,11 @@ font_load_page(System_Functions *system, Partition *part, Render_Font *font, Gly FT_Face face; FT_New_Face(ft, filename, 0, &face); + FT_Size_RequestRec_ size = {}; + size.type = FT_SIZE_REQUEST_TYPE_NOMINAL; + size.height = pt_size << 6; + FT_Request_Size(face, &size); + // NOTE(allen): set texture and glyph data. font_load_page_inner(part, font, ft, face, use_hinting, page, page_number, 4); @@ -700,12 +705,12 @@ font_load(System_Functions *system, Partition *part, Render_Font *font, i32 pt_s FT_Face face; FT_New_Face(ft, filename, 0, &face); - // set size & metrics FT_Size_RequestRec_ size = {}; size.type = FT_SIZE_REQUEST_TYPE_NOMINAL; size.height = pt_size << 6; FT_Request_Size(face, &size); + // set size & metrics font->ascent = ceil32 (face->size->metrics.ascender / 64.0f); font->descent = floor32 (face->size->metrics.descender / 64.0f); font->advance = ceil32 (face->size->metrics.max_advance / 64.0f);