diff options
author | Rod Sheeter <rsheeter@google.com> | 2018-02-21 10:34:00 -0800 |
---|---|---|
committer | Rod Sheeter <rsheeter@google.com> | 2018-02-21 10:34:00 -0800 |
commit | 0bd100e144885ed8144cf23e7e106014858a1724 (patch) | |
tree | f12d8b68932114069a137d2f09819a4f1b73b580 /util | |
parent | 7ecca8c0a83a6c71154fcc80887a4f895c0c5a23 (diff) |
[subset] add --hinting flag
Diffstat (limited to 'util')
-rw-r--r-- | util/hb-subset.cc | 6 | ||||
-rw-r--r-- | util/options.cc | 15 | ||||
-rw-r--r-- | util/options.hh | 14 |
3 files changed, 34 insertions, 1 deletions
diff --git a/util/hb-subset.cc b/util/hb-subset.cc index ea657aff..3db62598 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -29,6 +29,7 @@ #include "main-font-text.hh" #include "hb-subset.h" +#include "hb-subset-private.hh" /* * Command line interface to the harfbuzz font subsetter. @@ -37,7 +38,7 @@ struct subset_consumer_t { subset_consumer_t (option_parser_t *parser) - : failed (false), options (parser), font (nullptr), input (nullptr) {} + : failed (false), options (parser), subset_options (parser), font (nullptr), input (nullptr) {} void init (hb_buffer_t *buffer_, const font_options_t *font_opts) @@ -89,6 +90,8 @@ struct subset_consumer_t void finish (const font_options_t *font_opts) { + input->retain_hints = subset_options.hinting; + hb_subset_profile_t *subset_profile = hb_subset_profile_create(); hb_face_t *face = hb_font_get_face (font); @@ -111,6 +114,7 @@ struct subset_consumer_t private: output_options_t options; + subset_options_t subset_options; hb_font_t *font; hb_subset_input_t *input; }; diff --git a/util/options.cc b/util/options.cc index 6d8064b9..aa8a6a96 100644 --- a/util/options.cc +++ b/util/options.cc @@ -986,3 +986,18 @@ format_options_t::serialize_buffer_of_glyphs (hb_buffer_t *buffer, serialize_glyphs (buffer, font, output_format, format_flags, gs); g_string_append_c (gs, '\n'); } + +void +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}, + {nullptr} + }; + parser->add_group (entries, + "subset", + "Subset options:", + "Options subsetting", + this); +} diff --git a/util/options.hh b/util/options.hh index 411165bf..80d32d90 100644 --- a/util/options.hh +++ b/util/options.hh @@ -649,6 +649,20 @@ struct format_options_t : option_group_t hb_bool_t trace; }; +struct subset_options_t : option_group_t +{ + subset_options_t (option_parser_t *parser) + { + hinting = true; + + add_options (parser); + } + + void add_options (option_parser_t *parser); + + hb_bool_t hinting; +}; + /* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */ #if defined (_MSC_VER) && (_MSC_VER < 1800) |