retain FDSelect & FDArray with --retain-gids

so in sync with fonttools behavior
This commit is contained in:
Michiharu Ariza 2019-02-07 15:32:32 -08:00
parent a5fa76977b
commit e2856c2d85
2 changed files with 4 additions and 8 deletions

View File

@ -66,21 +66,17 @@ hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan,
hb_set_t *set = hb_set_create (); hb_set_t *set = hb_set_create ();
if (set == &Null (hb_set_t)) if (set == &Null (hb_set_t))
return false; 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++) for (hb_codepoint_t i = 0; i < subset_num_glyphs; i++)
{ {
hb_codepoint_t glyph; hb_codepoint_t glyph;
hb_codepoint_t fd; hb_codepoint_t fd;
if (!plan->old_gid_for_new_gid (i, &glyph)) if (!plan->old_gid_for_new_gid (i, &glyph))
{ {
/* for a missing glyph, use the same fd as the previous /* fonttools retains FDSelect & font dicts for missing glyphs. do the same */
* as an attempt to minimize the number of ranges */ glyph = i;
fd = prev_fd;
} }
else
{
fd = src.get_fd (glyph); fd = src.get_fd (glyph);
}
set->add (fd); set->add (fd);
if (fd != prev_fd) if (fd != prev_fd)