mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 00:41:09 +01:00
[subset/cff] Speed up for retaingids
This commit is contained in:
1 parent
dff3a936d2
commit
1590754ba8
1 file changed
+12
-8
@@ -68,24 +68,28 @@ hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan,
|
||||
/* use hb_set to determine the subset of font dicts */
|
||||
hb_set_t set;
|
||||
hb_codepoint_t prev_fd = CFF_UNDEF_CODE;
|
||||
for (hb_codepoint_t i = 0; i < subset_num_glyphs; i++)
|
||||
auto it = hb_iter (plan->new_to_old_gid_list);
|
||||
for (hb_codepoint_t gid = 0; gid < subset_num_glyphs; gid++)
|
||||
{
|
||||
hb_codepoint_t glyph;
|
||||
hb_codepoint_t fd;
|
||||
if (!plan->old_gid_for_new_gid (i, &glyph))
|
||||
hb_codepoint_t old_glyph;
|
||||
if (gid == it->first)
|
||||
{
|
||||
old_glyph = it->second;
|
||||
it++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fonttools retains FDSelect & font dicts for missing glyphs. do the same */
|
||||
glyph = i;
|
||||
old_glyph = gid;
|
||||
}
|
||||
fd = src.get_fd (glyph);
|
||||
unsigned fd = src.get_fd (old_glyph);
|
||||
set.add (fd);
|
||||
|
||||
if (fd != prev_fd)
|
||||
{
|
||||
num_ranges++;
|
||||
prev_fd = fd;
|
||||
code_pair_t pair = { fd, i };
|
||||
fdselect_ranges.push (pair);
|
||||
fdselect_ranges.push (code_pair_t { fd, gid });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user