From b57c6b412cb17ac1222b881660cfda66219e3a58 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Fri, 16 May 2014 18:13:19 -0500 Subject: [PATCH] Fix buildTextCache not taking line spacing into account for metrics. Fix TextComponent's calculateExtent not taking line spacing into account. --- src/components/TextComponent.cpp | 4 ++-- src/resources/Font.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/TextComponent.cpp b/src/components/TextComponent.cpp index a4d968b6d..a0a8db48c 100644 --- a/src/components/TextComponent.cpp +++ b/src/components/TextComponent.cpp @@ -122,11 +122,11 @@ void TextComponent::calculateExtent() { if(mAutoCalcExtent.x()) { - mSize = mFont->sizeText(mUppercase ? strToUpper(mText) : mText); + mSize = mFont->sizeText(mUppercase ? strToUpper(mText) : mText, mLineSpacing); }else{ 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(); } } } diff --git a/src/resources/Font.cpp b/src/resources/Font.cpp index c01641475..60355a361 100644 --- a/src/resources/Font.cpp +++ b/src/resources/Font.cpp @@ -479,7 +479,7 @@ TextCache* Font::buildTextCache(const std::string& text, Eigen::Vector2f offset, x += mCharData[letter].advX * mFontScale; } - TextCache::CacheMetrics metrics = { sizeText(text) }; + TextCache::CacheMetrics metrics = { sizeText(text, lineSpacing) }; TextCache* cache = new TextCache(vertCount, vert, colors, metrics); if(color != 0x00000000) cache->setColor(color);