Merge branch 'master' into cff-retain-gids
diff --git a/src/hb-subset-cff-common.cc b/src/hb-subset-cff-common.cc
index 3e617d5..46821fe 100644
--- a/src/hb-subset-cff-common.cc
+++ b/src/hb-subset-cff-common.cc
@@ -43,7 +43,7 @@
  **/
 
 bool
-hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs,
+hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan,
 			    unsigned int fdCount,
 			    const FDSelect &src, /* IN */
 			    unsigned int &subset_fd_count /* OUT */,
@@ -57,7 +57,7 @@
   subset_fdselect_format = 0;
   unsigned int  num_ranges = 0;
 
-  unsigned int subset_num_glyphs = glyphs.length;
+  unsigned int subset_num_glyphs = plan->num_output_glyphs ();
   if (subset_num_glyphs == 0)
     return true;
 
@@ -66,10 +66,21 @@
     hb_set_t  *set = hb_set_create ();
     if (set == &Null (hb_set_t))
       return false;
-    hb_codepoint_t  prev_fd = CFF_UNDEF_CODE;
+    hb_codepoint_t  prev_fd = 0;
     for (hb_codepoint_t i = 0; i < subset_num_glyphs; i++)
     {
-      hb_codepoint_t  fd = src.get_fd (glyphs[i]);
+      hb_codepoint_t	glyph;
+      hb_codepoint_t  	fd;
+      if (!plan->old_gid_for_new_gid (i, &glyph))
+      {
+	/* for a missing glyph, use the same fd as the previous
+	 * as an attempt to minimize the number of ranges */
+	fd = prev_fd;
+      }
+      else
+      {
+      	fd = src.get_fd (glyph);
+      }
       set->add (fd);
 
       if (fd != prev_fd)
diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh
index 915b4c4..9f958af 100644
--- a/src/hb-subset-cff-common.hh
+++ b/src/hb-subset-cff-common.hh
@@ -282,30 +282,35 @@
   bool	drop_hints;
 };
 
-template <typename ACC, typename ENV, typename OPSET>
+template <typename ACC, typename ENV, typename OPSET, op_code_t endchar_op=OpCode_Invalid>
 struct subr_flattener_t
 {
   subr_flattener_t (const ACC &acc_,
-		    const hb_vector_t<hb_codepoint_t> &glyphs_,
-		    bool drop_hints_) : acc (acc_), glyphs (glyphs_),
-					drop_hints (drop_hints_) {}
+		    const hb_subset_plan_t *plan_)
+		   : acc (acc_), plan (plan_) {}
 
   bool flatten (str_buff_vec_t &flat_charstrings)
   {
-    if (!flat_charstrings.resize (glyphs.length))
+    if (!flat_charstrings.resize (plan->num_output_glyphs ()))
       return false;
-    for (unsigned int i = 0; i < glyphs.length; i++)
+    for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
       flat_charstrings[i].init ();
-    for (unsigned int i = 0; i < glyphs.length; i++)
+    for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
     {
-      hb_codepoint_t  glyph = glyphs[i];
+      hb_codepoint_t  glyph;
+      if (!plan->old_gid_for_new_gid (i, &glyph))
+      {
+      	/* add an endchar only charstring for a missing glyph if CFF1 */
+      	if (endchar_op != OpCode_Invalid) flat_charstrings[i].push (endchar_op);
+      	continue;
+      }
       const byte_str_t str = (*acc.charStrings)[glyph];
       unsigned int fd = acc.fdSelect->get_fd (glyph);
       if (unlikely (fd >= acc.fdCount))
       	return false;
       cs_interpreter_t<ENV, OPSET, flatten_param_t> interp;
       interp.env.init (str, acc, fd);
-      flatten_param_t  param = { flat_charstrings[i], drop_hints };
+      flatten_param_t  param = { flat_charstrings[i], plan->drop_hints };
       if (unlikely (!interp.interpret (param)))
 	return false;
     }
@@ -313,8 +318,7 @@
   }
 
   const ACC &acc;
-  const hb_vector_t<hb_codepoint_t> &glyphs;
-  bool  drop_hints;
+  const hb_subset_plan_t *plan;
 };
 
 struct subr_closures_t
@@ -611,10 +615,11 @@
   hb_vector_t<subr_remap_t>  local_remaps;
 };
 
