[cff] Fix handling of horiAdvance and vertAdvance.

* src/cff/cffgload.c (cff_slot_load): The `horiAdvance` value needs
  an adjustment for a non-uniform scaling matrix when it came from a raw CFF
  data blob but not for the OpenType/CFF case when an 'hmtx' table is
  available.  Similarly, the `vertAdvance` value does never come from the
  CFF data blob so it doesn't need adjustment.
This commit is contained in:
John Tytgat
2026-11-30 08:35:04 +01:00
committed by Werner Lemberg
parent 7ecef80230
commit f80f688894
+10 -5
View File
@@ -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 )