Skip to content

Commit

Permalink
Tighten up MeasureDrawBounds Y extents
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jun 7, 2016
1 parent a6d3dcc commit 8529936
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Src/SpriteFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,10 @@ RECT SpriteFont::MeasureDrawBounds(_In_z_ wchar_t const* text, XMFLOAT2 const& p
pImpl->ForEachGlyph(text, [&](Glyph const* glyph, float x, float y, float advance)
{
float w = (float)(glyph->Subrect.right - glyph->Subrect.left);
float h = (float)(glyph->Subrect.bottom - glyph->Subrect.top) + glyph->YOffset;

h = std::max(h, pImpl->lineSpacing);
float h = (float)(glyph->Subrect.bottom - glyph->Subrect.top);

float minX = (position.x + x);
float minY = (position.y + y);
float minX = position.x + x;
float minY = position.y + y + glyph->YOffset;

float maxX = std::max(minX + advance, minX + w);
float maxY = minY + h;
Expand Down

0 comments on commit 8529936

Please sign in to comment.