From 490d52f908aaa4722e71a4a682de20e94d89ad00 Mon Sep 17 00:00:00 2001
From: Garret Rieger <grieger@google.com>
Date: Mon, 28 Jan 2019 17:43:42 -0800
Subject: [PATCH] [subset] Add retain-gids option to hb-subset executable.

---
 util/hb-subset.cc | 1 +
 util/options.cc   | 1 +
 util/options.hh   | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/util/hb-subset.cc b/util/hb-subset.cc
index b7d9eb98e..33e584b75 100644
--- a/util/hb-subset.cc
+++ b/util/hb-subset.cc
@@ -91,6 +91,7 @@ struct subset_consumer_t
   {
     hb_subset_input_set_drop_layout (input, !subset_options.keep_layout);
     hb_subset_input_set_drop_hints (input, subset_options.drop_hints);
+    hb_subset_input_set_retain_gids (input, subset_options.retain_gids);
     hb_subset_input_set_desubroutinize (input, subset_options.desubroutinize);
 
     hb_face_t *face = hb_font_get_face (font);
diff --git a/util/options.cc b/util/options.cc
index 04ddcf6e5..b315c6a75 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -977,6 +977,7 @@ subset_options_t::add_options (option_parser_t *parser)
   {
     {"layout", 0, 0, G_OPTION_ARG_NONE,  &this->keep_layout,   "Keep OpenType Layout tables",   nullptr},
     {"no-hinting", 0, 0, G_OPTION_ARG_NONE,  &this->drop_hints,   "Whether to drop hints",   nullptr},
+    {"retain-gids", 0, 0, G_OPTION_ARG_NONE,  &this->retain_gids,   "If set don't renumber glyph ids in the subset.",   nullptr},
     {"desubroutinize", 0, 0, G_OPTION_ARG_NONE,  &this->desubroutinize,   "Remove CFF/CFF2 use of subroutines",   nullptr},
 
     {nullptr}
diff --git a/util/options.hh b/util/options.hh
index e8462581d..84139f55c 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -675,6 +675,7 @@ struct subset_options_t : option_group_t
   {
     keep_layout = false;
     drop_hints = false;
+    retain_gids = false;
     desubroutinize = false;
 
     add_options (parser);
@@ -684,6 +685,7 @@ struct subset_options_t : option_group_t
 
   hb_bool_t keep_layout;
   hb_bool_t drop_hints;
+  hb_bool_t retain_gids;
   hb_bool_t desubroutinize;
 };