From b0553fdbd201bed5451c85ec24a280e79da0acde Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 31 Jul 2016 23:11:26 -0400 Subject: [PATCH] adjust font vertical position by baseline offset --- src/gui/Font.h | 1 + src/gui/Window.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/Font.h b/src/gui/Font.h index 62c101e..2590246 100644 --- a/src/gui/Font.h +++ b/src/gui/Font.h @@ -12,6 +12,7 @@ public: std::shared_ptr get_glyph(FT_ULong character); int get_advance() { return m_advance; } int get_line_height() { return m_line_height; } + int get_baseline_offset() { return m_baseline_offset; } protected: bool preload_glyphs(); diff --git a/src/gui/Window.cc b/src/gui/Window.cc index 9ed7225..4cceedc 100644 --- a/src/gui/Window.cc +++ b/src/gui/Window.cc @@ -298,7 +298,7 @@ void Window::redraw() { uint8_t c = piece->start[i]; auto g = m_font.get_glyph(c); - m_shaders.text->set_position(x, y); + m_shaders.text->set_position(x, y + m_font.get_baseline_offset()); g->render(); if ((i + 1) % m_columns == 0) {