diff --git a/util/Makefile.sources b/util/Makefile.sources index 82936092f..8a45f69b4 100644 --- a/util/Makefile.sources +++ b/util/Makefile.sources @@ -28,7 +28,7 @@ HB_OT_SHAPE_CLOSURE_sources = \ HB_SUBSET_CLI_sources = \ hb-subset.cc \ options.cc \ - options-subset.cc \ options.hh \ + subset-options.hh \ main-font-text.hh \ $(NULL) diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 3e06d16e2..1469ae343 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -28,7 +28,7 @@ #include #include "main-font-text.hh" -#include "hb-subset.h" +#include "subset-options.hh" // XXX Remove eventually const unsigned DEFAULT_FONT_SIZE = FONT_SIZE_NONE; @@ -38,6 +38,7 @@ const unsigned SUBPIXEL_BITS = 0; * Command line interface to the harfbuzz font subsetter. */ + struct subset_consumer_t : subset_options_t { void add_options (option_parser_t *parser) diff --git a/util/meson.build b/util/meson.build index cb724f6cb..3773e68a6 100644 --- a/util/meson.build +++ b/util/meson.build @@ -16,7 +16,6 @@ hb_ot_shape_closure_sources = [ hb_subset_cli_sources = [ 'hb-subset.cc', 'options.cc', - 'options-subset.cc', ] util_deps = [freetype_dep, cairo_dep, cairo_ft_dep, glib_dep] diff --git a/util/options.hh b/util/options.hh index 87678246f..e7a48f2f5 100644 --- a/util/options.hh +++ b/util/options.hh @@ -28,7 +28,6 @@ #define OPTIONS_HH #include "hb.hh" -#include "hb-subset.h" #include #include @@ -622,45 +621,6 @@ struct format_options_t hb_bool_t trace = false; }; -struct subset_options_t -{ - subset_options_t () - : input (hb_subset_input_create_or_fail ()) - {} - ~subset_options_t () - { - hb_subset_input_destroy (input); - } - - void add_options (option_parser_t *parser); - - hb_bool_t* bool_for(hb_subset_flags_t flag) - { - for (unsigned i = 0; i < sizeof(int) * 8; i++) - { - if (1u << i == flag) - return &flags[i]; - } - return &flags[sizeof(int) * 8 - 1]; - } - - hb_subset_input_t * get_input () - { - hb_subset_flags_t flags_set = HB_SUBSET_FLAGS_DEFAULT; - for (unsigned i = 0; i < sizeof(int) * 8; i++) - { - if (flags[i]) - flags_set = (hb_subset_flags_t) (flags_set | (1u << i)); - } - hb_subset_input_set_flags (input, flags_set); - return input; - } - - unsigned num_iterations = 1; - hb_subset_input_t *input = nullptr; - hb_bool_t flags[sizeof(int) * 8] = {0}; -}; - /* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */ #if defined (_MSC_VER) && (_MSC_VER < 1800) diff --git a/util/options-subset.cc b/util/subset-options.hh similarity index 91% rename from util/options-subset.cc rename to util/subset-options.hh index 9c719efaa..b202f1deb 100644 --- a/util/options-subset.cc +++ b/util/subset-options.hh @@ -24,7 +24,50 @@ * Google Author(s): Garret Rieger */ +#ifndef SUBSET_OPTIONS_HH +#define SUBSET_OPTIONS_HH + #include "options.hh" +#include "hb-subset.h" + +struct subset_options_t +{ + subset_options_t () + : input (hb_subset_input_create_or_fail ()) + {} + ~subset_options_t () + { + hb_subset_input_destroy (input); + } + + void add_options (option_parser_t *parser); + + hb_bool_t* bool_for(hb_subset_flags_t flag) + { + for (unsigned i = 0; i < sizeof(int) * 8; i++) + { + if (1u << i == flag) + return &flags[i]; + } + return &flags[sizeof(int) * 8 - 1]; + } + + hb_subset_input_t * get_input () + { + hb_subset_flags_t flags_set = HB_SUBSET_FLAGS_DEFAULT; + for (unsigned i = 0; i < sizeof(int) * 8; i++) + { + if (flags[i]) + flags_set = (hb_subset_flags_t) (flags_set | (1u << i)); + } + hb_subset_input_set_flags (input, flags_set); + return input; + } + + unsigned num_iterations = 1; + hb_subset_input_t *input = nullptr; + hb_bool_t flags[sizeof(int) * 8] = {0}; +}; static gboolean @@ -323,3 +366,5 @@ subset_options_t::add_options (option_parser_t *parser) "Options subsetting", this); } + +#endif