mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-04 21:15:06 +00:00
[subset] bug fix in post table
insert retain-gid holes when retain-gids is enabled
This commit is contained in:
parent
cdbd966e96
commit
634778efc0
27 changed files with 20 additions and 6 deletions
|
@ -84,9 +84,9 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
|
|||
old_gid_new_index_map.alloc (num_glyphs);
|
||||
glyph_name_to_new_index.alloc (num_glyphs);
|
||||
|
||||
for (hb_codepoint_t new_gid = 0; new_gid < num_glyphs; new_gid++)
|
||||
for (auto _ : c->plan->new_to_old_gid_list)
|
||||
{
|
||||
hb_codepoint_t old_gid = reverse_glyph_map.get (new_gid);
|
||||
hb_codepoint_t old_gid = _.second;
|
||||
unsigned old_index = glyphNameIndex[old_gid];
|
||||
|
||||
unsigned new_index;
|
||||
|
@ -125,13 +125,22 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
|
|||
old_gid_new_index_map.set (old_gid, new_index);
|
||||
}
|
||||
|
||||
if (old_gid_new_index_map.in_error())
|
||||
return_trace (false);
|
||||
|
||||
auto index_iter =
|
||||
+ hb_range (num_glyphs)
|
||||
| hb_map (reverse_glyph_map)
|
||||
| hb_map_retains_sorting ([&](hb_codepoint_t old_gid)
|
||||
| hb_map_retains_sorting ([&](hb_codepoint_t new_gid)
|
||||
{
|
||||
unsigned new_index = old_gid_new_index_map.get (old_gid);
|
||||
return hb_pair_t<unsigned, unsigned> (old_gid, new_index);
|
||||
hb_codepoint_t *old_gid;
|
||||
/* use 0 for retain-gid holes, which refers to the name .notdef,
|
||||
* as the glyphNameIndex entry for that glyph ID."*/
|
||||
unsigned new_index = 0;
|
||||
if (reverse_glyph_map.has (new_gid, &old_gid)) {
|
||||
new_index = old_gid_new_index_map.get (*old_gid);
|
||||
return hb_pair_t<unsigned, unsigned> (*old_gid, new_index);
|
||||
}
|
||||
return hb_pair_t<unsigned, unsigned> (new_gid, new_index);
|
||||
})
|
||||
;
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
test/subset/data/profiles/retain-gids-glyph-names.txt
Normal file
2
test/subset/data/profiles/retain-gids-glyph-names.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
--glyph-names
|
||||
--retain-gids
|
|
@ -17,6 +17,7 @@ layout-features.txt
|
|||
keep-all-layout-features.txt
|
||||
no-prune-unicode-ranges.txt
|
||||
glyph-names.txt
|
||||
retain-gids-glyph-names.txt
|
||||
|
||||
SUBSETS:
|
||||
abc
|
||||
|
|
|
@ -3,6 +3,7 @@ Ubuntu-Regular.ttf
|
|||
|
||||
PROFILES:
|
||||
glyph-names.txt
|
||||
retain-gids-glyph-names.txt
|
||||
|
||||
SUBSETS:
|
||||
U+0x0,U+0x8,U+0x9,U+0x1d,U+0x20,U+0xb7
|
||||
|
|
|
@ -6,6 +6,7 @@ default.txt
|
|||
retain-gids.txt
|
||||
glyph-names.txt
|
||||
notdef-outline.txt
|
||||
retain-gids-glyph-names.txt
|
||||
|
||||
SUBSETS:
|
||||
U+c30,U+c36,U+c40,U+c4d
|
||||
|
|
Loading…
Add table
Reference in a new issue