From 84e5ea00238804c8b9f5e2e613f3e6c0bcaf96e4 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 13 Aug 2017 21:40:41 +0200 Subject: [PATCH] SimpleTextDrawer: Fix Faux-Bold --- src/Nazara/Utility/SimpleTextDrawer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Nazara/Utility/SimpleTextDrawer.cpp b/src/Nazara/Utility/SimpleTextDrawer.cpp index 2b42ecbe8..739af792e 100644 --- a/src/Nazara/Utility/SimpleTextDrawer.cpp +++ b/src/Nazara/Utility/SimpleTextDrawer.cpp @@ -318,6 +318,10 @@ namespace Nz glyph.color = m_color; glyph.flipped = fontGlyph.flipped; + glyph.bounds.Set(fontGlyph.aabb); + glyph.bounds.x += m_drawPos.x; + glyph.bounds.y += m_drawPos.y; + if (fontGlyph.requireFauxBold) { // Let's simulate bold by enlarging the glyph (not a neat idea, but should work) @@ -329,16 +333,13 @@ namespace Nz // Replace it at the correct height Vector2f offset(glyph.bounds.GetCenter() - center); + glyph.bounds.x -= offset.x; glyph.bounds.y -= offset.y; // Adjust advance (+10%) advance += advance / 10; } - glyph.bounds.Set(fontGlyph.aabb); - glyph.bounds.x += m_drawPos.x; - glyph.bounds.y += m_drawPos.y; - // We "lean" the glyph to simulate italics style float italic = (fontGlyph.requireFauxItalic) ? 0.208f : 0.f; float italicTop = italic * glyph.bounds.y;