diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index ffa767dab..9e9679f8b 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -863,6 +863,7 @@ struct cmap if (unlikely (!CmapSubtableFormat4::create_sub_table_plan (plan, &cmap_plan->format4_segments))) return false; + if (!find_subtable (12)) return true; return CmapSubtableFormat12::create_sub_table_plan (plan, &cmap_plan->format12_groups); } @@ -881,8 +882,7 @@ struct cmap table->version = 0; - if (unlikely (!table->encodingRecord.serialize (&c, /* numTables */ 3))) - return false; + if (unlikely (!table->encodingRecord.serialize (&c, /* numTables */ cmap_subset_plan.format12_groups ? 3 : 2))) return false; // TODO(grieger): Convert the below to a for loop @@ -897,9 +897,12 @@ struct cmap format4_plat3_rec.encodingID = 1; // Unicode BMP // Format 12 Encoding Record - EncodingRecord &format12_rec = table->encodingRecord[2]; - format12_rec.platformID = 3; // Windows - format12_rec.encodingID = 10; // Unicode UCS-4 + if (cmap_subset_plan.format12_groups) + { + EncodingRecord &format12_rec = table->encodingRecord[2]; + format12_rec.platformID = 3; // Windows + format12_rec.encodingID = 10; // Unicode UCS-4 + } // Write out format 4 sub table { @@ -913,7 +916,9 @@ struct cmap } // Write out format 12 sub table. + if (cmap_subset_plan.format12_groups) { + EncodingRecord &format12_rec = table->encodingRecord[2]; CmapSubtable &subtable = format12_rec.subtable.serialize (&c, table); subtable.u.format = 12; @@ -1154,6 +1159,18 @@ struct cmap return &(this+result.subtable); } + bool find_subtable (unsigned format) const + { + auto it = + + hb_iter (encodingRecord) + | hb_map (&EncodingRecord::subtable) + | hb_map (hb_add (this)) + | hb_filter ([&] (const CmapSubtable& _) { return _.u.format == format; }) + ; + + return it.len (); + } + public: bool sanitize (hb_sanitize_context_t *c) const diff --git a/src/hb-ot-stat-table.hh b/src/hb-ot-stat-table.hh index f12b51ce3..03604a0ad 100644 --- a/src/hb-ot-stat-table.hh +++ b/src/hb-ot-stat-table.hh @@ -289,7 +289,7 @@ struct STAT ; + get_axis_value_offsets () - | hb_map (hb_add (this)) + | hb_map (hb_add (&(this + offsetToAxisValueOffsets))) | hb_map (&AxisValue::get_value_name_id) | hb_sink (nameids_to_retain) ; diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 8bd6058d0..098f13e7b 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -45,6 +45,7 @@ hb_subset_input_create_or_fail () input->unicodes = hb_set_create (); input->glyphs = hb_set_create (); input->name_ids = hb_set_create (); + hb_set_add_range (input->name_ids, 0, 6); input->drop_tables = hb_set_create (); input->drop_hints = false; input->desubroutinize = false; diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index c0aee1a2d..7c1ed872c 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -234,12 +234,8 @@ hb_subset_plan_create (hb_face_t *face, plan->retain_gids = input->retain_gids; plan->unicodes = hb_set_create (); plan->name_ids = hb_set_reference (input->name_ids); - plan->drop_tables = hb_set_reference (input->drop_tables); - - /* TODO Clean this up... */ - if (hb_set_is_empty (plan->name_ids)) - hb_set_add_range (plan->name_ids, 0, 0x7FFF); _nameid_closure (face, plan->name_ids); + plan->drop_tables = hb_set_reference (input->drop_tables); plan->source = hb_face_reference (face); plan->dest = hb_face_builder_create (); diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h index 8f32aee67..cee1410c4 100644 --- a/test/api/hb-subset-test.h +++ b/test/api/hb-subset-test.h @@ -70,7 +70,7 @@ hb_subset_test_create_input_from_nameids (const hb_set_t *name_ids) { hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_set_t * input_name_ids = hb_subset_input_nameid_set (input); - hb_set_union (input_name_ids, name_ids); + hb_set_set (input_name_ids, name_ids); return input; } diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61,62,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61,62,63.ttf new file mode 100644 index 000000000..efe5bcb4c Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61,63.ttf new file mode 100644 index 000000000..8e1224178 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61.ttf new file mode 100644 index 000000000..bd802a57e Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.61.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.default.62.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.62.ttf new file mode 100644 index 000000000..9fbebb5d4 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.62.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.default.63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.63.ttf new file mode 100644 index 000000000..73917418a Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.default.63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61,62,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61,62,63.ttf new file mode 100644 index 000000000..05d83d8f9 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61,63.ttf new file mode 100644 index 000000000..f47887e94 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61.ttf new file mode 100644 index 000000000..bfa9267b9 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.61.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.62.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.62.ttf new file mode 100644 index 000000000..8c121581a Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.62.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.63.ttf new file mode 100644 index 000000000..6a47c39d6 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints-retain-gids.63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61,62,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61,62,63.ttf new file mode 100644 index 000000000..36a4b9a45 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61,63.ttf new file mode 100644 index 000000000..251794c25 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61.ttf new file mode 100644 index 000000000..9e65c8385 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.61.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.62.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.62.ttf new file mode 100644 index 000000000..ada1649af Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.62.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.63.ttf new file mode 100644 index 000000000..6b0dc6c3d Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.drop-hints.63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61,62,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61,62,63.ttf new file mode 100644 index 000000000..90e49bef6 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61,63.ttf new file mode 100644 index 000000000..5277d1508 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61.ttf new file mode 100644 index 000000000..de06660d0 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.61.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.62.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.62.ttf new file mode 100644 index 000000000..effad7b68 Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.62.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.63.ttf new file mode 100644 index 000000000..21c8205cb Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.name-ids.63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61,62,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61,62,63.ttf new file mode 100644 index 000000000..3c0f4cd5b Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61,62,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61,63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61,63.ttf new file mode 100644 index 000000000..a5ce9e05d Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61,63.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61.ttf new file mode 100644 index 000000000..1b843357d Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.61.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.62.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.62.ttf new file mode 100644 index 000000000..97eaa26ad Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.62.ttf differ diff --git a/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.63.ttf b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.63.ttf new file mode 100644 index 000000000..f42edb71f Binary files /dev/null and b/test/subset/data/expected/basics/Comfortaa-Regular-new.retain-gids.63.ttf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf index 1bd287d3d..f0ea3ca97 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.61,62,63.otf index 328c6ee88..7ea55a27f 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf index 4602847a1..07b9aa219 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.1FC,21,41,20,62,63.otf index ca546541b..8ce5fdbf5 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.61,62,63.otf index 0f52e66b2..a1487ff65 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf index 170c15109..9168bc869 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf index 18a9bcc4c..cf0fbf601 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf index edd389b41..8ab8294cc 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf index 65fa1daea..de475e60a 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.1FC,21,41,20,62,63.otf index 87c8f00f3..7cca4891a 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.61,62,63.otf index f381f1389..06f0c1f27 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf index f32a1fcfa..556861c95 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.1FC,21,41,20,62,63.otf index 604e14045..cf3228d23 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.61,62,63.otf index 419dfa010..1bafff123 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.D7,D8,D9,DA,DE.otf index 805532868..34303e790 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.1FC,21,41,20,62,63.otf index 9a5c09a17..5177c149e 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.61,62,63.otf index f5b4ebdf4..c70b82a1b 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.D7,D8,D9,DA,DE.otf index 57f9a8d5e..b14b3eb67 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf index 53109e24b..112dec704 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf index dd908c242..929c4e2d1 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf index 5422d3228..939a565a9 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.1FC,21,41,20,62,63.otf index 2caee794c..02529e3ac 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.1FC,21,41,20,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.1FC,21,41,20,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.61,62,63.otf index b428a7b12..76e5cc592 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.61,62,63.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.61,62,63.otf differ diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.D7,D8,D9,DA,DE.otf index ccb442822..a1178c2da 100644 Binary files a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.D7,D8,D9,DA,DE.otf and b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.D7,D8,D9,DA,DE.otf differ diff --git a/test/subset/data/expected/full-font/Roboto-Regular.default.1FC,21,41,20,62,63.ttf b/test/subset/data/expected/full-font/Roboto-Regular.default.1FC,21,41,20,62,63.ttf index 93efe6553..e8b7b375c 100644 Binary files a/test/subset/data/expected/full-font/Roboto-Regular.default.1FC,21,41,20,62,63.ttf and b/test/subset/data/expected/full-font/Roboto-Regular.default.1FC,21,41,20,62,63.ttf differ diff --git a/test/subset/data/expected/full-font/Roboto-Regular.default.61,62,63.ttf b/test/subset/data/expected/full-font/Roboto-Regular.default.61,62,63.ttf index d4d26d7ea..912e1fb24 100644 Binary files a/test/subset/data/expected/full-font/Roboto-Regular.default.61,62,63.ttf and b/test/subset/data/expected/full-font/Roboto-Regular.default.61,62,63.ttf differ diff --git a/test/subset/data/expected/full-font/Roboto-Regular.default.D7,D8,D9,DA,DE.ttf b/test/subset/data/expected/full-font/Roboto-Regular.default.D7,D8,D9,DA,DE.ttf index 7e271f22b..6f19df6e2 100644 Binary files a/test/subset/data/expected/full-font/Roboto-Regular.default.D7,D8,D9,DA,DE.ttf and b/test/subset/data/expected/full-font/Roboto-Regular.default.D7,D8,D9,DA,DE.ttf differ diff --git a/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.1FC,21,41,20,62,63.ttf b/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.1FC,21,41,20,62,63.ttf index 99b91bd31..9ea42ab09 100644 Binary files a/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.1FC,21,41,20,62,63.ttf and b/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.1FC,21,41,20,62,63.ttf differ diff --git a/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.61,62,63.ttf b/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.61,62,63.ttf index eb94906a8..4d125939c 100644 Binary files a/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.61,62,63.ttf and b/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.61,62,63.ttf differ diff --git a/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.D7,D8,D9,DA,DE.ttf b/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.D7,D8,D9,DA,DE.ttf index ff361baef..281b47523 100644 Binary files a/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.D7,D8,D9,DA,DE.ttf and b/test/subset/data/expected/full-font/Roboto-Regular.drop-hints.D7,D8,D9,DA,DE.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,3048,304A,304B.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,3048,304A,304B.ttf index 33989996e..6770dacab 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,3048,304A,304B.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,3048,304A,304B.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,73E0,5EA6,8F38.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,73E0,5EA6,8F38.ttf index 66b98a6d1..0c662199c 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,73E0,5EA6,8F38.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.default.3042,3044,3046,73E0,5EA6,8F38.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.default.61,63,65,6B.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.default.61,63,65,6B.ttf index 22d1bb309..4a5a6f8ab 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.default.61,63,65,6B.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.default.61,63,65,6B.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.ttf index 28043592e..465ce3479 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E.ttf index 333ca516d..28f3c3717 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.default.660E.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,3048,304A,304B.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,3048,304A,304B.ttf index c84b20cba..1bebda7f2 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,3048,304A,304B.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,3048,304A,304B.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.ttf index e757b9e34..a43998d1b 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.61,63,65,6B.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.61,63,65,6B.ttf index e869ff1fa..34c7788b4 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.61,63,65,6B.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.61,63,65,6B.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.ttf index ed4ed4c10..92ec10b57 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.ttf differ diff --git a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E.ttf b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E.ttf index cb502388e..b9bb53974 100644 Binary files a/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E.ttf and b/test/subset/data/expected/japanese/Mplus1p-Regular.drop-hints.660E.ttf differ diff --git a/test/subset/data/fonts/Comfortaa-Regular-new.ttf b/test/subset/data/fonts/Comfortaa-Regular-new.ttf new file mode 100644 index 000000000..4965fbe39 Binary files /dev/null and b/test/subset/data/fonts/Comfortaa-Regular-new.ttf differ diff --git a/test/subset/data/tests/basics.tests b/test/subset/data/tests/basics.tests index 794510d87..c310722b0 100644 --- a/test/subset/data/tests/basics.tests +++ b/test/subset/data/tests/basics.tests @@ -1,5 +1,6 @@ FONTS: Roboto-Regular.abc.ttf +Comfortaa-Regular-new.ttf PROFILES: default.txt diff --git a/test/subset/generate-expected-outputs.py b/test/subset/generate-expected-outputs.py index 804ed7170..6c65627e3 100755 --- a/test/subset/generate-expected-outputs.py +++ b/test/subset/generate-expected-outputs.py @@ -20,11 +20,10 @@ def usage(): def generate_expected_output(input_file, unicodes, profile_flags, output_path): args = ["fonttools", "subset", input_file] args.extend(["--notdef-outline", - "--name-IDs=*", "--name-languages=*", "--name-legacy", - "--drop-tables+=DSIG,GPOS,GSUB,GDEF", "--layout-features=*", + "--drop-tables+=DSIG,GPOS,GSUB,GDEF,gvar,avar,MVAR,HVAR", "--unicodes=%s" % unicodes, "--output-file=%s" % output_path]) args.extend(profile_flags) diff --git a/test/subset/run-tests.py b/test/subset/run-tests.py index 0a1bb1076..7bc8e3aa7 100755 --- a/test/subset/run-tests.py +++ b/test/subset/run-tests.py @@ -66,7 +66,8 @@ def run_test(test, should_check_ots): cli_args = [hb_subset, "--font-file=" + test.font_path, "--output-file=" + out_file, - "--unicodes=%s" % test.unicodes ()] + "--unicodes=%s" % test.unicodes (), + "--drop-tables+=DSIG,GPOS,GSUB,GDEF,gvar,avar,MVAR,HVAR"] cli_args.extend (test.get_profile_flags ()) print (' '.join (cli_args)) _, return_code = cmd (cli_args) diff --git a/util/options-subset.cc b/util/options-subset.cc index 8ce194604..f5c2229e1 100644 --- a/util/options-subset.cc +++ b/util/options-subset.cc @@ -29,7 +29,7 @@ #include "hb-subset-input.hh" static gboolean -parse_nameids (const char *name G_GNUC_UNUSED, +parse_nameids (const char *name, const char *arg, gpointer data, GError **error G_GNUC_UNUSED) @@ -37,7 +37,19 @@ parse_nameids (const char *name G_GNUC_UNUSED, subset_options_t *subset_opts = (subset_options_t *) data; hb_set_t *name_ids = subset_opts->input->name_ids; - hb_set_clear (name_ids); + char last_name_char = name[strlen (name) - 1]; + + if (last_name_char != '+' && last_name_char != '-') + hb_set_clear (name_ids); + + if (0 == strcmp (arg, "*")) + { + if (last_name_char == '-') + hb_set_del_range (name_ids, 0, 0x7FFF); + else + hb_set_add_range (name_ids, 0, 0x7FFF); + return true; + } char *s = (char *) arg; char *p; @@ -59,7 +71,12 @@ parse_nameids (const char *name G_GNUC_UNUSED, return false; } - hb_set_add (name_ids, u); + if (last_name_char != '-') + { + hb_set_add (name_ids, u); + } else { + hb_set_del (name_ids, u); + } s = p; }