[subset] Extract maxp subsetting into hb-ot-maxp-table.
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index 15730bf..dda9f3e 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -280,31 +280,6 @@
}
static bool
-_add_maxp_and_set_glyph_count (hb_subset_plan_t *plan, hb_face_t *source, hb_face_t *dest)
-{
- hb_blob_t *maxp_blob = OT::Sanitizer<OT::maxp>().sanitize (hb_face_reference_table (source, HB_OT_TAG_maxp));
- const OT::maxp *maxp = OT::Sanitizer<OT::maxp>::lock_instance (maxp_blob);
- bool has_maxp = (maxp != nullptr);
- if (has_maxp) {
- unsigned int length = hb_blob_get_length (maxp_blob);
- OT::maxp *maxp_prime = (OT::maxp *) calloc (length, 1);
- memcpy (maxp_prime, maxp, length);
- maxp_prime->set_num_glyphs (plan->gids_to_retain_sorted.len);
-
- hb_blob_t *maxp_prime_blob = hb_blob_create ((const char*) maxp_prime,
- length,
- HB_MEMORY_MODE_READONLY,
- maxp_prime,
- free);
- has_maxp = hb_subset_face_add_table (dest, HB_OT_TAG_maxp, maxp_prime_blob);
- hb_blob_destroy (maxp_prime_blob);
- }
-
- hb_blob_destroy (maxp_blob);
- return has_maxp;
-}
-
-static bool
_subset_glyf (hb_subset_plan_t *plan, hb_face_t *source, hb_face_t *dest)
{
hb_blob_t *glyf_prime = nullptr;
@@ -343,7 +318,8 @@
// SKIP head, it's handled by glyf
return true;
case HB_OT_TAG_maxp:
- return _add_maxp_and_set_glyph_count (plan, source, dest);
+ dest_blob = _subset<const OT::maxp> (plan, source);
+ break;
case HB_OT_TAG_loca:
// SKIP loca, it's handle by glyf
return true;