mirror of https://github.com/axmolengine/axmol.git
Merge pull request #30 from Dhilan007/iss4660
Label:fixed wrong logic of alignment.
This commit is contained in:
commit
d8b913dcd8
|
@ -476,7 +476,6 @@ void Label::setString(const std::string& text)
|
||||||
std::u16string utf16String;
|
std::u16string utf16String;
|
||||||
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
|
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
|
||||||
{
|
{
|
||||||
_originalUTF16String = utf16String;
|
|
||||||
_currentUTF16String = utf16String;
|
_currentUTF16String = utf16String;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -927,10 +926,16 @@ void Label::setFontDefinition(const FontDefinition& textDefinition)
|
||||||
|
|
||||||
void Label::updateContent()
|
void Label::updateContent()
|
||||||
{
|
{
|
||||||
|
std::u16string utf16String;
|
||||||
|
if (StringUtils::UTF8ToUTF16(_originalUTF8String, utf16String))
|
||||||
|
{
|
||||||
|
_currentUTF16String = utf16String;
|
||||||
|
}
|
||||||
|
|
||||||
computeStringNumLines();
|
computeStringNumLines();
|
||||||
if (_fontAtlas)
|
if (_fontAtlas)
|
||||||
{
|
{
|
||||||
computeHorizontalKernings(_originalUTF16String);
|
computeHorizontalKernings(_currentUTF16String);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_textSprite)
|
if (_textSprite)
|
||||||
|
|
|
@ -344,7 +344,6 @@ protected:
|
||||||
|
|
||||||
int _currNumLines;
|
int _currNumLines;
|
||||||
std::u16string _currentUTF16String;
|
std::u16string _currentUTF16String;
|
||||||
std::u16string _originalUTF16String;
|
|
||||||
std::string _originalUTF8String;
|
std::string _originalUTF8String;
|
||||||
|
|
||||||
float _fontScale;
|
float _fontScale;
|
||||||
|
|
|
@ -173,9 +173,9 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
|
||||||
|
|
||||||
std::u16string strNew(multiline_string.begin(), multiline_string.end());
|
std::u16string strNew(multiline_string.begin(), multiline_string.end());
|
||||||
|
|
||||||
theLabel->_originalUTF16String = strNew;
|
theLabel->_currentUTF16String = strNew;
|
||||||
theLabel->computeStringNumLines();
|
theLabel->computeStringNumLines();
|
||||||
theLabel->computeHorizontalKernings(theLabel->_originalUTF16String);
|
theLabel->computeHorizontalKernings(theLabel->_currentUTF16String);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue