diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index c4003dd3ad171e4ab6010f9215739b34b68b23dd..5aa50883e50b9e6cc5db49e99c87ddf403e72d76 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -45,6 +45,7 @@ hb_subset_input_create_or_fail (void) input->unicodes = hb_set_create (); input->glyphs = hb_set_create (); + input->drop_ot_layout = true; return input; } @@ -117,3 +118,19 @@ hb_subset_input_drop_hints (hb_subset_input_t *subset_input) { return &subset_input->drop_hints; } + +/** + * hb_subset_input_drop_ot_layout: + * @subset_input: a subset_input. + * + * If enabled ot layout tables will be dropped as part of + * the subsetting operation. Currently this defaults to + * true. + * + * Since: 1.8.0 + **/ +HB_EXTERN hb_bool_t * +hb_subset_input_drop_ot_layout (hb_subset_input_t *subset_input) +{ + return &subset_input->drop_ot_layout; +} diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 7100efc87c82ee940765e878a1f94dec382410bb..53f83ee8c93607fe5d49a3176f82adffcdbd4a73 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -131,6 +131,7 @@ hb_subset_plan_create (hb_face_t *face, hb_subset_plan_t *plan = hb_object_create (); plan->drop_hints = input->drop_hints; + plan->drop_ot_layout = input->drop_ot_layout; plan->unicodes = hb_set_create(); plan->glyphs.init(); plan->source = hb_face_reference (face); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index c9904af8e401b31815dc57d1dc2ec17e21843259..f4b261df0d0e7fa78590844988afae95c6166bf9 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -41,6 +41,7 @@ struct hb_subset_plan_t ASSERT_POD (); hb_bool_t drop_hints; + hb_bool_t drop_ot_layout; // For each cp that we'd like to retain maps to the corresponding gid. hb_set_t *unicodes; diff --git a/src/hb-subset-private.hh b/src/hb-subset-private.hh index 5fa72527671bc3f81364481d714cd1b06eb1241a..6b2b207fff67113b40b098c8b618d7ceebeab4ce 100644 --- a/src/hb-subset-private.hh +++ b/src/hb-subset-private.hh @@ -44,6 +44,7 @@ struct hb_subset_input_t { hb_set_t *glyphs; hb_bool_t drop_hints; + hb_bool_t drop_ot_layout; /* TODO * * features diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 6d388e29a2681f9390a9f9158c00da03cc3003b0..906327b8a0e1e9c69a51c4bd9ac5a85a153f68ad 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -302,10 +302,11 @@ _should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag) case HB_TAG ('h', 'd', 'm', 'x'): /* hint table, fallthrough */ case HB_TAG ('V', 'D', 'M', 'X'): /* hint table, fallthrough */ return plan->drop_hints; - // Drop Layout Tables until subsetting is supported. + // Drop Layout Tables if requested. case HB_TAG ('G', 'D', 'E', 'F'): /* temporary */ case HB_TAG ('G', 'P', 'O', 'S'): /* temporary */ case HB_TAG ('G', 'S', 'U', 'B'): /* temporary */ + return plan->drop_ot_layout; // Drop these tables below by default, list pulled // from fontTools: case HB_TAG ('B', 'A', 'S', 'E'): diff --git a/src/hb-subset.h b/src/hb-subset.h index 409581c76f659f51fb80f51567c062b9d9926376..f6d2ae0a01b267cd1ad851be4ed9305b7b4168b8 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -71,6 +71,9 @@ hb_subset_input_glyph_set (hb_subset_input_t *subset_input); HB_EXTERN hb_bool_t * hb_subset_input_drop_hints (hb_subset_input_t *subset_input); +HB_EXTERN hb_bool_t * +hb_subset_input_drop_ot_layout (hb_subset_input_t *subset_input); + /* hb_subset() */ HB_EXTERN hb_face_t * hb_subset (hb_face_t *source,