Fix buildTextCache not taking line spacing into account for metrics.

Fix TextComponent's calculateExtent not taking line spacing into account.
This commit is contained in:
Aloshi 2014-05-16 18:13:19 -05:00
parent ed1612a341
commit b57c6b412c
2 changed files with 3 additions and 3 deletions

View file

@ -122,11 +122,11 @@ void TextComponent::calculateExtent()
{ {
if(mAutoCalcExtent.x()) if(mAutoCalcExtent.x())
{ {
mSize = mFont->sizeText(mUppercase ? strToUpper(mText) : mText); mSize = mFont->sizeText(mUppercase ? strToUpper(mText) : mText, mLineSpacing);
}else{ }else{
if(mAutoCalcExtent.y()) if(mAutoCalcExtent.y())
{ {
mSize[1] = mFont->sizeWrappedText(mUppercase ? strToUpper(mText) : mText, getSize().x()).y(); mSize[1] = mFont->sizeWrappedText(mUppercase ? strToUpper(mText) : mText, getSize().x(), mLineSpacing).y();
} }
} }
} }

View file

@ -479,7 +479,7 @@ TextCache* Font::buildTextCache(const std::string& text, Eigen::Vector2f offset,
x += mCharData[letter].advX * mFontScale; x += mCharData[letter].advX * mFontScale;
} }
TextCache::CacheMetrics metrics = { sizeText(text) }; TextCache::CacheMetrics metrics = { sizeText(text, lineSpacing) };
TextCache* cache = new TextCache(vertCount, vert, colors, metrics); TextCache* cache = new TextCache(vertCount, vert, colors, metrics);
if(color != 0x00000000) if(color != 0x00000000)
cache->setColor(color); cache->setColor(color);