mirror of https://github.com/axmolengine/axmol.git
issue #5277:Label:It could be possible that for using outline and invoking 'Director::setContentScaleFactor' cause label show nothing.
This commit is contained in:
parent
ac258439b0
commit
d13ed93fc1
|
@ -102,9 +102,10 @@ FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline /
|
|||
{
|
||||
if (_outlineSize > 0)
|
||||
{
|
||||
_outlineSize *= CC_CONTENT_SCALE_FACTOR();
|
||||
FT_Stroker_New(FontFreeType::getFTLibrary(), &_stroker);
|
||||
FT_Stroker_Set(_stroker,
|
||||
(int)(_outlineSize * 64 * CC_CONTENT_SCALE_FACTOR()),
|
||||
(int)(_outlineSize * 64),
|
||||
FT_STROKER_LINECAP_ROUND,
|
||||
FT_STROKER_LINEJOIN_ROUND,
|
||||
0);
|
||||
|
@ -305,8 +306,8 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
|
|||
auto blendImage = new unsigned char[blendWidth * blendHeight * 2];
|
||||
memset(blendImage, 0, blendWidth * blendHeight * 2);
|
||||
|
||||
int px = blendWidth == outlineWidth ? 0 : _outlineSize;
|
||||
int py = blendHeight == outlineHeight ? 0 : _outlineSize;
|
||||
int px = (blendWidth - outlineWidth) / 2;
|
||||
int py = (blendHeight - outlineHeight) / 2;
|
||||
for (int x = 0; x < outlineWidth; ++x)
|
||||
{
|
||||
for (int y = 0; y < outlineHeight; ++y)
|
||||
|
@ -317,8 +318,8 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
|
|||
}
|
||||
}
|
||||
|
||||
px = blendWidth == outWidth ? 0 : _outlineSize;
|
||||
py = blendHeight == outHeight ? 0 : _outlineSize;
|
||||
px = (blendWidth - outWidth) / 2;
|
||||
py = (blendHeight - outHeight) / 2;
|
||||
for (int x = 0; x < outWidth; ++x)
|
||||
{
|
||||
for (int y = 0; y < outHeight; ++y)
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
static void shutdownFreeType();
|
||||
|
||||
bool isDistanceFieldEnabled() const { return _distanceFieldEnabled;}
|
||||
int getOutlineSize() const { return _outlineSize; }
|
||||
float getOutlineSize() const { return _outlineSize; }
|
||||
void renderCharAt(unsigned char *dest,int posX, int posY, unsigned char* bitmap,long bitmapWidth,long bitmapHeight);
|
||||
|
||||
virtual FontAtlas * createFontAtlas() override;
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
FT_Stroker _stroker;
|
||||
std::string _fontName;
|
||||
bool _distanceFieldEnabled;
|
||||
int _outlineSize;
|
||||
float _outlineSize;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
Loading…
Reference in New Issue