From 04cf6212d72ceffb164b2aaf7315711d4227445f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 30 Aug 2021 18:35:08 -0600 Subject: [PATCH] [util/hb-subset] Fix --version and --help again https://github.com/harfbuzz/harfbuzz/commit/38ad093216d8204df2dce18a112ee43964031357 --- util/hb-subset.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 52993df59..3505f7f54 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -60,6 +60,7 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t {nullptr} }; parser.add_main_group (entries, &face_opts); + parser.add_options (); g_option_context_set_ignore_unknown_options (parser.context, true); g_option_context_set_help_enabled (parser.context, false); @@ -79,9 +80,20 @@ struct subset_main_t : option_parser_t, face_options_t, output_options_t void parse (int argc, char **argv) { - /* Do a preliminary parse to load font-face, such that we can use it - * during main option parsing. */ - parse_face (argc, argv); + bool help = false; + for (auto i = 1; i < argc; i++) + if (!strncmp ("--help", argv[i], 6)) + { + help = true; + break; + } + + if (likely (!help)) + { + /* Do a preliminary parse to load font-face, such that we can use it + * during main option parsing. */ + parse_face (argc, argv); + } add_options (); option_parser_t::parse (&argc, &argv);