mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-06 22:15:04 +00:00
[subset] Avoid incorrectly dropping cmap for NotoColorEmoji.ttf
NotoColorEmoji.ttf uses two cmap subtables Format 14 | Platform ID 0 | Platform Encoding ID 5 Format 12 | Platform ID 3 | Platform Encoding ID 10 This combination results in the cmap table being dropped during subsetting despite being valid/required.
This commit is contained in:
parent
43016715e1
commit
774725b43a
56 changed files with 46 additions and 1 deletions
|
@ -1225,7 +1225,7 @@ struct cmap
|
|||
else if (_.platformID == 3 && _.encodingID == 10) ms_ucs4 = table;
|
||||
}
|
||||
|
||||
if (unlikely (!unicode_bmp && !ms_bmp)) return_trace (false);
|
||||
if (unlikely (!has_format12 && !unicode_bmp && !ms_bmp)) return_trace (false);
|
||||
if (unlikely (has_format12 && (!unicode_ucs4 && !ms_ucs4))) return_trace (false);
|
||||
|
||||
auto it =
|
||||
|
|
BIN
test/api/fonts/NotoColorEmoji.cmap.38,AE,2049.ttf
Normal file
BIN
test/api/fonts/NotoColorEmoji.cmap.38,AE,2049.ttf
Normal file
Binary file not shown.
BIN
test/api/fonts/NotoColorEmoji.cmap.ttf
Normal file
BIN
test/api/fonts/NotoColorEmoji.cmap.ttf
Normal file
Binary file not shown.
|
@ -133,6 +133,48 @@ test_subset_cmap_empty_tables (void)
|
|||
hb_face_destroy (face_empty);
|
||||
}
|
||||
|
||||
static void
|
||||
test_subset_cmap_noto_color_emoji_noop (void)
|
||||
{
|
||||
hb_face_t *face = hb_test_open_font_file ("fonts/NotoColorEmoji.cmap.ttf");
|
||||
|
||||
hb_set_t *codepoints = hb_set_create ();
|
||||
hb_face_t *face_subset;
|
||||
hb_set_add (codepoints, 0x38);
|
||||
hb_set_add (codepoints, 0x39);
|
||||
hb_set_add (codepoints, 0xAE);
|
||||
hb_set_add (codepoints, 0x2049);
|
||||
hb_set_add (codepoints, 0x20E3);
|
||||
face_subset = hb_subset_test_create_subset (face, hb_subset_test_create_input (codepoints));
|
||||
hb_set_destroy (codepoints);
|
||||
|
||||
hb_subset_test_check (face, face_subset, HB_TAG ('c','m','a','p'));
|
||||
|
||||
hb_face_destroy (face_subset);
|
||||
hb_face_destroy (face);
|
||||
}
|
||||
|
||||
static void
|
||||
test_subset_cmap_noto_color_emoji_non_consecutive_glyphs (void)
|
||||
{
|
||||
hb_face_t *face = hb_test_open_font_file ("fonts/NotoColorEmoji.cmap.ttf");
|
||||
hb_face_t *face_expected = hb_test_open_font_file ("fonts/NotoColorEmoji.cmap.38,AE,2049.ttf");
|
||||
|
||||
hb_set_t *codepoints = hb_set_create ();
|
||||
hb_face_t *face_subset;
|
||||
hb_set_add (codepoints, 0x38);
|
||||
hb_set_add (codepoints, 0xAE);
|
||||
hb_set_add (codepoints, 0x2049);
|
||||
face_subset = hb_subset_test_create_subset (face, hb_subset_test_create_input (codepoints));
|
||||
hb_set_destroy (codepoints);
|
||||
|
||||
hb_subset_test_check (face_expected, face_subset, HB_TAG ('c','m','a','p'));
|
||||
|
||||
hb_face_destroy (face_subset);
|
||||
hb_face_destroy (face_expected);
|
||||
hb_face_destroy (face);
|
||||
}
|
||||
|
||||
// TODO(rsheeter) test cmap to no codepoints
|
||||
|
||||
int
|
||||
|
@ -145,6 +187,8 @@ main (int argc, char **argv)
|
|||
hb_test_add (test_subset_cmap_non_consecutive_glyphs);
|
||||
hb_test_add (test_subset_cmap4_no_exceeding_maximum_codepoint);
|
||||
hb_test_add (test_subset_cmap_empty_tables);
|
||||
hb_test_add (test_subset_cmap_noto_color_emoji_noop);
|
||||
hb_test_add (test_subset_cmap_noto_color_emoji_non_consecutive_glyphs);
|
||||
|
||||
return hb_test_run();
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/subset/data/expected/cmap14/cmap14_font2.default.4E02.otf
Normal file
BIN
test/subset/data/expected/cmap14/cmap14_font2.default.4E02.otf
Normal file
Binary file not shown.
BIN
test/subset/data/expected/cmap14/cmap14_font2.default.4E03.otf
Normal file
BIN
test/subset/data/expected/cmap14/cmap14_font2.default.4E03.otf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/subset/data/expected/cmap14/cmap14_font2.default.4E08.otf
Normal file
BIN
test/subset/data/expected/cmap14/cmap14_font2.default.4E08.otf
Normal file
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/subset/data/expected/cmap14/cmap14_font2.name-ids.4E02.otf
Normal file
BIN
test/subset/data/expected/cmap14/cmap14_font2.name-ids.4E02.otf
Normal file
Binary file not shown.
BIN
test/subset/data/expected/cmap14/cmap14_font2.name-ids.4E03.otf
Normal file
BIN
test/subset/data/expected/cmap14/cmap14_font2.name-ids.4E03.otf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/subset/data/expected/cmap14/cmap14_font2.name-ids.4E08.otf
Normal file
BIN
test/subset/data/expected/cmap14/cmap14_font2.name-ids.4E08.otf
Normal file
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.
BIN
test/subset/data/fonts/cmap14_font2.otf
Normal file
BIN
test/subset/data/fonts/cmap14_font2.otf
Normal file
Binary file not shown.
|
@ -1,5 +1,6 @@
|
|||
FONTS:
|
||||
cmap14_font1.otf
|
||||
cmap14_font2.otf
|
||||
|
||||
PROFILES:
|
||||
default.txt
|
||||
|
|
Loading…
Add table
Reference in a new issue