diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index b9e299add..0f653ff33 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -191,6 +191,7 @@ hb_subset_plan_create (hb_face_t *face, plan->gids_to_retain_sorted.init(); plan->source = hb_face_reference (face); plan->dest = hb_subset_face_create (); + plan->drop_hints = input->drop_hints; _populate_codepoints (input->unicodes, plan->codepoints); _populate_gids_to_retain (face, diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index a74152858..d1b66b44d 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -37,6 +37,8 @@ struct hb_subset_plan_t { hb_object_header_t header; ASSERT_POD (); + hb_bool_t drop_hints; + // TODO(Q1) actual map, drop this crap // Look at me ma, I'm a poor mans map codepoint : new gid // codepoints is sorted and aligned with gids_to_retain. diff --git a/src/hb-subset-private.hh b/src/hb-subset-private.hh index 55ac6f126..5fa725276 100644 --- a/src/hb-subset-private.hh +++ b/src/hb-subset-private.hh @@ -43,7 +43,7 @@ struct hb_subset_input_t { hb_set_t *unicodes; hb_set_t *glyphs; - hb_bool_t retain_hints; + hb_bool_t drop_hints; /* TODO * * features diff --git a/src/hb-subset.cc b/src/hb-subset.cc index a4794f18c..b46b07fcc 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -268,9 +268,16 @@ _subset_table (hb_subset_plan_t *plan, } static bool -_should_drop_table(hb_tag_t tag) +_should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag) { switch (tag) { + case HB_TAG ('c', 'v', 'a', 'r'): /* hint table, fallthrough */ + case HB_TAG ('c', 'v', 't', ' '): /* hint table, fallthrough */ + case HB_TAG ('f', 'p', 'g', 'm'): /* hint table, fallthrough */ + case HB_TAG ('p', 'r', 'e', 'p'): /* hint table, fallthrough */ + case HB_TAG ('h', 'd', 'm', 'x'): /* hint table, fallthrough */ + case HB_TAG ('V', 'D', 'M', 'X'): /* hint table, fallthrough */ + return plan->drop_hints; case HB_TAG ('G', 'D', 'E', 'F'): /* temporary */ case HB_TAG ('G', 'P', 'O', 'S'): /* temporary */ case HB_TAG ('G', 'S', 'U', 'B'): /* temporary */ @@ -307,7 +314,7 @@ hb_subset (hb_face_t *source, for (unsigned int i = 0; i < count; i++) { hb_tag_t tag = table_tags[i]; - if (_should_drop_table(tag)) + if (_should_drop_table(plan, tag)) { DEBUG_MSG(SUBSET, nullptr, "drop %c%c%c%c", HB_UNTAG(tag)); continue; diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 3db625985..20617554c 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -90,7 +90,7 @@ struct subset_consumer_t void finish (const font_options_t *font_opts) { - input->retain_hints = subset_options.hinting; + input->drop_hints = subset_options.drop_hints; hb_subset_profile_t *subset_profile = hb_subset_profile_create(); hb_face_t *face = hb_font_get_face (font); diff --git a/util/options.cc b/util/options.cc index aa8a6a962..7571fe840 100644 --- a/util/options.cc +++ b/util/options.cc @@ -992,7 +992,7 @@ subset_options_t::add_options (option_parser_t *parser) { GOptionEntry entries[] = { - {"hinting", 0, 0, G_OPTION_ARG_NONE, &this->hinting, "Whether to retain or drop hints", nullptr}, + {"no-hinting", 0, 0, G_OPTION_ARG_NONE, &this->drop_hints, "Whether to drop hints", nullptr}, {nullptr} }; parser->add_group (entries, diff --git a/util/options.hh b/util/options.hh index 80d32d902..cce0eb163 100644 --- a/util/options.hh +++ b/util/options.hh @@ -653,14 +653,14 @@ struct subset_options_t : option_group_t { subset_options_t (option_parser_t *parser) { - hinting = true; + drop_hints = false; add_options (parser); } void add_options (option_parser_t *parser); - hb_bool_t hinting; + hb_bool_t drop_hints; }; /* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */