diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 8ab55f2cd..8b2501852 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -685,6 +685,7 @@ { FT_BBox cbox; FT_Glyph_Metrics* metrics = &glyph->root.metrics; + FT_Bool has_hmetrics; FT_Bool has_vertical_info; @@ -694,7 +695,9 @@ if ( size && size->root.metrics.y_ppem < 24 ) glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION; - if ( face->horizontal.number_Of_HMetrics ) + has_hmetrics = FT_BOOL( face->horizontal.number_Of_HMetrics ); + + if ( has_hmetrics ) { FT_Short dummy; FT_UShort horiAdvance = 0; @@ -758,10 +761,12 @@ { FT_Outline_Transform( &glyph->root.outline, &font_matrix ); - metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, - font_matrix.xx ); - metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, - font_matrix.yy ); + /* Only adjust `horiAdvance` if its value comes from CFF data. */ + if ( !has_hmetrics ) + metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, + font_matrix.xx ); + /* The `vertAdvance` value does not come from CFF data */ + /* so we don't scale it with `font_matrix.yy`. */ } if ( font_offset.x || font_offset.y )