[subset] Keep original IUP contour points across serialization retries (#6345)

IUP adds rebased constant tuples to the plan's cached contour points.
When serialization needs a larger buffer, another gvar serialization
adds the same constants again. The final optimizer then chooses points
against a different outline than the one stored in glyf.

Copy the cached points before IUP instancing so every serialization
attempt starts from the original contour coordinates. Check allocation
failure through the usual vector error path.

Add a shifted-default Roboto Flex regression that fails on the original
subsetter. The entire configured Meson suite passes (278 tests, one
skipped).

Assisted-by: Codex
This commit is contained in:
Behdad Esfahbod authored and GitHub committed 2026-10-10 01:13:14 -06:00
1 parent be6a74f303
commit 3396dcb35b
4 files changed
+29

No files matched your search

+9
View File
@@ -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);
@@ -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
+1
View File
@@ -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',