-template <typename SUBSETTER, typename SUBRS, typename ACC, typename ENV, typename OPSET>
+template <typename SUBSETTER, typename SUBRS, typename ACC, typename ENV, typename OPSET, op_code_t endchar_op=OpCode_Invalid>
 struct subr_subsetter_t
 {
-  subr_subsetter_t ()
+  subr_subsetter_t (ACC &acc_, const hb_subset_plan_t *plan_)
+    : acc (acc_), plan (plan_)
   {
     parsed_charstrings.init ();
     parsed_global_subrs.init ();
@@ -644,12 +649,12 @@
    * Assumption: a callsubr/callgsubr operator must immediately follow a (biased) subroutine number
    * within the same charstring/subroutine, e.g., not split across a charstring and a subroutine.
    */
-  bool subset (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, bool drop_hints)
+  bool subset (void)
   {
     closures.init (acc.fdCount);
     remaps.init (acc.fdCount);
 
-    parsed_charstrings.init (glyphs.length);
+    parsed_charstrings.init (plan->num_output_glyphs ());
     parsed_global_subrs.init (acc.globalSubrs->count);
     parsed_local_subrs.resize (acc.fdCount);
     for (unsigned int i = 0; i < acc.fdCount; i++)
@@ -660,9 +665,11 @@
       return false;
 
     /* phase 1 & 2 */
-    for (unsigned int i = 0; i < glyphs.length; i++)
+    for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
     {
-      hb_codepoint_t  glyph = glyphs[i];
+      hb_codepoint_t  glyph;
+      if (!plan->old_gid_for_new_gid (i, &glyph))
+      	continue;
       const byte_str_t str = (*acc.charStrings)[glyph];
       unsigned int fd = acc.fdSelect->get_fd (glyph);
       if (unlikely (fd >= acc.fdCount))
@@ -675,7 +682,7 @@
       param.init (&parsed_charstrings[i],
 		  &parsed_global_subrs,  &parsed_local_subrs[fd],
 		  closures.global_closure, closures.local_closures[fd],
-		  drop_hints);
+		  plan->drop_hints);
 
       if (unlikely (!interp.interpret (param)))
 	return false;
@@ -684,19 +691,22 @@
       SUBSETTER::finalize_parsed_str (interp.env, param, parsed_charstrings[i]);
     }
 
-    if (drop_hints)
+    if (plan->drop_hints)
     {
       /* mark hint ops and arguments for drop */
-      for (unsigned int i = 0; i < glyphs.length; i++)
+      for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
       {
-	unsigned int fd = acc.fdSelect->get_fd (glyphs[i]);
+	hb_codepoint_t  glyph;
+	if (!plan->old_gid_for_new_gid (i, &glyph))
+	  continue;
+	unsigned int fd = acc.fdSelect->get_fd (glyph);
 	if (unlikely (fd >= acc.fdCount))
 	  return false;
 	subr_subset_param_t  param;
 	param.init (&parsed_charstrings[i],
 		    &parsed_global_subrs,  &parsed_local_subrs[fd],
 		    closures.global_closure, closures.local_closures[fd],
-		    drop_hints);
+		    plan->drop_hints);
 
 	drop_hints_param_t  drop;
 	if (drop_hints_in_str (parsed_charstrings[i], param, drop))
@@ -709,16 +719,19 @@
 
       /* after dropping hints recreate closures of actually used subrs */
       closures.reset ();
-      for (unsigned int i = 0; i < glyphs.length; i++)
+      for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
       {
-	unsigned int fd = acc.fdSelect->get_fd (glyphs[i]);
+	hb_codepoint_t  glyph;
+	if (!plan->old_gid_for_new_gid (i, &glyph))
+	  continue;
+	unsigned int fd = acc.fdSelect->get_fd (glyph);
 	if (unlikely (fd >= acc.fdCount))
 	  return false;
 	subr_subset_param_t  param;
 	param.init (&parsed_charstrings[i],
 		    &parsed_global_subrs,  &parsed_local_subrs[fd],
 		    closures.global_closure, closures.local_closures[fd],
-		    drop_hints);
+		    plan->drop_hints);
 	collect_subr_refs_in_str (parsed_charstrings[i], param);
       }
     }
@@ -728,13 +741,20 @@
     return true;
   }
 
-  bool encode_charstrings (ACC &acc, const hb_vector_t<hb_codepoint_t> &glyphs, str_buff_vec_t &buffArray) const
+  bool encode_charstrings (str_buff_vec_t &buffArray) const
   {
-    if (unlikely (!buffArray.resize (glyphs.length)))
+    if (unlikely (!buffArray.resize (plan->num_output_glyphs ())))
       return false;
-    for (unsigned int i = 0; i < glyphs.length; i++)
+    for (unsigned int i = 0; i < plan->num_output_glyphs (); i++)
     {
-      unsigned int  fd = acc.fdSelect->get_fd (glyphs[i]);
+      hb_codepoint_t  glyph;
+      if (!plan->old_gid_for_new_gid (i, &glyph))
+      {
+      	/* add an endchar only charstring for a missing glyph if CFF1 */
+      	if (endchar_op != OpCode_Invalid) buffArray[i].push (endchar_op);
+      	continue;
+      }
+      unsigned int  fd = acc.fdSelect->get_fd (glyph);
       if (unlikely (fd >= acc.fdCount))
       	return false;
       if (unlikely (!encode_str (parsed_charstrings[i], fd, buffArray[i])))
@@ -954,13 +974,16 @@
   }
 
   protected:
-  subr_closures_t	      closures;
+  const ACC   			&acc;
+  const hb_subset_plan_t	*plan;
 
-  parsed_cs_str_vec_t	       parsed_charstrings;
-  parsed_cs_str_vec_t	       parsed_global_subrs;
+  subr_closures_t		closures;
+
+  parsed_cs_str_vec_t		parsed_charstrings;
+  parsed_cs_str_vec_t		parsed_global_subrs;
   hb_vector_t<parsed_cs_str_vec_t>  parsed_local_subrs;
 
-  subr_remap_ts		remaps;
+  subr_remap_ts			remaps;
 
   private:
   typedef typename SUBRS::count_type subr_count_type;
@@ -969,7 +992,7 @@
 } /* namespace CFF */
 
 HB_INTERNAL bool
-hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs,
+hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan,
 			    unsigned int fdCount,
 			    const CFF::FDSelect &src, /* IN */
 			    unsigned int &subset_fd_count /* OUT */,
diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc
index e015eda..49ac0bf 100644
--- a/src/hb-subset-cff1.cc
+++ b/src/hb-subset-cff1.cc
@@ -392,8 +392,11 @@
   typedef cff1_cs_opset_t<cff1_cs_opset_subr_subset_t, subr_subset_param_t> SUPER;
 };
 
-struct cff1_subr_subsetter_t : subr_subsetter_t<cff1_subr_subsetter_t, CFF1Subrs, const OT::cff1::accelerator_subset_t, cff1_cs_interp_env_t, cff1_cs_opset_subr_subset_t>
+struct cff1_subr_subsetter_t : subr_subsetter_t<cff1_subr_subsetter_t, CFF1Subrs, const OT::cff1::accelerator_subset_t, cff1_cs_interp_env_t, cff1_cs_opset_subr_subset_t, OpCode_endchar>
 {
+  cff1_subr_subsetter_t (const OT::cff1::accelerator_subset_t &acc, const hb_subset_plan_t *plan)
+    : subr_subsetter_t (acc, plan) {}
+
   static void finalize_parsed_str (cff1_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring)
   {
     /* insert width at the beginning of the charstring as necessary */
@@ -469,19 +472,24 @@
     supp_size = 0;
     supp_codes.init ();
 
-    subset_enc_num_codes = plan->glyphs_deprecated.length - 1;
+    subset_enc_num_codes = plan->num_output_glyphs () - 1;
     unsigned int glyph;
-    for (glyph = 1; glyph < plan->glyphs_deprecated.length; glyph++)
+    for (glyph = 1; glyph < plan->num_output_glyphs (); glyph++)
     {
-      hb_codepoint_t  orig_glyph = plan->glyphs_deprecated[glyph];
-      code = acc.glyph_to_code (orig_glyph);
+      hb_codepoint_t  old_glyph;
+      if (!plan->old_gid_for_new_gid (glyph, &old_glyph))
+      {
+      	/* Retain the code for the old missing glyph ID */
+	old_glyph = glyph;
+      }
+      code = acc.glyph_to_code (old_glyph);
       if (code == CFF_UNDEF_CODE)
       {
 	subset_enc_num_codes = glyph - 1;
 	break;
       }
 
-      if (code != last_code + 1)
+      if ((last_code == CFF_UNDEF_CODE) || (code != last_code + 1))
       {
 	code_pair_t pair = { code, glyph };
 	subset_enc_code_ranges.push (pair);
@@ -490,7 +498,7 @@
 
       if (encoding != &Null(Encoding))
       {
-	hb_codepoint_t  sid = acc.glyph_to_sid (orig_glyph);
+	hb_codepoint_t  sid = acc.glyph_to_sid (old_glyph);
 	encoding->get_supplement_codes (sid, supp_codes);
 	for (unsigned int i = 0; i < supp_codes.length; i++)
 	{
@@ -526,15 +534,20 @@
 
     subset_charset_ranges.resize (0);
     unsigned int glyph;
-    for (glyph = 1; glyph < plan->glyphs_deprecated.length; glyph++)
+    for (glyph = 1; glyph < plan->num_output_glyphs (); glyph++)
     {
-      hb_codepoint_t  orig_glyph = plan->glyphs_deprecated[glyph];
-      sid = acc.glyph_to_sid (orig_glyph);
+      hb_codepoint_t  old_glyph;
+      if (!plan->old_gid_for_new_gid (glyph, &old_glyph))
+      {
+      	/* Retain the SID for the old missing glyph ID */
+	old_glyph = glyph;
+      }
+      sid = acc.glyph_to_sid (old_glyph);
 
       if (!acc.is_CID ())
 	sid = sidmap.add (sid);
 
-      if (sid != last_sid + 1)
+      if ((last_sid == CFF_UNDEF_CODE) || (sid != last_sid + 1))
       {
 	code_pair_t pair = { sid, glyph };
 	subset_charset_ranges.push (pair);
@@ -544,7 +557,7 @@
 
     bool two_byte = subset_charset_ranges.finalize (glyph);
 
-    size0 = Charset0::min_size + HBUINT16::static_size * (plan->glyphs_deprecated.length - 1);
+    size0 = Charset0::min_size + HBUINT16::static_size * (plan->num_output_glyphs () - 1);
     if (!two_byte)
       size_ranges = Charset1::min_size + Charset1_Range::static_size * subset_charset_ranges.length;
     else
@@ -559,7 +572,7 @@
 
     return Charset::calculate_serialized_size (
 			subset_charset_format,
-			subset_charset_format? subset_charset_ranges.length: plan->glyphs_deprecated.length);
+			subset_charset_format? subset_charset_ranges.length: plan->num_output_glyphs ());
   }
 
   bool collect_sids_in_dicts (const OT::cff1::accelerator_subset_t &acc)
@@ -586,22 +599,25 @@
   }
 
   bool create (const OT::cff1::accelerator_subset_t &acc,
-		      hb_subset_plan_t *plan)
+	       hb_subset_plan_t *plan)
   {
-     /* make sure notdef is first */
-    if ((plan->glyphs_deprecated.length == 0) || (plan->glyphs_deprecated[0] != 0)) return false;
+    /* make sure notdef is first */
+    hb_codepoint_t old_glyph;
+    if (!plan->old_gid_for_new_gid (0, &old_glyph) || (old_glyph != 0)) return false;
 
     final_size = 0;
-    num_glyphs = plan->glyphs_deprecated.length;
+    num_glyphs = plan->num_output_glyphs ();
     orig_fdcount = acc.fdCount;
     drop_hints = plan->drop_hints;
     desubroutinize = plan->desubroutinize;
 
     /* check whether the subset renumbers any glyph IDs */
     gid_renum = false;
-    for (unsigned int glyph = 0; glyph < plan->glyphs_deprecated.length; glyph++)
+    for (hb_codepoint_t new_glyph = 0; new_glyph < plan->num_output_glyphs (); new_glyph++)
     {
-      if (plan->glyphs_deprecated[glyph] != glyph) {
+      if (!plan->old_gid_for_new_gid(new_glyph, &old_glyph))
+      	continue;
+      if (new_glyph != old_glyph) {
 	gid_renum = true;
 	break;
       }
@@ -644,7 +660,7 @@
     /* Determine re-mapping of font index as fdmap among other info */
     if (acc.fdSelect != &Null(CFF1FDSelect))
     {
-	if (unlikely (!hb_plan_subset_cff_fdselect (plan->glyphs_deprecated,
+	if (unlikely (!hb_plan_subset_cff_fdselect (plan,
 				  orig_fdcount,
 				  *acc.fdSelect,
 				  subset_fdcount,
@@ -680,8 +696,8 @@
     if (desubroutinize)
     {
       /* Flatten global & local subrs */
-      subr_flattener_t<const OT::cff1::accelerator_subset_t, cff1_cs_interp_env_t, cff1_cs_opset_flatten_t>
-		    flattener(acc, plan->glyphs_deprecated, plan->drop_hints);
+      subr_flattener_t<const OT::cff1::accelerator_subset_t, cff1_cs_interp_env_t, cff1_cs_opset_flatten_t, OpCode_endchar>
+		    flattener(acc, plan);
       if (!flattener.flatten (subset_charstrings))
 	return false;
 
@@ -690,12 +706,14 @@
     }
     else
     {
+      cff1_subr_subsetter_t       subr_subsetter (acc, plan);
+
       /* Subset subrs: collect used subroutines, leaving all unused ones behind */
-      if (!subr_subsetter.subset (acc, plan->glyphs_deprecated, plan->drop_hints))
+      if (!subr_subsetter.subset ())
 	return false;
 
       /* encode charstrings, global subrs, local subrs with new subroutine numbers */
-      if (!subr_subsetter.encode_charstrings (acc, plan->glyphs_deprecated, subset_charstrings))
+      if (!subr_subsetter.encode_charstrings (subset_charstrings))
 	return false;
 
       if (!subr_subsetter.encode_globalsubrs (subset_globalsubrs))
@@ -784,7 +802,7 @@
       offsets.charStringsInfo.offSize = calcOffSize (dataSize);
       if (unlikely (offsets.charStringsInfo.offSize > 4))
       	return false;
-      final_size += CFF1CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->glyphs_deprecated.length, dataSize);
+      final_size += CFF1CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->num_output_glyphs (), dataSize);
     }
 
     /* private dicts & local subrs */
@@ -816,7 +834,7 @@
     if (!acc.is_CID ())
       offsets.privateDictInfo = fontdicts_mod[0].privateDictInfo;
 
-    return ((subset_charstrings.length == plan->glyphs_deprecated.length)
+    return ((subset_charstrings.length == plan->num_output_glyphs ())
 	   && (fontdicts_mod.length == subset_fdcount));
   }
 
@@ -859,12 +877,11 @@
   unsigned int	topDictModSIDs[name_dict_values_t::ValCount];
 
   bool		desubroutinize;
-  cff1_subr_subsetter_t       subr_subsetter;
 };
 
 static inline bool _write_cff1 (const cff_subset_plan &plan,
 				const OT::cff1::accelerator_subset_t  &acc,
-				const hb_vector_t<hb_codepoint_t>& glyphs,
+				unsigned int num_glyphs,
 				unsigned int dest_sz,
 				void *dest)
 {
@@ -972,7 +989,7 @@
   {
     assert (plan.offsets.FDSelectInfo.offset == (unsigned) (c.head - c.start));
 
-    if (unlikely (!hb_serialize_cff_fdselect (&c, glyphs.length, *acc.fdSelect, acc.fdCount,
+    if (unlikely (!hb_serialize_cff_fdselect (&c, num_glyphs, *acc.fdSelect, acc.fdCount,
 					      plan.subset_fdselect_format, plan.offsets.FDSelectInfo.size,
 					      plan.subset_fdselect_ranges)))
     {
@@ -1064,7 +1081,7 @@
   unsigned int  cff_prime_size = cff_plan.get_final_size ();
   char *cff_prime_data = (char *) calloc (1, cff_prime_size);
 
-  if (unlikely (!_write_cff1 (cff_plan, acc, plan->glyphs_deprecated,
+  if (unlikely (!_write_cff1 (cff_plan, acc, plan->num_output_glyphs (),
 			      cff_prime_size, cff_prime_data))) {
     DEBUG_MSG(SUBSET, nullptr, "Failed to write a subset cff.");
     free (cff_prime_data);
diff --git a/src/hb-subset-cff2.cc b/src/hb-subset-cff2.cc
index 4830b63..bf76a3e 100644
--- a/src/hb-subset-cff2.cc
+++ b/src/hb-subset-cff2.cc
@@ -225,6 +225,9 @@
 
 struct cff2_subr_subsetter_t : subr_subsetter_t<cff2_subr_subsetter_t, CFF2Subrs, const OT::cff2::accelerator_subset_t, cff2_cs_interp_env_t, cff2_cs_opset_subr_subset_t>
 {
+  cff2_subr_subsetter_t (const OT::cff2::accelerator_subset_t &acc, const hb_subset_plan_t *plan)
+    : subr_subsetter_t (acc, plan) {}
+
   static void finalize_parsed_str (cff2_cs_interp_env_t &env, subr_subset_param_t& param, parsed_cs_str_t &charstring)
   {
     /* vsindex is inserted at the beginning of the charstring as necessary */
@@ -287,7 +290,7 @@
     {
       /* Flatten global & local subrs */
       subr_flattener_t<const OT::cff2::accelerator_subset_t, cff2_cs_interp_env_t, cff2_cs_opset_flatten_t>
-		    flattener(acc, plan->glyphs_deprecated, plan->drop_hints);
+		    flattener(acc, plan);
       if (!flattener.flatten (subset_charstrings))
 	return false;
 
@@ -296,12 +299,14 @@
     }
     else
     {
+      cff2_subr_subsetter_t	subr_subsetter (acc, plan);
+
       /* Subset subrs: collect used subroutines, leaving all unused ones behind */
-      if (!subr_subsetter.subset (acc, plan->glyphs_deprecated, plan->drop_hints))
+      if (!subr_subsetter.subset ())
 	return false;
 
       /* encode charstrings, global subrs, local subrs with new subroutine numbers */
-      if (!subr_subsetter.encode_charstrings (acc, plan->glyphs_deprecated, subset_charstrings))
+      if (!subr_subsetter.encode_charstrings (subset_charstrings))
 	return false;
 
       if (!subr_subsetter.encode_globalsubrs (subset_globalsubrs))
@@ -352,7 +357,7 @@
     if (acc.fdSelect != &Null(CFF2FDSelect))
     {
       offsets.FDSelectInfo.offset = final_size;
-      if (unlikely (!hb_plan_subset_cff_fdselect (plan->glyphs_deprecated,
+      if (unlikely (!hb_plan_subset_cff_fdselect (plan,
 				  orig_fdcount,
 				  *(const FDSelect *)acc.fdSelect,
 				  subset_fdcount,
@@ -385,7 +390,7 @@
       offsets.charStringsInfo.offset = final_size;
       unsigned int dataSize = subset_charstrings.total_size ();
       offsets.charStringsInfo.offSize = calcOffSize (dataSize);
-      final_size += CFF2CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->glyphs_deprecated.length, dataSize);
+      final_size += CFF2CharStrings::calculate_serialized_size (offsets.charStringsInfo.offSize, plan->num_output_glyphs (), dataSize);
     }
 
     /* private dicts & local subrs */
@@ -431,12 +436,11 @@
 
   bool	    drop_hints;
   bool	    desubroutinize;
-  cff2_subr_subsetter_t       subr_subsetter;
 };
 
 static inline bool _write_cff2 (const cff2_subset_plan &plan,
 				const OT::cff2::accelerator_subset_t  &acc,
-				const hb_vector_t<hb_codepoint_t>& glyphs,
+				unsigned int num_glyphs,
 				unsigned int dest_sz,
 				void *dest)
 {
@@ -493,7 +497,7 @@
   {
     assert (plan.offsets.FDSelectInfo.offset == (unsigned) (c.head - c.start));
 
-    if (unlikely (!hb_serialize_cff_fdselect (&c, glyphs.length, *(const FDSelect *)acc.fdSelect, acc.fdArray->count,
+    if (unlikely (!hb_serialize_cff_fdselect (&c, num_glyphs, *(const FDSelect *)acc.fdSelect, acc.fdArray->count,
 					      plan.subset_fdselect_format, plan.offsets.FDSelectInfo.size,
 					      plan.subset_fdselect_ranges)))
     {
@@ -584,7 +588,7 @@
   unsigned int  cff2_prime_size = cff2_plan.get_final_size ();
   char *cff2_prime_data = (char *) calloc (1, cff2_prime_size);
 
-  if (unlikely (!_write_cff2 (cff2_plan, acc, plan->glyphs_deprecated,
+  if (unlikely (!_write_cff2 (cff2_plan, acc, plan->num_output_glyphs (),
 			      cff2_prime_size, cff2_prime_data))) {
     DEBUG_MSG(SUBSET, nullptr, "Failed to write a subset cff2.");
     free (cff2_prime_data);
@@ -592,10 +596,10 @@
   }
 
   *prime = hb_blob_create (cff2_prime_data,
-				cff2_prime_size,
-				HB_MEMORY_MODE_READONLY,
-				cff2_prime_data,
-				free);
+			   cff2_prime_size,
+			   HB_MEMORY_MODE_READONLY,
+			   cff2_prime_data,
+			   free);
   return true;
 }
 
diff --git a/test/api/fonts/AdobeVFPrototype.ac.retaingids.otf b/test/api/fonts/AdobeVFPrototype.ac.retaingids.otf
new file mode 100644
index 0000000..8cb3005
--- /dev/null
+++ b/test/api/fonts/AdobeVFPrototype.ac.retaingids.otf
Binary files differ
diff --git a/test/api/fonts/SourceHanSans-Regular.41,4C2E.retaingids.otf b/test/api/fonts/SourceHanSans-Regular.41,4C2E.retaingids.otf
new file mode 100644
index 0000000..6da8ad3
--- /dev/null
+++ b/test/api/fonts/SourceHanSans-Regular.41,4C2E.retaingids.otf
Binary files differ
diff --git a/test/api/fonts/SourceSansPro-Regular.ac.retaingids.otf b/test/api/fonts/SourceSansPro-Regular.ac.retaingids.otf
new file mode 100644
index 0000000..d364b48
--- /dev/null
+++ b/test/api/fonts/SourceSansPro-Regular.ac.retaingids.otf
Binary files differ
diff --git a/test/api/test-subset-cff1.c b/test/api/test-subset-cff1.c
index 3ee2702..8b4025d 100644
--- a/test/api/test-subset-cff1.c
+++ b/test/api/test-subset-cff1.c
@@ -290,6 +290,52 @@
   hb_face_destroy (face);
 }
 
+static void
+test_subset_cff1_retaingids (void)
+{
+  hb_face_t *face_abc = hb_test_open_font_file ("fonts/SourceSansPro-Regular.abc.otf");
+  hb_face_t *face_ac = hb_test_open_font_file ("fonts/SourceSansPro-Regular.ac.retaingids.otf");
+
+  hb_set_t *codepoints = hb_set_create ();
+  hb_subset_input_t *input;
+  hb_face_t *face_abc_subset;
+  hb_set_add (codepoints, 'a');
+  hb_set_add (codepoints, 'c');
+  input = hb_subset_test_create_input (codepoints);
+  hb_subset_input_set_retain_gids (input, true);
+  face_abc_subset = hb_subset_test_create_subset (face_abc, input);
+  hb_set_destroy (codepoints);
+
+  hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('C','F','F',' '));
+
+  hb_face_destroy (face_abc_subset);
+  hb_face_destroy (face_abc);
+  hb_face_destroy (face_ac);
+}
+
+static void
+test_subset_cff1_j_retaingids (void)
+{
+  hb_face_t *face_41_3041_4c2e = hb_test_open_font_file ("fonts/SourceHanSans-Regular.41,3041,4C2E.otf");
+  hb_face_t *face_41_4c2e = hb_test_open_font_file ("fonts/SourceHanSans-Regular.41,4C2E.retaingids.otf");
+
+  hb_set_t *codepoints = hb_set_create ();
+  hb_subset_input_t *input;
+  hb_face_t *face_41_3041_4c2e_subset;
+  hb_set_add (codepoints, 0x41);
+  hb_set_add (codepoints, 0x4C2E);
+  input = hb_subset_test_create_input (codepoints);
+  hb_subset_input_set_retain_gids (input, true);
+  face_41_3041_4c2e_subset = hb_subset_test_create_subset (face_41_3041_4c2e, input);
+  hb_set_destroy (codepoints);
+
+  hb_subset_test_check (face_41_4c2e, face_41_3041_4c2e_subset, HB_TAG ('C','F','F',' '));
+
+  hb_face_destroy (face_41_3041_4c2e_subset);
+  hb_face_destroy (face_41_3041_4c2e);
+  hb_face_destroy (face_41_4c2e);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -307,6 +353,8 @@
   hb_test_add (test_subset_cff1_expert);
   hb_test_add (test_subset_cff1_seac);
   hb_test_add (test_subset_cff1_dotsection);
+  hb_test_add (test_subset_cff1_retaingids);
+  hb_test_add (test_subset_cff1_j_retaingids);
 
   return hb_test_run ();
 }
diff --git a/test/api/test-subset-cff2.c b/test/api/test-subset-cff2.c
index 9367965..7ffcf5e 100644
--- a/test/api/test-subset-cff2.c
+++ b/test/api/test-subset-cff2.c
@@ -138,6 +138,29 @@
   hb_face_destroy (face_ac);
 }
 
+static void
+test_subset_cff2_retaingids (void)
+{
+  hb_face_t *face_abc = hb_test_open_font_file ("fonts/AdobeVFPrototype.abc.otf");
+  hb_face_t *face_ac = hb_test_open_font_file ("fonts/AdobeVFPrototype.ac.retaingids.otf");
+
+  hb_set_t *codepoints = hb_set_create ();
+  hb_subset_input_t *input;
+  hb_face_t *face_abc_subset;
+  hb_set_add (codepoints, 'a');
+  hb_set_add (codepoints, 'c');
+  input = hb_subset_test_create_input (codepoints);
+  hb_subset_input_set_retain_gids (input, true);
+  face_abc_subset = hb_subset_test_create_subset (face_abc, input);
+  hb_set_destroy (codepoints);
+
+  hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('C', 'F', 'F', '2'));
+
+  hb_face_destroy (face_abc_subset);
+  hb_face_destroy (face_abc);
+  hb_face_destroy (face_ac);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -148,6 +171,7 @@
   hb_test_add (test_subset_cff2_strip_hints);
   hb_test_add (test_subset_cff2_desubr);
   hb_test_add (test_subset_cff2_desubr_strip_hints);
+  hb_test_add (test_subset_cff2_retaingids);
 
   return hb_test_run ();
 }
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.default.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.61,62,63.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.default.61,62,63.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.default.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.1FC,21,41,20,62,63.otf
new file mode 100644
index 0000000..ca54654
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.61,62,63.otf
new file mode 100644
index 0000000..0f52e66
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf
new file mode 100644
index 0000000..170c151
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.desubroutinize.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.1FC,21,41,20,62,63.otf
new file mode 100644
index 0000000..87c8f00
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.61,62,63.otf
new file mode 100644
index 0000000..f381f13
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf
new file mode 100644
index 0000000..f32a1fc
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize-retain-gids.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.desubroutinize.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.1FC,21,41,20,62,63.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.desubroutinize.1FC,21,41,20,62,63.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.61,62,63.otf
new file mode 100644
index 0000000..419dfa0
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.desubroutinize.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.D7,D8,D9,DA,DE.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.desubroutinize.D7,D8,D9,DA,DE.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-desubroutinize.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.1FC,21,41,20,62,63.otf
new file mode 100644
index 0000000..9a5c09a
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.61,62,63.otf
new file mode 100644
index 0000000..f5b4ebd
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.D7,D8,D9,DA,DE.otf
new file mode 100644
index 0000000..57f9a8d
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints-retain-gids.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf
similarity index 100%
rename from test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf
rename to test/subset/data/expected/cff-full-font/SourceSansPro-Regular.drop-hints.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.1FC,21,41,20,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.1FC,21,41,20,62,63.otf
new file mode 100644
index 0000000..2caee79
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.1FC,21,41,20,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.61,62,63.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.61,62,63.otf
new file mode 100644
index 0000000..b428a7b
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.61,62,63.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.D7,D8,D9,DA,DE.otf b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.D7,D8,D9,DA,DE.otf
new file mode 100644
index 0000000..ccb4428
--- /dev/null
+++ b/test/subset/data/expected/cff-full-font/SourceSansPro-Regular.retain-gids.D7,D8,D9,DA,DE.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.default.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.3042,3044,3046,3048,304A,304B.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.default.3042,3044,3046,3048,304A,304B.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.default.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.3042,3044,3046,73E0,5EA6,8F38.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.default.3042,3044,3046,73E0,5EA6,8F38.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.default.61,63,65,6B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.61,63,65,6B.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.default.61,63,65,6B.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.default.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.660E.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.default.660E.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.default.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.3042,3044,3046,3048,304A,304B.otf
new file mode 100644
index 0000000..8445645
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
new file mode 100644
index 0000000..9d2e5d6
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.61,63,65,6B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.61,63,65,6B.otf
new file mode 100644
index 0000000..6ca270a
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
new file mode 100644
index 0000000..50ec062
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.660E.otf
new file mode 100644
index 0000000..fe8e716
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize-retain-gids.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,3048,304A,304B.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,3048,304A,304B.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.61,63,65,6B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.61,63,65,6B.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.61,63,65,6B.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.660E.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize.660E.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.desubroutinize.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.3042,3044,3046,3048,304A,304B.otf
new file mode 100644
index 0000000..30087bc
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
new file mode 100644
index 0000000..1ef807f
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.61,63,65,6B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.61,63,65,6B.otf
new file mode 100644
index 0000000..55b4230
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
new file mode 100644
index 0000000..991300e
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.660E.otf
new file mode 100644
index 0000000..2f3f863
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize-retain-gids.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.3042,3044,3046,3048,304A,304B.otf
similarity index 64%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.3042,3044,3046,3048,304A,304B.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.3042,3044,3046,3048,304A,304B.otf
index 790b714..3f83101 100644
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.3042,3044,3046,3048,304A,304B.otf
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
similarity index 65%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
index c707bcd..9e6e9cf 100644
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.61,63,65,6B.otf
similarity index 74%
copy from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E.otf
copy to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.61,63,65,6B.otf
index 27c4676..02d7aaf 100644
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E.otf
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
similarity index 64%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
index efc98b6..a1adef2 100644
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.660E.otf
similarity index 85%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.660E.otf
index 27c4676..da13955 100644
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.660E.otf
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-desubroutinize.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.3042,3044,3046,3048,304A,304B.otf
new file mode 100644
index 0000000..c7b6250
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
new file mode 100644
index 0000000..b1f9cb3
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.61,63,65,6B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.61,63,65,6B.otf
new file mode 100644
index 0000000..03f8fff
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
new file mode 100644
index 0000000..0acb6ad
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.660E.otf
new file mode 100644
index 0000000..d9a5fab
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints-retain-gids.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,3048,304A,304B.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,3048,304A,304B.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.61,63,65,6B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.61,63,65,6B.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.61,63,65,6B.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.660E.otf
similarity index 100%
rename from test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.660E.otf
rename to test/subset/data/expected/cff-japanese/SourceHanSans-Regular.drop-hints.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.3042,3044,3046,3048,304A,304B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.3042,3044,3046,3048,304A,304B.otf
new file mode 100644
index 0000000..bd5a87d
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.3042,3044,3046,3048,304A,304B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
new file mode 100644
index 0000000..bfda886
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.3042,3044,3046,73E0,5EA6,8F38.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.61,63,65,6B.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.61,63,65,6B.otf
new file mode 100644
index 0000000..f77e115
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.61,63,65,6B.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
new file mode 100644
index 0000000..71a2223
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.660E,6975,73E0,5EA6,8F38,6E05.otf
Binary files differ
diff --git a/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.660E.otf b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.660E.otf
new file mode 100644
index 0000000..96da59a
--- /dev/null
+++ b/test/subset/data/expected/cff-japanese/SourceHanSans-Regular.retain-gids.660E.otf
Binary files differ
diff --git a/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.desubroutinize.61,62,63.otf b/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.desubroutinize.61,62,63.otf
deleted file mode 100644
index a0b2c2f..0000000
--- a/test/subset/data/expected/full-font/SourceSansPro-Regular.drop-hints.desubroutinize.61,62,63.otf
+++ /dev/null
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize..otf b/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize..otf
deleted file mode 100644
index 7c0c5fd..0000000
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.desubroutinize..otf
+++ /dev/null
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize..otf b/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize..otf
deleted file mode 100644
index a73617a..0000000
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize..otf
+++ /dev/null
Binary files differ
diff --git a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.61,63,65,6B.otf b/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.61,63,65,6B.otf
deleted file mode 100644
index 591d139..0000000
--- a/test/subset/data/expected/japanese/SourceHanSans-Regular.drop-hints.desubroutinize.61,63,65,6B.otf
+++ /dev/null
Binary files differ
diff --git a/test/subset/data/profiles/desubroutinize-retain-gids.txt b/test/subset/data/profiles/desubroutinize-retain-gids.txt
new file mode 100644
index 0000000..cbb37b6
--- /dev/null
+++ b/test/subset/data/profiles/desubroutinize-retain-gids.txt
@@ -0,0 +1,2 @@
+--desubroutinize
+--retain-gids
diff --git a/test/subset/data/profiles/drop-hints-desubroutinize-retain-gids.txt b/test/subset/data/profiles/drop-hints-desubroutinize-retain-gids.txt
new file mode 100644
index 0000000..848620a
--- /dev/null
+++ b/test/subset/data/profiles/drop-hints-desubroutinize-retain-gids.txt
@@ -0,0 +1,3 @@
+--no-hinting
+--desubroutinize
+--retain-gids
diff --git a/test/subset/data/tests/cff-full-font.tests b/test/subset/data/tests/cff-full-font.tests
new file mode 100644
index 0000000..e55f21e
--- /dev/null
+++ b/test/subset/data/tests/cff-full-font.tests
@@ -0,0 +1,18 @@
+FONTS:
+SourceSansPro-Regular.otf
+
+PROFILES:
+default.txt
+drop-hints.txt
+drop-hints-retain-gids.txt
+retain-gids.txt
+desubroutinize.txt
+desubroutinize-retain-gids.txt
+drop-hints-desubroutinize.txt
+drop-hints-desubroutinize-retain-gids.txt
+
+SUBSETS:
+abc
+Ǽ!A bc
+×ØÙÚÞ
+
diff --git a/test/subset/data/tests/cff-japanese.tests b/test/subset/data/tests/cff-japanese.tests
new file mode 100644
index 0000000..c06de6c
--- /dev/null
+++ b/test/subset/data/tests/cff-japanese.tests
@@ -0,0 +1,22 @@
+FONTS:
+SourceHanSans-Regular.otf
+
+PROFILES:
+default.txt
+drop-hints.txt
+drop-hints-retain-gids.txt
+retain-gids.txt
+desubroutinize.txt
+desubroutinize-retain-gids.txt
+drop-hints-desubroutinize.txt
+drop-hints-desubroutinize-retain-gids.txt
+
+SUBSETS:
+明
+acek
+明極珠度輸清
+あいうえおか
+あいう珠度輸
+
+
+
diff --git a/test/subset/data/tests/full-font.tests b/test/subset/data/tests/full-font.tests
index f422ff5..ff195ce 100644
--- a/test/subset/data/tests/full-font.tests
+++ b/test/subset/data/tests/full-font.tests
@@ -1,6 +1,5 @@
 FONTS:
 Roboto-Regular.ttf
-SourceSansPro-Regular.otf
 
 PROFILES:
 default.txt
diff --git a/test/subset/data/tests/japanese.tests b/test/subset/data/tests/japanese.tests
index fc58646..5a04380 100644
--- a/test/subset/data/tests/japanese.tests
+++ b/test/subset/data/tests/japanese.tests
@@ -1,6 +1,5 @@
 FONTS:
 Mplus1p-Regular.ttf
-SourceHanSans-Regular.otf
 
 PROFILES:
 default.txt
diff --git a/test/subset/subset_test_suite.py b/test/subset/subset_test_suite.py
index 5e3368e..ad438ee 100644
--- a/test/subset/subset_test_suite.py
+++ b/test/subset/subset_test_suite.py
@@ -33,9 +33,6 @@
 		font_base_name_parts = os.path.splitext(font_base_name)
 		return font_base_name_parts[1]
 
-	def applicable(self):
-		return self.profile_path.find("desubroutinize") < 0 or self.get_font_extension() == "otf"
-
 # A group of tests to perform on the subsetter. Each test
 # Identifies a font a subsetting profile, and a subset to be cut.
 class SubsetTestSuite:
@@ -65,9 +62,7 @@
 			for profile in self.profiles:
 				profile = os.path.join(self._base_path(), "profiles", profile)
 				for subset in self.subsets:
-					test = Test(font, profile, subset)
-					if test.applicable():
-						yield test
+					yield Test(font, profile, subset)
 
 	def _base_path(self):
 		return os.path.dirname(os.path.dirname(self.test_path))