Skip to content

Commit

Permalink
Once more with feeling...
Browse files Browse the repository at this point in the history
  • Loading branch information
mickelson committed May 31, 2014
1 parent af0de6e commit cd60ca2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/tp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ void FeTextPrimative::fit_string(

const sf::Font *font = getFont();
unsigned int charsize = getCharacterSize();
float width = m_bgRect.getLocalBounds().width;
float x_scale = m_texts[0].getScale().x;
float width = m_bgRect.getLocalBounds().width / m_texts[0].getScale().x;

int running_total( charsize * 2 ); // measure of line's pixel width

Expand All @@ -113,7 +112,7 @@ void FeTextPrimative::fit_string(
if ( i < (int)s.size() )
{
sf::Glyph g = font->getGlyph( s[i], charsize, false );
running_total += g.bounds.width * x_scale;
running_total += g.advance;

if ( s[i] == L' ' )
{
Expand All @@ -127,7 +126,7 @@ void FeTextPrimative::fit_string(
if (!m_wrap && ( j > 0 ) && ( running_total < width ))
{
sf::Glyph g = font->getGlyph( s[j], charsize, false );
running_total += g.bounds.width * x_scale;
running_total += g.advance;
j--;
}
}
Expand Down

0 comments on commit cd60ca2

Please sign in to comment.