Merge pull request #30 from Dhilan007/iss4660

Label:fixed wrong logic of alignment.
This commit is contained in:
James Chen 2014-05-12 14:39:14 +08:00
commit d8b913dcd8
3 changed files with 9 additions and 5 deletions

View File

@ -476,7 +476,6 @@ void Label::setString(const std::string& text)
std::u16string utf16String;
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
{
_originalUTF16String = utf16String;
_currentUTF16String = utf16String;
}
}
@ -927,10 +926,16 @@ void Label::setFontDefinition(const FontDefinition& textDefinition)
void Label::updateContent()
{
std::u16string utf16String;
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
{
_currentUTF16String = utf16String;
}
computeStringNumLines();
if (_fontAtlas)
{
computeHorizontalKernings(_originalUTF16String);
computeHorizontalKernings(_currentUTF16String);
}
if (_textSprite)

View File

@ -344,7 +344,6 @@ protected:
int _currNumLines;
std::u16string _currentUTF16String;
std::u16string _originalUTF16String;
std::string _originalUTF8String;
float _fontScale;

View File

@ -173,9 +173,9 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
std::u16string strNew(multiline_string.begin(), multiline_string.end());
theLabel->_originalUTF16String = strNew;
theLabel->_currentUTF16String = strNew;
theLabel->computeStringNumLines();
theLabel->computeHorizontalKernings(theLabel->_originalUTF16String);
theLabel->computeHorizontalKernings(theLabel->_currentUTF16String);
return true;
}