[subset] Remove unused hb_subset_profile_t
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 30 Aug 2018 01:09:55 +0000 (18:09 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 30 Aug 2018 01:09:55 +0000 (18:09 -0700)
We might reintroduce it later, but for now remove, as it was unused.
Some things that should have been in this object (drop_hints, etc)
are already in hb_subset_input_t.  So, for now, keep everything there.

src/hb-subset-plan.cc
src/hb-subset-plan.hh
src/hb-subset.cc
src/hb-subset.h
test/api/hb-subset-test.h
test/api/test-subset-hdmx.c
test/api/test-subset-hmtx.c
test/api/test-subset.c
test/fuzzing/hb-subset-fuzzer.cc
util/hb-subset.cc

index 1f643dc..7efa1c1 100644 (file)
@@ -135,7 +135,7 @@ _create_old_gid_to_new_gid_map (const hb_vector_t<hb_codepoint_t> &glyphs,
 /**
  * hb_subset_plan_create:
  * Computes a plan for subsetting the supplied face according
- * to a provide profile and input. The plan describes
+ * to a provided input. The plan describes
  * which tables and glyphs should be retained.
  *
  * Return value: New subset plan.
@@ -144,7 +144,6 @@ _create_old_gid_to_new_gid_map (const hb_vector_t<hb_codepoint_t> &glyphs,
  **/
 hb_subset_plan_t *
 hb_subset_plan_create (hb_face_t           *face,
-                       hb_subset_profile_t *profile,
                        hb_subset_input_t   *input)
 {
   hb_subset_plan_t *plan = hb_object_create<hb_subset_plan_t> ();
index 0f44f4b..a5be50a 100644 (file)
@@ -97,7 +97,6 @@ typedef struct hb_subset_plan_t hb_subset_plan_t;
 
 HB_INTERNAL hb_subset_plan_t *
 hb_subset_plan_create (hb_face_t           *face,
-                       hb_subset_profile_t *profile,
                        hb_subset_input_t   *input);
 
 HB_INTERNAL void
index 1ba1605..1695d37 100644 (file)
 #include "hb-ot-post-table.hh"
 
 
-struct hb_subset_profile_t {
-  hb_object_header_t header;
-  ASSERT_POD ();
-};
-
-/**
- * hb_subset_profile_create:
- *
- * Return value: New profile with default settings.
- *
- * Since: 1.8.0
- **/
-hb_subset_profile_t *
-hb_subset_profile_create ()
-{
-  return hb_object_create<hb_subset_profile_t>();
-}
-
-/**
- * hb_subset_profile_destroy:
- *
- * Since: 1.8.0
- **/
-void
-hb_subset_profile_destroy (hb_subset_profile_t *profile)
-{
-  if (!hb_object_destroy (profile)) return;
-
-  free (profile);
-}
-
 template<typename TableType>
 static bool
 _subset (hb_subset_plan_t *plan)
@@ -198,19 +167,17 @@ _should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag)
 /**
  * hb_subset:
  * @source: font face data to be subset.
- * @profile: profile to use for the subsetting.
  * @input: input to use for the subsetting.
  *
- * Subsets a font according to provided profile and input.
+ * Subsets a font according to provided input.
  **/
 hb_face_t *
 hb_subset (hb_face_t *source,
-           hb_subset_profile_t *profile,
            hb_subset_input_t *input)
 {
-  if (unlikely (!profile || !input || !source)) return hb_face_get_empty();
+  if (unlikely (!input || !source)) return hb_face_get_empty();
 
-  hb_subset_plan_t *plan = hb_subset_plan_create (source, profile, input);
+  hb_subset_plan_t *plan = hb_subset_plan_create (source, input);
 
   hb_tag_t table_tags[32];
   unsigned int offset = 0, count;
index 8b7fcc6..3b39706 100644 (file)
 HB_BEGIN_DECLS
 
 /*
- * hb_subset_profile_t
- * Things that change based on target environment, e.g. OS.
- * Threadsafe for multiple concurrent subset operations.
- */
-
-typedef struct hb_subset_profile_t hb_subset_profile_t;
-
-HB_EXTERN hb_subset_profile_t *
-hb_subset_profile_create (void);
-
-HB_EXTERN void
-hb_subset_profile_destroy (hb_subset_profile_t *profile);
-
-/*
  * hb_subset_input_t
  *
  * Things that change based on the input. Characters to keep, etc.
@@ -74,10 +60,10 @@ hb_subset_input_drop_hints (hb_subset_input_t *subset_input);
 HB_EXTERN hb_bool_t *
 hb_subset_input_drop_ot_layout (hb_subset_input_t *subset_input);
 
+
 /* hb_subset() */
 HB_EXTERN hb_face_t *
 hb_subset (hb_face_t *source,
-          hb_subset_profile_t *profile,
            hb_subset_input_t *input);
 
 
index c34f394..afd553a 100644 (file)
@@ -72,11 +72,9 @@ static inline hb_face_t *
 hb_subset_test_create_subset (hb_face_t *source,
                               hb_subset_input_t *input)
 {
-  hb_subset_profile_t *profile = hb_subset_profile_create();
-  hb_face_t *subset = hb_subset (source, profile, input);
+  hb_face_t *subset = hb_subset (source, input);
   g_assert (subset);
 
-  hb_subset_profile_destroy (profile);
   hb_subset_input_destroy (input);
   return subset;
 }
index c78009b..22fcb41 100644 (file)
@@ -61,13 +61,11 @@ test_subset_hdmx_invalid (void)
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
 
-  hb_subset_profile_t *profile = hb_subset_profile_create();
-  hb_face_t *subset = hb_subset (face, profile, input);
+  hb_face_t *subset = hb_subset (face, input);
   g_assert (subset);
   g_assert (subset == hb_face_get_empty ());
 
   hb_subset_input_destroy (input);
-  hb_subset_profile_destroy (profile);
   hb_face_destroy (subset);
   hb_face_destroy (face);
 }
@@ -83,13 +81,11 @@ test_subset_hdmx_fails_sanitize (void)
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
 
-  hb_subset_profile_t *profile = hb_subset_profile_create();
-  hb_face_t *subset = hb_subset (face, profile, input);
+  hb_face_t *subset = hb_subset (face, input);
   g_assert (subset);
   g_assert (subset == hb_face_get_empty ());
 
   hb_subset_input_destroy (input);
-  hb_subset_profile_destroy (profile);
   hb_face_destroy (subset);
   hb_face_destroy (face);
 }
index 0ed6256..8b57ca7 100644 (file)
@@ -161,13 +161,11 @@ test_subset_invalid_hmtx (void)
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
 
-  hb_subset_profile_t *profile = hb_subset_profile_create();
-  hb_face_t *subset = hb_subset (face, profile, input);
+  hb_face_t *subset = hb_subset (face, input);
   g_assert (subset);
   g_assert (subset == hb_face_get_empty ());
 
   hb_subset_input_destroy (input);
-  hb_subset_profile_destroy (profile);
   hb_face_destroy (subset);
   hb_face_destroy (face);
 }
