mirror of
https://github.com/u0u0/Cocos2d-Lua-Community.git
synced 2026-05-06 22:01:44 +08:00
fgui label add letterSpacing support.
This commit is contained in:
@@ -1304,7 +1304,9 @@ void Label::enableBold()
|
||||
// bold is implemented with outline
|
||||
enableShadow(_textColor, Size(0.9f, 0), 0);
|
||||
// add one to kerning
|
||||
setAdditionalKerning(_additionalKerning+1);
|
||||
if (_currentLabelType != LabelType::STRING_TEXTURE) {
|
||||
setAdditionalKerning(_additionalKerning + 1);
|
||||
}
|
||||
_boldEnabled = true;
|
||||
}
|
||||
}
|
||||
@@ -1374,7 +1376,9 @@ void Label::disableEffect(LabelEffect effect)
|
||||
case cocos2d::LabelEffect::BOLD:
|
||||
if (_boldEnabled) {
|
||||
_boldEnabled = false;
|
||||
_additionalKerning -= 1;
|
||||
if (_currentLabelType != LabelType::STRING_TEXTURE) {
|
||||
_additionalKerning -= 1;
|
||||
}
|
||||
disableEffect(LabelEffect::SHADOW);
|
||||
}
|
||||
break;
|
||||
@@ -2030,23 +2034,20 @@ float Label::getLineSpacing() const
|
||||
|
||||
void Label::setAdditionalKerning(float space)
|
||||
{
|
||||
|
||||
if (_currentLabelType != LabelType::STRING_TEXTURE)
|
||||
{
|
||||
if (_currentLabelType != LabelType::STRING_TEXTURE) {
|
||||
if (_additionalKerning != space)
|
||||
{
|
||||
_additionalKerning = space;
|
||||
_contentDirty = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
CCLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE");
|
||||
}
|
||||
}
|
||||
|
||||
float Label::getAdditionalKerning() const
|
||||
{
|
||||
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
||||
|
||||
return _additionalKerning;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@ void FUILabel::applyTextFormat()
|
||||
else
|
||||
disableEffect(LabelEffect::BOLD);
|
||||
|
||||
if (_currentLabelType != LabelType::STRING_TEXTURE) {
|
||||
setAdditionalKerning(_textFormat->letterSpacing);
|
||||
}
|
||||
|
||||
setLineSpacing(_textFormat->lineSpacing);
|
||||
setHorizontalAlignment(_textFormat->align);
|
||||
setVerticalAlignment(_textFormat->verticalAlign);
|
||||
|
||||
Reference in New Issue
Block a user