* src/cff/cffgload.c (cff_slot_load): Fix autohinter scaling.

Fixes #1330.
This commit is contained in:
Alexei Podtelezhnikov 2025-05-07 17:57:42 -04:00
parent ab0fe6d55e
commit c1278179dc

View file

@ -408,12 +408,28 @@
#endif /* FT_CONFIG_OPTION_SVG */
/* top-level code ensures that FT_LOAD_NO_HINTING is set */
/* if FT_LOAD_NO_SCALE is active */
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
glyph->hint = hinting;
glyph->scaled = scaled;
if ( scaled )
{
glyph->x_scale = size->root.metrics.x_scale;
glyph->y_scale = size->root.metrics.y_scale;
}
else
{
glyph->x_scale = 0x10000L;
glyph->y_scale = 0x10000L;
}
/* if we have a CID subfont, use its matrix (which has already */
/* been multiplied with the root matrix) */
glyph->x_scale = size->root.metrics.x_scale;
glyph->y_scale = size->root.metrics.y_scale;
/* this scaling is only relevant if the PS hinter isn't active */
if ( cff->num_subfonts )
{
@ -445,14 +461,6 @@
font_offset = cff->top_font.font_dict.font_offset;
}
/* top-level code ensures that FT_LOAD_NO_HINTING is set */
/* if FT_LOAD_NO_SCALE is active */
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
glyph->hint = hinting;
glyph->scaled = scaled;
{
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
@ -687,7 +695,7 @@
metrics->vertAdvance += font_offset.y;
}
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )
if ( scaled || force_scaling )
{
/* scale the outline and the metrics */
FT_Int n;