Fix incorrect advance width scaling (#52683).

* src/base/ftadvance.c (FT_Get_Advances): Always respect the
FT_LOAD_NO_SCALE flag if present.
This commit is contained in:
Jonathan Kew 2017-12-17 08:19:51 +01:00 committed by Werner Lemberg
parent d019097bd2
commit 7d3dfcd4a5
2 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2017-12-17 Jonathan Kew <jfkthame@gmail.com>
Fix incorrect advance width scaling (#52683).
* src/base/ftadvance.c (FT_Get_Advances): Always respect the
FT_LOAD_NO_SCALE flag if present.
2017-12-16 Alexei Podtelezhnikov <apodtele@gmail.com>
* builds/windows/vc2010/freetype.vcxproj: AfterBuild copy.

View File

@ -116,9 +116,12 @@
FT_Int32 flags,
FT_Fixed *padvances )
{
FT_Error error = FT_Err_Ok;
FT_Face_GetAdvancesFunc func;
FT_UInt num, end, nn;
FT_Error error = FT_Err_Ok;
FT_UInt num, end, nn;
FT_Int factor;
if ( !face )
@ -152,16 +155,17 @@
return FT_THROW( Unimplemented_Feature );
flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
factor = ( flags & FT_LOAD_NO_SCALE ) ? 1 : 1024;
for ( nn = 0; nn < count; nn++ )
{
error = FT_Load_Glyph( face, start + nn, flags );
if ( error )
break;
/* scale from 26.6 to 16.16 */
/* scale from 26.6 to 16.16, unless NO_SCALE was requested */
padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? face->glyph->advance.y * 1024
: face->glyph->advance.x * 1024;
? face->glyph->advance.y * factor
: face->glyph->advance.x * factor;
}
return error;