From a0ca01a5a14399d75bea5d683acf8775f08dbb9d Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Tue, 1 Sep 2020 12:41:42 -0700 Subject: [PATCH] fixed batcher text bottom/middle vertical align --- public/blah/drawing/batch.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/blah/drawing/batch.cpp b/public/blah/drawing/batch.cpp index 1401d1c..e4d762e 100644 --- a/public/blah/drawing/batch.cpp +++ b/public/blah/drawing/batch.cpp @@ -784,9 +784,9 @@ void Batch::str(const SpriteFont& font, const String& text, const Vec2& pos, Tex if ((align & TextAlign::Top) == TextAlign::Top) offset.y = font.ascent() + font.descent(); else if ((align & TextAlign::Bottom) == TextAlign::Bottom) - offset.y = font.ascent() + font.descent() - font.height_of(text); + offset.y = font.height() - font.height_of(text); else - offset.y = font.ascent() + font.descent() - font.height_of(text) * 0.5f; + offset.y = (font.ascent() + font.descent() + font.height() - font.height_of(text)) * 0.5f; for (int i = 0, l = text.length(); i < l; i++) { @@ -829,4 +829,4 @@ void Batch::str(const SpriteFont& font, const String& text, const Vec2& pos, Tex } pop_matrix(); -} \ No newline at end of file +}