From a5673da9be70f2ba0ff79aab4bd9a4480cb0223e Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Thu, 7 Jun 2018 14:23:03 -0700 Subject: [PATCH] [subset] Add drop_ot_layout setting to subset input. --- src/hb-subset-input.cc | 17 +++++++++++++++++ src/hb-subset-plan.cc | 1 + src/hb-subset-plan.hh | 1 + src/hb-subset-private.hh | 1 + src/hb-subset.cc | 3 ++- src/hb-subset.h | 3 +++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index c4003dd3a..5aa50883e 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 7100efc87..53f83ee8c 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 c9904af8e..f4b261df0 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 5fa725276..6b2b207ff 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 6d388e29a..906327b8a 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 409581c76..f6d2ae0a0 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,