index 6d2bf06..b0a3446 100644 (file)
@@ -40,13 +40,11 @@ test_subset_32_tables (void)
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
 
-  hb_subset_profile_t *profile = hb_subset_profile_create();
-  hb_face_t *subset = hb_subset (face, profile, input);
+  hb_face_t *subset = hb_subset (face, input);
   g_assert (subset);
   g_assert (subset != hb_face_get_empty ());
 
   hb_subset_input_destroy (input);
-  hb_subset_profile_destroy (profile);
   hb_face_destroy (subset);
   hb_face_destroy (face);
 }
@@ -62,13 +60,11 @@ test_subset_no_inf_loop (void)
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
 
-  hb_subset_profile_t *profile = hb_subset_profile_create();
-  hb_face_t *subset = hb_subset (face, profile, input);
+  hb_face_t *subset = hb_subset (face, input);
   g_assert (subset);
   g_assert (subset == hb_face_get_empty ());
 
   hb_subset_input_destroy (input);
-  hb_subset_profile_destroy (profile);
   hb_face_destroy (subset);
   hb_face_destroy (face);
 }
@@ -84,13 +80,11 @@ test_subset_crash (void)
   hb_set_add (codepoints, 'b');
   hb_set_add (codepoints, 'c');
 
-  hb_subset_profile_t *profile = hb_subset_profile_create();
-  hb_face_t *subset = hb_subset (face, profile, input);
+  hb_face_t *subset = hb_subset (face, input);
   g_assert (subset);
   g_assert (subset == hb_face_get_empty ());
 
   hb_subset_input_destroy (input);
-  hb_subset_profile_destroy (profile);
   hb_face_destroy (subset);
   hb_face_destroy (face);
 }
index 28ce921..108f6ec 100644 (file)
@@ -12,8 +12,6 @@ void trySubset (hb_face_t *face,
                 bool drop_hints,
                 bool drop_ot_layout)
 {
-  hb_subset_profile_t *profile = hb_subset_profile_create ();
-
   hb_subset_input_t *input = hb_subset_input_create_or_fail ();
   *hb_subset_input_drop_hints (input) = drop_hints;
   *hb_subset_input_drop_ot_layout (input) = drop_ot_layout;
@@ -24,11 +22,10 @@ void trySubset (hb_face_t *face,
     hb_set_add (codepoints, text[i]);
   }
 
-  hb_face_t *result = hb_subset (face, profile, input);
+  hb_face_t *result = hb_subset (face, input);
   hb_face_destroy (result);
 
   hb_subset_input_destroy (input);
-  hb_subset_profile_destroy (profile);
 }
 
 void trySubset (hb_face_t *face,
index a15495f..f333be8 100644 (file)
@@ -92,17 +92,15 @@ struct subset_consumer_t
   {
     input->drop_hints = subset_options.drop_hints;
 
-    hb_subset_profile_t *subset_profile = hb_subset_profile_create();
     hb_face_t *face = hb_font_get_face (font);
 
-    hb_face_t *new_face = hb_subset(face, subset_profile, input);
+    hb_face_t *new_face = hb_subset(face, input);
     hb_blob_t *result = hb_face_reference_blob (new_face);
 
     failed = !hb_blob_get_length (result);
     if (!failed)
       write_file (options.output_file, result);
 
-    hb_subset_profile_destroy (subset_profile);
     hb_subset_input_destroy (input);
     hb_blob_destroy (result);
     hb_face_destroy (new_face);