[subset] Remove unused hb_subset_profile_t

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.
This commit is contained in:
Behdad Esfahbod 2018-08-29 18:09:55 -07:00
parent 2ccc322cf8
commit f39166f0c0
10 changed files with 14 additions and 82 deletions

View 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> ();

View 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

View File

@ -43,37 +43,6 @@
#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;

View File

@ -31,20 +31,6 @@
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
*
@ -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);

View 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;
}

View 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);
}

View 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);
}

View 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);
}

View 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,

View 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);