From e2856c2d85eb0f6ce0c780d1889dc9bb05cdc433 Mon Sep 17 00:00:00 2001 From: Michiharu Ariza Date: Thu, 7 Feb 2019 15:32:32 -0800 Subject: [PATCH] retain FDSelect & FDArray with --retain-gids so in sync with fonttools behavior --- src/hb-subset-cff-common.cc | 12 ++++-------- ...urceHanSans-Regular.41,4C2E.retaingids.otf | Bin 2604 -> 2736 bytes 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/hb-subset-cff-common.cc b/src/hb-subset-cff-common.cc index 46821fec1..f29937a22 100644 --- a/src/hb-subset-cff-common.cc +++ b/src/hb-subset-cff-common.cc @@ -66,21 +66,17 @@ hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan, hb_set_t *set = hb_set_create (); if (set == &Null (hb_set_t)) return false; - hb_codepoint_t prev_fd = 0; + hb_codepoint_t prev_fd = CFF_UNDEF_CODE; for (hb_codepoint_t i = 0; i < subset_num_glyphs; i++) { hb_codepoint_t glyph; hb_codepoint_t fd; if (!plan->old_gid_for_new_gid (i, &glyph)) { - /* for a missing glyph, use the same fd as the previous - * as an attempt to minimize the number of ranges */ - fd = prev_fd; - } - else - { - fd = src.get_fd (glyph); + /* fonttools retains FDSelect & font dicts for missing glyphs. do the same */ + glyph = i; } + fd = src.get_fd (glyph); set->add (fd); if (fd != prev_fd) diff --git a/test/api/fonts/SourceHanSans-Regular.41,4C2E.retaingids.otf b/test/api/fonts/SourceHanSans-Regular.41,4C2E.retaingids.otf index 6da8ad376083fc3e6f24f8f696a155603571dbf8..906bdbefd595a64a682884a2ffd18b7592f7d530 100644 GIT binary patch delta 483 zcmYMv-77Cqo3tq9F4l>qWHWxXMPSF<=wH!!x*mem(!@eNPAgB&CeMs(J1deA@VeTG~U zp+L2m&Z&Mz)*{idgi;EN!aqR<^58XfytfC>Pm zn*!$qH8f4w0W~a^!;F9*W z)9<7R5)A<;f*^p1U@%Z1A?7%WYn$!3tQOiKpC*v zwZGz3I$O*L* AbpQYW delta 376 zcmdlWx<;hlKP1GTfrp`iftkU<+09KMma*y^0|Ubu1_std|6qNiux2h}1_rhapjbkf ze~>$KA&|wub^=InBi7A{V9QI)O*Pc?3<2_M7#Nr$3i69f{_s0S)A=6ITK9zX16vWk3VDcQEW`VBnINcp_Ve@i#xvF-$Bxsvt^;M+HPV z3o>vpF)#wX^qAoj!*_=Nj53TijB%Tj83P$7pJU<)Vqj!sWM^A!w#b^BfkBCNt;+s? zeayh{00KrP24+SERv^L1FRLxX*u$eH!ypGVm1UQZ3}Y{xcLT`l1Mxr>vwYi}&Af$a ZvN2mWKiCkEL5ysc`js;_A7J~y3;;w>O%wnC