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.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;