[subset] avoid writing out duplicate extra glyph names in post table
Add check for possible duplicate with other name index
This commit is contained in:
parent
325f26290e
commit
84dc4e85e8
|
@ -79,6 +79,7 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
|
|||
post::accelerator_t _post;
|
||||
_post.init (c->plan->source);
|
||||
|
||||
hb_hashmap_t<hb_bytes_t, unsigned, std::nullptr_t, unsigned, nullptr, (unsigned)-1> glyph_name_to_new_index;
|
||||
for (hb_codepoint_t new_gid = 0; new_gid < num_glyphs; new_gid++)
|
||||
{
|
||||
hb_codepoint_t old_gid = reverse_glyph_map.get (new_gid);
|
||||
|
@ -90,6 +91,9 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
|
|||
else
|
||||
{
|
||||
hb_bytes_t s = _post.find_glyph_name (old_gid);
|
||||
new_index = glyph_name_to_new_index.get (s);
|
||||
if (new_index == (unsigned)-1)
|
||||
{
|
||||
int standard_glyph_index = -1;
|
||||
for (unsigned i = 0; i < format1_names_length; i++)
|
||||
{
|
||||
|
@ -99,6 +103,7 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (standard_glyph_index == -1)
|
||||
{
|
||||
new_index = 258 + i;
|
||||
|
@ -106,6 +111,8 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
|
|||
}
|
||||
else
|
||||
{ new_index = standard_glyph_index; }
|
||||
glyph_name_to_new_index.set (s, new_index);
|
||||
}
|
||||
old_new_index_map.set (old_index, new_index);
|
||||
}
|
||||
old_gid_new_index_map.set (old_gid, new_index);
|
||||
|
|
|
@ -51,6 +51,7 @@ EXTRA_DIST += \
|
|||
expected/variable \
|
||||
expected/glyph_names \
|
||||
expected/math \
|
||||
expected/post \
|
||||
fonts \
|
||||
profiles \
|
||||
$(NULL)
|
||||
|
|
|
@ -43,6 +43,7 @@ TESTS = \
|
|||
tests/variable.tests \
|
||||
tests/glyph_names.tests \
|
||||
tests/math.tests \
|
||||
tests/post.tests \
|
||||
$(NULL)
|
||||
|
||||
# TODO: re-enable once colrv1 subsetting is stabilized.
|
||||
|
|
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.
|
@ -0,0 +1,12 @@
|
|||
FONTS:
|
||||
SreeKrushnadevaraya-Regular.ttf
|
||||
|
||||
PROFILES:
|
||||
default.txt
|
||||
retain-gids.txt
|
||||
glyph-names.txt
|
||||
notdef-outline.txt
|
||||
|
||||
SUBSETS:
|
||||
U+c30,U+c36,U+c40,U+c4d
|
||||
*
|
|
@ -45,6 +45,7 @@ tests = [
|
|||
'cbdt',
|
||||
'variable',
|
||||
'glyph_names',
|
||||
'post',
|
||||
]
|
||||
|
||||
repack_tests = [
|
||||
|
|
Loading…
Reference in New Issue