mirror of https://github.com/axmolengine/axmol.git
Label:Fixed wrong letter spacing with outline enabled
This commit is contained in:
parent
9e937759c1
commit
cbd428f6ac
|
@ -343,7 +343,6 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xAdvance += 2 * _outlineSize;
|
|
||||||
outRect.size.width = blendWidth;
|
outRect.size.width = blendWidth;
|
||||||
outRect.size.height = blendHeight;
|
outRect.size.height = blendHeight;
|
||||||
outWidth = blendWidth;
|
outWidth = blendWidth;
|
||||||
|
|
|
@ -955,25 +955,42 @@ 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);
|
glprogram->setUniformsForBuiltins(transform);
|
||||||
|
|
||||||
for(const auto &child: _children)
|
for(const auto &child: _children)
|
||||||
{
|
{
|
||||||
child->updateTransform();
|
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)
|
for (const auto& batchNode:_batchNodes)
|
||||||
{
|
{
|
||||||
batchNode->getTextureAtlas()->drawQuads();
|
batchNode->getTextureAtlas()->drawQuads();
|
||||||
|
|
Loading…
Reference in New Issue