From 5e868703788057696eb062fc30de0898058fdc41 Mon Sep 17 00:00:00 2001 From: Qunxin Liu Date: Wed, 25 Jan 2023 12:27:16 -0800 Subject: [PATCH] [instancer] compute head/maxp values using only non-empty glyphs --- src/OT/glyf/Glyph.hh | 14 +++++++++++++- ...tain-all-codepoint.wght=100,ELGR=1,ELSH=2.ttf | Bin 0 -> 2244 bytes .../data/tests/instance_no_double_free.tests | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/subset/data/expected/instance_no_double_free/Handjet.default.retain-all-codepoint.wght=100,ELGR=1,ELSH=2.ttf diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 9c2ce9a93..57d3e11f9 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -183,7 +183,19 @@ struct Glyph { contour_point_vector_t all_points, deltas; unsigned composite_contours = 0; - if (!get_points (font, glyf, all_points, &deltas, &plan->head_maxp_info, &composite_contours, false, false)) + head_maxp_info_t *head_maxp_info_p = &plan->head_maxp_info; + unsigned *composite_contours_p = &composite_contours; + + // don't compute head/maxp values when glyph has no contours(type is EMPTY) + // also ignore .notdef glyph when --notdef-outline is not enabled + if (type == EMPTY || + (gid == 0 && !(plan->flags & HB_SUBSET_FLAGS_NOTDEF_OUTLINE))) + { + head_maxp_info_p = nullptr; + composite_contours_p = nullptr; + } + + if (!get_points (font, glyf, all_points, &deltas, head_maxp_info_p, composite_contours_p, false, false)) return false; // .notdef, set type to empty so we only update metrics and don't compile bytes for diff --git a/test/subset/data/expected/instance_no_double_free/Handjet.default.retain-all-codepoint.wght=100,ELGR=1,ELSH=2.ttf b/test/subset/data/expected/instance_no_double_free/Handjet.default.retain-all-codepoint.wght=100,ELGR=1,ELSH=2.ttf new file mode 100644 index 0000000000000000000000000000000000000000..87aa06b31a4f6edc3796cf16272357d7e8d27c61 GIT binary patch literal 2244 zcmb_cO=uit7=FIlnf*yOKcrizlGZ^=npW*@QmG})!8AWxWT7FuS`TV>x>Db;Xe~d&o3cX4c4O$d9J8FP{JPi`};Y<7M*ci`nGV z50`G=CI65-pUutYp1f&h$nTNY3RS0pI5t`T2l=xlr_~^ikSB=IQf2-1n;Um00c#5g zCCWu-<-}W`|H68k@iS#Qj^7D?#r#jmkCm(LwKG4)Q{)rmiAufTh>wjj`51Y;>RfAJ z^UxjgSIF&}Q!P$?|LP5{y}~s!je5)7JuQ63ugiF&S!|TU?{1LC$s@N!cVo+Zj})TY z#V~!qDt;14@y?)aY(Mzp1a_DQ3}B46m|x7~I5|!cV6DDn+=2)55YSNBL4d#-gf!hv z$)5JPSU+a})dmJ_?1<>VR^J+ObpZoMgW4g*I0^E&%B2$SBKwd(4uLfvtnmA67fafUFz9 zS>BeK%`vB0t-&s=H!HBq#VbwN700DVCil(F9C`{X)P}^ZgNz$18V^heKc>?ej1myP?&K2)ox8pM7-=;xjpMQ?~!5Fald(2=@Zp zp#585hcJb20^8*2ZU(l+UakjrnEuza&A#JU4r~jDF&)@p=G%cCq2j}VJ<9xeU{BBj zvV6{KD4~KP?WsG1%5@V}evCRAn%&pP) z27NA`VXs9-*0`qJ#k)dDNOPSw$&Vp#Jx2(mY82xx(aG8vsC3$b6qL2F`@LkT)D+lN%AgHr_5Nx z73wT7vr4aArKP6hawabOkh4wp?U%%fZr9ij-nQc~)pvs!%kvBsr$=#(!Vh_xYZSiK zkv!ySv^p9iZH=+KM&U==x=thCyS(Nag@53A%{2<2UnsS&Mq``r9eGr~e`>!GUt*-K z(cBvK5P=!~VAR`R5&Kn@>_;K{P$>LIQ}{3?Ax|r@IvOMGM^h$zttgh)D15Cbme(kJ zDpQIzS{(P7I^NgHJO?= bCMC>hIH_Sw!~Y!HIWm4^-#>3(FP(n_VIgOj literal 0 HcmV?d00001 diff --git a/test/subset/data/tests/instance_no_double_free.tests b/test/subset/data/tests/instance_no_double_free.tests index 6be859791..0e9f930fe 100644 --- a/test/subset/data/tests/instance_no_double_free.tests +++ b/test/subset/data/tests/instance_no_double_free.tests @@ -2,6 +2,7 @@ FONTS: Handjet.ttf PROFILES: +default.txt notdef-outline.txt SUBSETS: