fixed batcher text bottom/middle vertical align

This commit is contained in:
Noel Berry 2020-09-01 12:41:42 -07:00 committed by GitHub
parent e1d2e3066e
commit a0ca01a5a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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++)
{