SimpleTextDrawer: Fix Faux-Bold

This commit is contained in:
Lynix 2017-08-13 21:40:41 +02:00
parent e512302305
commit 84e5ea0023
1 changed files with 5 additions and 4 deletions

View File

@ -318,6 +318,10 @@ namespace Nz
glyph.color = m_color; glyph.color = m_color;
glyph.flipped = fontGlyph.flipped; glyph.flipped = fontGlyph.flipped;
glyph.bounds.Set(fontGlyph.aabb);
glyph.bounds.x += m_drawPos.x;
glyph.bounds.y += m_drawPos.y;
if (fontGlyph.requireFauxBold) if (fontGlyph.requireFauxBold)
{ {
// Let's simulate bold by enlarging the glyph (not a neat idea, but should work) // 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 // Replace it at the correct height
Vector2f offset(glyph.bounds.GetCenter() - center); Vector2f offset(glyph.bounds.GetCenter() - center);
glyph.bounds.x -= offset.x;
glyph.bounds.y -= offset.y; glyph.bounds.y -= offset.y;
// Adjust advance (+10%) // Adjust advance (+10%)
advance += 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 // We "lean" the glyph to simulate italics style
float italic = (fontGlyph.requireFauxItalic) ? 0.208f : 0.f; float italic = (fontGlyph.requireFauxItalic) ? 0.208f : 0.f;
float italicTop = italic * glyph.bounds.y; float italicTop = italic * glyph.bounds.y;