diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 71474845d..0da567189 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -116,6 +116,29 @@ struct NameRecord return (p == 0 || (p == 3 && (e == 0 || e == 1 || e == 10))); } + + static int cmp (const void *pa, const void *pb) + { + const NameRecord *a = (const NameRecord *)pa; + const NameRecord *b = (const NameRecord *)pb; + + if (a->platformID != b->platformID) + return a->platformID < b->platformID ? -1 : +1; + + if (a->encodingID != b->encodingID) + return a->encodingID < b->encodingID ? -1 : +1; + + if (a->languageID != b->languageID) + return a->languageID < b->languageID ? -1 : +1; + + if (a->nameID != b->nameID) + return a->nameID < b->nameID ? -1 : +1; + + if (a->length != b->length) + return a->length < b->length ? -1 : +1; + + return 0; + } bool sanitize (hb_sanitize_context_t *c, const void *base) const { @@ -200,7 +223,19 @@ struct name const void *dst_string_pool = &(this + this->stringOffset); - c->copy_all (it, src_string_pool, dst_string_pool); + NameRecord *name_records = (NameRecord *) calloc (it.len (), NameRecord::static_size); + hb_array_t records (name_records, it.len ()); + + for (const NameRecord& record : it) + { + memcpy (name_records, &record, NameRecord::static_size); + name_records++; + } + + records.qsort (); + + c->copy_all (records, src_string_pool, dst_string_pool); + free (records.arrayZ); if (unlikely (c->ran_out_of_room)) return_trace (false); diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61,62,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61,62,63.ttf new file mode 100644 index 000000000..dbed582fb Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61,63.ttf new file mode 100644 index 000000000..5913420e3 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61.ttf new file mode 100644 index 000000000..3635f68be Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.61.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.62.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.62.ttf new file mode 100644 index 000000000..91fcad84a Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.62.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.63.ttf new file mode 100644 index 000000000..737cbdc7e Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.retain-all-codepoint.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.retain-all-codepoint.ttf new file mode 100644 index 000000000..9744bc31d Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.default.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61,62,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61,62,63.ttf new file mode 100644 index 000000000..bf8264b44 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61,63.ttf new file mode 100644 index 000000000..c64172a76 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61.ttf new file mode 100644 index 000000000..9b261449d Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.61.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.62.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.62.ttf new file mode 100644 index 000000000..d737cd79b Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.62.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.63.ttf new file mode 100644 index 000000000..5e4d49477 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.retain-all-codepoint.ttf new file mode 100644 index 000000000..892ccb8ea Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints-retain-gids.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61,62,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61,62,63.ttf new file mode 100644 index 000000000..bf8264b44 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61,63.ttf new file mode 100644 index 000000000..bc54940a3 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61.ttf new file mode 100644 index 000000000..9b261449d Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.61.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.62.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.62.ttf new file mode 100644 index 000000000..32cf9f7da Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.62.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.63.ttf new file mode 100644 index 000000000..776e758f0 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.retain-all-codepoint.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.retain-all-codepoint.ttf new file mode 100644 index 000000000..892ccb8ea Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.drop-hints.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61,62,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61,62,63.ttf new file mode 100644 index 000000000..a7af97390 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61,63.ttf new file mode 100644 index 000000000..ac780dbb9 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61.ttf new file mode 100644 index 000000000..c4321d1bc Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.61.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.62.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.62.ttf new file mode 100644 index 000000000..4c553ca79 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.62.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.63.ttf new file mode 100644 index 000000000..5234b742e Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.retain-all-codepoint.ttf new file mode 100644 index 000000000..9d225419f Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-ids.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61,62,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61,62,63.ttf new file mode 100644 index 000000000..9bb2a9d1f Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61,63.ttf new file mode 100644 index 000000000..7373aa3be Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61.ttf new file mode 100644 index 000000000..26fe19eab Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.61.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.62.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.62.ttf new file mode 100644 index 000000000..02cd27022 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.62.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.63.ttf new file mode 100644 index 000000000..64a892e43 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.retain-all-codepoint.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.retain-all-codepoint.ttf new file mode 100644 index 000000000..d5d423810 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-languages.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61,62,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61,62,63.ttf new file mode 100644 index 000000000..dbed582fb Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61,63.ttf new file mode 100644 index 000000000..5913420e3 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61.ttf new file mode 100644 index 000000000..3635f68be Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.61.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.62.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.62.ttf new file mode 100644 index 000000000..91fcad84a Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.62.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.63.ttf new file mode 100644 index 000000000..737cbdc7e Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.retain-all-codepoint.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.retain-all-codepoint.ttf new file mode 100644 index 000000000..9744bc31d Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.name-legacy.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61,62,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61,62,63.ttf new file mode 100644 index 000000000..dbed582fb Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61,63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61,63.ttf new file mode 100644 index 000000000..47e72c6a3 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61,63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61.ttf new file mode 100644 index 000000000..3635f68be Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.61.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.62.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.62.ttf new file mode 100644 index 000000000..57f7ec769 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.62.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.63.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.63.ttf new file mode 100644 index 000000000..d0426a0d5 Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.63.ttf differ diff --git a/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.retain-all-codepoint.ttf b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.retain-all-codepoint.ttf new file mode 100644 index 000000000..9744bc31d Binary files /dev/null and b/test/subset/data/expected/basics/NanumMyeongjo-Regular-subset.retain-gids.retain-all-codepoint.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.default.25771.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.default.25771.ttf index e7fe616f1..1dcfeeccd 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.default.25771.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.default.25771.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.25771.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.25771.ttf index 4670bf0c5..5bdc97b3c 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.25771.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.25771.ttf differ diff --git a/test/subset/data/fonts/NanumMyeongjo-Regular-subset.ttf b/test/subset/data/fonts/NanumMyeongjo-Regular-subset.ttf new file mode 100644 index 000000000..73b395e7c Binary files /dev/null and b/test/subset/data/fonts/NanumMyeongjo-Regular-subset.ttf differ diff --git a/test/subset/data/tests/basics.tests b/test/subset/data/tests/basics.tests index 738c2b3e6..6dd819b21 100644 --- a/test/subset/data/tests/basics.tests +++ b/test/subset/data/tests/basics.tests @@ -1,6 +1,7 @@ FONTS: Roboto-Regular.abc.ttf Comfortaa-Regular-new.ttf +NanumMyeongjo-Regular-subset.ttf PROFILES: default.txt