diff --git a/src/hb-ot-var-gvar-table.hh b/src/hb-ot-var-gvar-table.hh index b2b21005a..68aca9044 100644 --- a/src/hb-ot-var-gvar-table.hh +++ b/src/hb-ot-var-gvar-table.hh @@ -151,6 +151,15 @@ struct glyph_variations_t contour_point_vector_t *all_points; if (!plan->new_gid_contour_points_map.has (new_gid, &all_points)) return false; + /* IUP adds rebased constant deltas to the contour coordinates. Keep + * the plan's original points intact across serialization retries. */ + contour_point_vector_t points; + if (iup_optimize) + { + points = *all_points; + if (unlikely (points.in_error ())) return false; + all_points = &points; + } /* avar2 partial instancing: cull unreachable tuples. */ if (plan->has_avar2 && plan->avar2_reachable_ranges.get_population ()) glyph_variations[i].cull_unreachable (plan->avar2_reachable_ranges); diff --git a/test/subset/data/expected/glyf_iup_retry/RobotoFlex-Variable.ABC.default.all.wght=280-640-865.iup_optimize.ttf b/test/subset/data/expected/glyf_iup_retry/RobotoFlex-Variable.ABC.default.all.wght=280-640-865.iup_optimize.ttf new file mode 100644 index 000000000..c5159c37f Binary files /dev/null and b/test/subset/data/expected/glyf_iup_retry/RobotoFlex-Variable.ABC.default.all.wght=280-640-865.iup_optimize.ttf differ diff --git a/test/subset/data/tests/glyf_iup_retry.tests b/test/subset/data/tests/glyf_iup_retry.tests new file mode 100644 index 000000000..65a6bf0c5 --- /dev/null +++ b/test/subset/data/tests/glyf_iup_retry.tests @@ -0,0 +1,19 @@ +# Rebased tuples grow the gvar buffer and trigger a serialization retry. +# Its contour coordinates must not accumulate the shifted default twice. +FONTS: +RobotoFlex-Variable.ABC.ttf + +PROFILES: +default.txt + +SUBSETS: +* + +INSTANCES: +wght=280:640:865 + +IUP_OPTIONS: +Yes + +OPTIONS: +no_fonttools diff --git a/test/subset/meson.build b/test/subset/meson.build index cd72384cc..94f0bdacf 100644 --- a/test/subset/meson.build +++ b/test/subset/meson.build @@ -80,6 +80,7 @@ tests = [ 'instantiate_cff2_update_metrics', 'layout.empty_ligature_offset', 'glyf_partial_instancing', + 'glyf_iup_retry', 'glyf_iup_large_contour', 'hvar_partial_instance_implicit_map', 'mvar_partial_instance',