added hb_subset_input_set_desubroutinize API
authorMichiharu Ariza <ariza@adobe.com>
Fri, 2 Nov 2018 00:25:23 +0000 (17:25 -0700)
committerMichiharu Ariza <ariza@adobe.com>
Fri, 2 Nov 2018 00:25:23 +0000 (17:25 -0700)
hooked up with CFF1 subroutinizer
a renaming

src/hb-subset-cff-common.hh
src/hb-subset-cff1.cc
src/hb-subset-input.cc
src/hb-subset.h
util/hb-subset.cc
util/options.cc

index 6debb85..944d5e9 100644 (file)
@@ -419,7 +419,7 @@ struct ParsedCStr : ParsedValues<ParsedCSOp>
       SUPER::add_op (op, substr);
   }
 
-  inline void addCallOp (OpCode op, const SubByteStr& substr, unsigned int subr_num)
+  inline void add_call_op (OpCode op, const SubByteStr& substr, unsigned int subr_num)
   {
     if (!is_parsed ())
     {
index baac977..414642f 100644 (file)
@@ -392,7 +392,7 @@ struct CFF1CSOpSet_SubrSubset : CFF1CSOpSet<CFF1CSOpSet_SubrSubset, SubrSubsetPa
   {
     SubByteStr    substr = env.substr;
     env.callSubr (subrs, type);
-    param.current_parsed_str->addCallOp (op, substr, env.context.subr_num);
+    param.current_parsed_str->add_call_op (op, substr, env.context.subr_num);
     hb_set_add (closure, env.context.subr_num);
     param.set_current_str (env);
   }
@@ -592,7 +592,7 @@ struct cff_subset_plan {
     num_glyphs = plan->glyphs.len;
     orig_fdcount = acc.fdCount;
     drop_hints = plan->drop_hints;
-    desubroutinize = true; // plan->desubroutinize;
+    desubroutinize = plan->desubroutinize;
 
     /* check whether the subset renumbers any glyph IDs */
     gid_renum = false;
index d59b5ba..01710f2 100644 (file)
@@ -131,3 +131,16 @@ hb_subset_input_get_drop_layout (hb_subset_input_t *subset_input)
 {
   return subset_input->drop_layout;
 }
+
+HB_EXTERN void
+hb_subset_input_set_desubroutinize (hb_subset_input_t *subset_input,
+        hb_bool_t desubroutinize)
+{
+  subset_input->desubroutinize = desubroutinize;
+}
+
+HB_EXTERN hb_bool_t
+hb_subset_input_get_desubroutinize (hb_subset_input_t *subset_input)
+{
+  return subset_input->desubroutinize;
+}
index 8b07a45..ff4dccc 100644 (file)
@@ -66,6 +66,11 @@ hb_subset_input_set_drop_layout (hb_subset_input_t *subset_input,
 HB_EXTERN hb_bool_t
 hb_subset_input_get_drop_layout (hb_subset_input_t *subset_input);
 
+HB_EXTERN void
+hb_subset_input_set_desubroutinize (hb_subset_input_t *subset_input,
+        hb_bool_t desubroutinize);
+HB_EXTERN hb_bool_t
+hb_subset_input_get_desubroutinize (hb_subset_input_t *subset_input);
 
 /* hb_subset() */
 HB_EXTERN hb_face_t *
index 3f0963c..202d15a 100644 (file)
@@ -90,6 +90,7 @@ struct subset_consumer_t
   void finish (const font_options_t *font_opts)
   {
     hb_subset_input_set_drop_hints (input, subset_options.drop_hints);
+    hb_subset_input_set_desubroutinize (input, subset_options.desubroutinize);
 
     hb_face_t *face = hb_font_get_face (font);
 
index e52d63b..e185e24 100644 (file)
@@ -970,7 +970,7 @@ subset_options_t::add_options (option_parser_t *parser)
   GOptionEntry entries[] =
   {
     {"no-hinting", 0, 0, G_OPTION_ARG_NONE,  &this->drop_hints,   "Whether to drop hints",   nullptr},
-    {"desubroutinize", 0, 0, G_OPTION_ARG_NONE,  &this->desubroutinize,   "Remove CFF/CFF2 use of subroutinizes",   nullptr},
+    {"desubroutinize", 0, 0, G_OPTION_ARG_NONE,  &this->desubroutinize,   "Remove CFF/CFF2 use of subroutines",   nullptr},
 
     {nullptr}
   };