From 1e6ea99af7f2056d288e10ca848db12d113b2b10 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 10 Oct 2026 00:36:51 -0600 Subject: [PATCH] [subset] Preserve deltas when a contour exceeds the IUP set limit (#6344) The IUP optimizer returns success for contours larger than its 512-bit sets can represent, leaving every optimized reference false. The resulting partial instance loses the contour's variation data. Keep all explicit references when skipping optimization at that limit. This preserves the existing bounded search without changing geometry. Add a 600-point contour regression. The original subsetter fails both normal and preprocessed checks. The entire configured Meson suite passes (278 tests, one skipped). Assisted-by: Codex --- src/hb-subset-instancer-iup.cc | 8 +++++++- ....default.all.wght=400-900.iup_optimize.ttf | Bin 0 -> 3284 bytes test/subset/data/fonts/IUP-large-contour.ttf | Bin 0 -> 3428 bytes .../data/tests/glyf_iup_large_contour.tests | 18 ++++++++++++++++++ test/subset/meson.build | 1 + 5 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/subset/data/expected/glyf_iup_large_contour/IUP-large-contour.default.all.wght=400-900.iup_optimize.ttf create mode 100644 test/subset/data/fonts/IUP-large-contour.ttf create mode 100644 test/subset/data/tests/glyf_iup_large_contour.tests diff --git a/src/hb-subset-instancer-iup.cc b/src/hb-subset-instancer-iup.cc index 1fb8349c3..a10202aed 100644 --- a/src/hb-subset-instancer-iup.cc +++ b/src/hb-subset-instancer-iup.cc @@ -362,7 +362,13 @@ static bool _iup_contour_optimize (const hb_array_t conto return false; if (unlikely (n > hb_iup_set_t::PAGE_BITS)) - return true; // Refuse to work + { + /* The forced and solution sets cannot hold this contour. Preserve + * its explicit deltas instead of leaving every reference false. */ + for (unsigned i = 0; i < n; i++) + opt_indices.arrayZ[i] = true; + return true; + } bool all_within_tolerance = true; double tolerance_sq = tolerance * tolerance; diff --git a/test/subset/data/expected/glyf_iup_large_contour/IUP-large-contour.default.all.wght=400-900.iup_optimize.ttf b/test/subset/data/expected/glyf_iup_large_contour/IUP-large-contour.default.all.wght=400-900.iup_optimize.ttf new file mode 100644 index 0000000000000000000000000000000000000000..e27fe77a95adc7621dcbad749e62e50b0e8fa6e7 GIT binary patch literal 3284 zcmeHI&ui2`6n>dW8&?trbmCDALLS431d(cA_MJir2bkp61Zntc=KlGqN z{R4_8k3ISac(Zp47V+TGtKh+tAXE_6Z)TEoTPz|ycHg{t-}~Ooyf-rm328)>rx(O& z{Pw+((&WTskx2W5=;N7Yw1Ba<;8pO;v&&KYS+Vg7{51Hv+T4@bVCCZk5&KP~f3IQu z#7^!xk?~FNdK^`ErV2kW|25`csUtA(l%EA37whZI&MJ4{5pAOn&b4MDwk-K)!JE>i!J6jLz)%AM}0un25r)x@w8kww%N)l68yP14B$>S%&T-LA6T z4asF*;l0_u_U=*P>QB-*?v&_5{_C#{t5jv1Y!jTz3SxkB2m2d9-hYdzoJj=&5>b?$ zXDb_2jw4}^ro<`q9QJpC?j}B?lXN5Tc~4yL@ds%X?~`1M(s^W?rkEO3qdIlyCf%ny zbe&o>57we3Y9o7$(KhTNT0@RqOrlFPhux-gQl_#vG_xmv>XLfa`k0%p1-b!_079Lp6Zm7GldVq*?&WGK$P7=IkP~Ez4F7U|VNm z-?pXt0N=OAm_3#Y$5`n5p=yB8uf#zZN(}%(5SCe3=4?~@yD&|Y$^d9WWe23f;h;<9 z0NG#?mB@u4)FXQ4r(S~lD5j+mwIWR;F)Nc6R{IcE_H>iLWb5i6>Quu1j~vz8SnqiV zyANa66Az~USk&vO?9sUm`Bzcj`=R7tF(kg`tbvi^`uhzUC#sYVDg6YcQvVK0CHtWF WXsu!%Qu+x@vwsJsX&>|+tdc- literal 0 HcmV?d00001 diff --git a/test/subset/data/fonts/IUP-large-contour.ttf b/test/subset/data/fonts/IUP-large-contour.ttf new file mode 100644 index 0000000000000000000000000000000000000000..6622dd3289fc4bcc5ad099f9d31270af7598f3d7 GIT binary patch literal 3428 zcmeHI&1(}u6n{Ir%{CIOhs1?qa53TvZ7C$it<;c~TCf)_t)=2cmt>m+^HDZQKSZQb zFW!oRXOA8gJoYRF#j}5af?zKSqT(U`W@a}@rA4I2=FQA|@Ap1t=FKcSq!3YrHb|w3 z>+_?@>B;Fhk#ZH*JGqLp4BuRb_;-o4-2(hy zem;Hx{~E_d*UA69Ht-Fx?=UVFVd%T3o`-0gwO-$_wFbMM>8r(bQE zr##zc+rTO@ZUrGnHCtnx1MRSzVkYhhND&s+_5_)MAE~OTY*8Qa%Kk-spKZ#50334K zd)R3^rDFO!lZdaaVno6DOi`?9LTYFnJFS-Ft>>LO#JMWuSI-tvbVjo>%u1&%*&wX+ zsGG1X(Gw7fgf+yhp|C#0^h83J4MI;0xG`N9Jq8hr>2apV!$zDLv6vwngb_RKrVK;$ z6htazj5A|AY>zWLm9k}nuv1w#ZQG)!A<}6(!|aU8ww3*fDT?R}0*!YuAOcdMV2G|l zhz90&AyrN=b&=NA1I?FzL4*YsnGsAQWP6!lVYv^^#RxVD>2F;YBCF#3f9R;5##YxQ zbS|T#@r&tQi~Kw#KRTy@KVXEO`TswKP6ErnE+ZXC>S~u=>(WDXisCW`fg!rY|Fl{d zmSM{JI-}!s*Vol9yVj+LXpGin4CaZ@tC@vaGgqrNYE94d+=A!U>!n(C&Mh>{jtA$I z^uge}Mtt9*TPhSAG(!tCOD5&0MpbHnH^~F`$fbhdb*fWIc;|$zNo71Oo}W3jCr?K3 z+)maA?af<+w}iQiSgrkD;xP9m{xV&`K(TZJ(F)!sJkG0p>v@>B@NhkXg$M8$K8ObW zc?UUQr45CSX>T@Yf+(9jB=sgpCVOX)Od1D$N1NH`A*nY(G}=3ZXw*39JKCf_qa#w> literal 0 HcmV?d00001 diff --git a/test/subset/data/tests/glyf_iup_large_contour.tests b/test/subset/data/tests/glyf_iup_large_contour.tests new file mode 100644 index 000000000..4b9490bf9 --- /dev/null +++ b/test/subset/data/tests/glyf_iup_large_contour.tests @@ -0,0 +1,18 @@ +# A 600-point contour exceeds the IUP bitset limit; keep dense deltas. +FONTS: +IUP-large-contour.ttf + +PROFILES: +default.txt + +SUBSETS: +* + +INSTANCES: +wght=400:900 + +IUP_OPTIONS: +Yes + +OPTIONS: +no_fonttools diff --git a/test/subset/meson.build b/test/subset/meson.build index 4d16f6b0c..cd72384cc 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_large_contour', 'hvar_partial_instance_implicit_map', 'mvar_partial_instance', 'update_def_wght',