From da73f628459d75329f3012b3270d3fbd567896fb Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 23 Jun 2014 14:26:48 -0400 Subject: [PATCH] compute Font advance from that of "x" glyph --- src/gui/Font.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/Font.cc b/src/gui/Font.cc index a95da8d..9664c12 100644 --- a/src/gui/Font.cc +++ b/src/gui/Font.cc @@ -31,6 +31,14 @@ namespace jes m_line_height = round_up_26_6(m_face->size->metrics.height); + GlyphRef x_glyph = load_glyph('x'); + if (x_glyph.is_null()) + { + std::cerr << "Could not load 'x' glyph from font" << fname << std::endl; + return false; + } + m_advance = x_glyph->get_advance(); + m_loaded = true; return true; }