Merge pull request #5434 from Dhilan007/develop_label

closed #3758:fixed character will not aligned on the the baseline when label using distance field.
This commit is contained in:
James Chen 2014-02-21 18:29:47 +08:00
commit e9c1335084
1 changed files with 12 additions and 3 deletions

View File

@ -156,8 +156,17 @@ bool FontFreeType::getBBOXFotChar(unsigned short theChar, Rect &outRect, int &xA
return false;
// load glyph infos
if (FT_Load_Glyph(_fontRef, glyph_index, FT_LOAD_DEFAULT))
return false;
if (_distanceFieldEnabled)
{
if (FT_Load_Glyph(_fontRef, glyph_index, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT))
return false;
}
else
{
if (FT_Load_Glyph(_fontRef, glyph_index, FT_LOAD_DEFAULT))
return false;
}
// store result in the passed rectangle
outRect.origin.x = _fontRef->glyph->metrics.horiBearingX >> 6;
@ -236,7 +245,7 @@ unsigned char * FontFreeType::getGlyphBitmap(unsigned short theChar, int &outWid
return 0;
if (_distanceFieldEnabled)
{
{
if (FT_Load_Char(_fontRef,theChar,FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT))
return 0;
}