From af1e605be27afc79c293fdd0a45e6f6e2edd9054 Mon Sep 17 00:00:00 2001 From: Qunxin Liu Date: Fri, 10 Feb 2023 11:08:05 -0800 Subject: [PATCH] [instancer] bug fix It's possible that length of all_points equals to 4 for non-empty glyphs: a composite glyph which contains only one child glyph that is empty. --- src/OT/glyf/Glyph.hh | 2 +- test/subset/data/Makefile.am | 1 + test/subset/data/Makefile.sources | 1 + ...ono.default.retain-all-codepoint.wght=700.ttf | Bin 0 -> 1264 bytes test/subset/data/fonts/RobotoMono.ttf | Bin 0 -> 1932 bytes .../tests/instance_comp_glyph_empty_child.tests | 11 +++++++++++ test/subset/meson.build | 1 + 7 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/subset/data/expected/instance_comp_glyph_empty_child/RobotoMono.default.retain-all-codepoint.wght=700.ttf create mode 100644 test/subset/data/fonts/RobotoMono.ttf create mode 100644 test/subset/data/tests/instance_comp_glyph_empty_child.tests diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh index 8ca9350d1..5574ae072 100644 --- a/src/OT/glyf/Glyph.hh +++ b/src/OT/glyf/Glyph.hh @@ -119,7 +119,7 @@ struct Glyph hb_bytes_t &dest_bytes /* OUT */) const { GlyphHeader *glyph_header = nullptr; - if (!plan->pinned_at_default && type != EMPTY && all_points.length > 4) + if (!plan->pinned_at_default && type != EMPTY && all_points.length >= 4) { glyph_header = (GlyphHeader *) hb_calloc (1, GlyphHeader::static_size); if (unlikely (!glyph_header)) return false; diff --git a/test/subset/data/Makefile.am b/test/subset/data/Makefile.am index e1747d788..939d468d6 100644 --- a/test/subset/data/Makefile.am +++ b/test/subset/data/Makefile.am @@ -63,6 +63,7 @@ EXTRA_DIST += \ expected/pin_all_at_default \ expected/instance_no_double_free \ expected/mvar_full_instance \ + expected/instance_comp_glyph_empty_child \ fonts \ profiles \ $(NULL) diff --git a/test/subset/data/Makefile.sources b/test/subset/data/Makefile.sources index 8a86ad7b1..0b64cad30 100644 --- a/test/subset/data/Makefile.sources +++ b/test/subset/data/Makefile.sources @@ -54,6 +54,7 @@ TESTS = \ tests/pin_all_at_default.tests \ tests/instance_no_double_free.tests \ tests/mvar_full_instance.tests \ + tests/instance_comp_glyph_empty_child.tests \ $(NULL) # TODO: re-enable once colrv1 subsetting is stabilized. diff --git a/test/subset/data/expected/instance_comp_glyph_empty_child/RobotoMono.default.retain-all-codepoint.wght=700.ttf b/test/subset/data/expected/instance_comp_glyph_empty_child/RobotoMono.default.retain-all-codepoint.wght=700.ttf new file mode 100644 index 0000000000000000000000000000000000000000..16084db95fa8fc37dc20e9b2167ebcdcea732f6a GIT binary patch literal 1264 zcma)4O-NKx6#m|uH~P#m6{J9--a?`uQ&Vf9LTS;uN&_iVhTpHc{fB8elUNTxZiinA$1Go zC&l)Ixk={MF`f{A&T}WW)}MVMUMD`Aqr;x4zejwVxFeU3X026Pz$V2Gidk1QQ*iTM_lfi%d#q48!(utAxgMg_F1ON9Y!Pe=|__coq#LmMnO)E2kkMU~03lF@UCmv3o){$=Y< z^UyCel2)#j@2y>;Kd+s8C0efrVOcGi&{n8TogFam`?*N2n~L1PXk=Wv%N(ZBs%tbG zMvM7|9?M##jsx)*@jix*RCVk$fm4N;9(E6#mYe_olDYX*+ESDj{WJ21HcAp%79qw%9nD6l>a2U6{z5b~-aS)0xan zk?tBIm>4xC?hM8*T$r!{!@`9N7A_141_&hR!mwsxOw@%*>-e2JcRG)xy)W0Tez0$|{0_|f3I%3!50PSySrwZl91@|^J z$Q25|RGANSrv0AI<={dU&&nw6leCjdK{;27e*G_Nk}p!NR_cvr89DZIU*pwUu3CtG zdWmt(?`k$F&0vpQrFkQ`j-B`zp0RA4Q)JWjEe;DCul(|U|H*&Q!RI>xyBy7IavPjMxbAKFf?dG-$~(f8J*_!% z7mJpzyA5vhx9rT+R0d;M!&<9`pLJeHLcW<|Rd>|8Mifm-rHSwzvTGaC-wbV+kH*)` z{!livt^R(H=A~=yXAI#PNo$s?J>1~i(uF&B!|D$DaLeiujN+lyUF?%Vt9#fb$E_Yk zN~T*ni^t`>)djv>w7P>~`NZlG#N<1xvv2v{>RzX=ggLv&dCy{e{%U@=dN+J-gy~;m z7mC=m;;r-A(aBBx*0@gmG`SauUgpkjjSVAC zvHueBTO-@iH~BpR;)?uYZ!x1rZngE4ax~A8!Q39k>N6)IG9j!7?