diff --git a/Libraries/LibGfx/Font.cpp b/Libraries/LibGfx/Font.cpp index b0e21f47e9..2002d16a38 100644 --- a/Libraries/LibGfx/Font.cpp +++ b/Libraries/LibGfx/Font.cpp @@ -137,6 +137,9 @@ Font::Font(const StringView& name, unsigned* rows, u8* widths, bool is_fixed_wid , m_glyph_spacing(glyph_spacing) , m_fixed_width(is_fixed_width) { + // FIXME: This is just a dumb guess. It would be cool to know the actual x-height of the font! + m_x_height = glyph_height / 2; + m_glyph_count = glyph_count_by_type(m_type); if (!m_fixed_width) { diff --git a/Libraries/LibGfx/Font.h b/Libraries/LibGfx/Font.h index 001b55bfb8..475f3a13e6 100644 --- a/Libraries/LibGfx/Font.h +++ b/Libraries/LibGfx/Font.h @@ -94,6 +94,8 @@ public: u8 glyph_width(size_t ch) const { return m_fixed_width ? m_glyph_width : m_glyph_widths[ch]; } int glyph_or_emoji_width(u32 code_point) const; u8 glyph_height() const { return m_glyph_height; } + int x_height() const { return m_x_height; } + u8 min_glyph_width() const { return m_min_glyph_width; } u8 max_glyph_width() const { return m_max_glyph_width; } u8 glyph_fixed_width() const { return m_glyph_width; } @@ -121,6 +123,7 @@ public: FontTypes type() { return m_type; } void set_type(FontTypes type); + private: Font(const StringView& name, unsigned* rows, u8* widths, bool is_fixed_width, u8 glyph_width, u8 glyph_height, u8 glyph_spacing, FontTypes type); @@ -137,6 +140,7 @@ private: u8 m_glyph_width { 0 }; u8 m_glyph_height { 0 }; + u8 m_x_height { 0 }; u8 m_min_glyph_width { 0 }; u8 m_max_glyph_width { 0 }; u8 m_glyph_spacing { 0 };