diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index 3312bbc8dc..c5b3096c8f 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -343,7 +343,6 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid } } - xAdvance += 2 * _outlineSize; outRect.size.width = blendWidth; outRect.size.height = blendHeight; outWidth = blendWidth; diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index cc031af230..8a37a60c16 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -955,24 +955,41 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated) } } - if (_currentLabelType == LabelType::TTF) - { - glprogram->setUniformLocationWith4f(_uniformTextColor, - _textColorF.r,_textColorF.g,_textColorF.b,_textColorF.a); - - if (_currLabelEffect == LabelEffect::OUTLINE || _currLabelEffect == LabelEffect::GLOW) - { - glprogram->setUniformLocationWith4f(_uniformEffectColor, - _effectColorF.r, _effectColorF.g, _effectColorF.b, _effectColorF.a); - } - } - glprogram->setUniformsForBuiltins(transform); - for(const auto &child: _children) { child->updateTransform(); } + + if (_currentLabelType == LabelType::TTF) + { + switch (_currLabelEffect) { + case LabelEffect::OUTLINE: + //draw text with outline + glprogram->setUniformLocationWith4f(_uniformTextColor, + _textColorF.r,_textColorF.g,_textColorF.b,_textColorF.a); + glprogram->setUniformLocationWith4f(_uniformEffectColor, + _effectColorF.r, _effectColorF.g, _effectColorF.b, _effectColorF.a); + for (const auto& batchNode:_batchNodes) + { + batchNode->getTextureAtlas()->drawQuads(); + } + + //draw text without outline + glprogram->setUniformLocationWith4f(_uniformEffectColor, + _effectColorF.r, _effectColorF.g, _effectColorF.b, 0.f); + break; + case LabelEffect::GLOW: + glprogram->setUniformLocationWith4f(_uniformEffectColor, + _effectColorF.r, _effectColorF.g, _effectColorF.b, _effectColorF.a); + case LabelEffect::NORMAL: + glprogram->setUniformLocationWith4f(_uniformTextColor, + _textColorF.r,_textColorF.g,_textColorF.b,_textColorF.a); + break; + default: + break; + } + } for (const auto& batchNode:_batchNodes) {