diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index eede290..a0cfaed 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -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; } diff --git a/cocos/editor-support/fairygui/display/FUILabel.cpp b/cocos/editor-support/fairygui/display/FUILabel.cpp index 7f58cbb..145a074 100644 --- a/cocos/editor-support/fairygui/display/FUILabel.cpp +++ b/cocos/editor-support/fairygui/display/FUILabel.cpp @@ -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);