[subset] drop all glyph names from the post table.

This commit is contained in:
Garret Rieger 2018-03-06 18:33:39 -08:00
parent 1ab514805c
commit dd10769993
2 changed files with 32 additions and 0 deletions

View File

@ -82,6 +82,34 @@ struct post
return_trace (true);
}
inline bool subset (hb_subset_plan_t *plan) const
{
hb_blob_t *post_blob = OT::Sanitizer<post>().sanitize (hb_face_reference_table (plan->source, HB_OT_TAG_post));
post *post_table = (post *) hb_blob_get_data (post_blob, nullptr);
post *post_prime = (post *) malloc (post::static_size);
if (unlikely (!post_prime))
{
hb_blob_destroy (post_blob);
DEBUG_MSG(SUBSET, nullptr, "Unable to alloc %lu for post subset output.", (unsigned long) post::static_size);
return false;
}
memcpy (post_prime, post_table, post::static_size);
hb_blob_destroy (post_blob);
post_prime->version.major.set (3); // Version 3 does not have any glyph names.
hb_blob_t *post_prime_blob = hb_blob_create ((const char *) post_prime,
post::static_size,
HB_MEMORY_MODE_READONLY,
post_prime,
free);
bool result = hb_subset_plan_add_table (plan, HB_OT_TAG_post, post_prime_blob);
hb_blob_destroy (post_prime_blob);
return result;
}
struct accelerator_t
{
inline void init (hb_face_t *face)

View File

@ -41,6 +41,7 @@
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-maxp-table.hh"
#include "hb-ot-os2-table.hh"
#include "hb-ot-post-table.hh"
#ifndef HB_NO_VISIBILITY
@ -270,6 +271,9 @@ _subset_table (hb_subset_plan_t *plan,
case HB_OT_TAG_os2:
result = _subset<const OT::os2> (plan);
break;
case HB_OT_TAG_post:
result = _subset<const OT::post> (plan);
break;
default:
hb_blob_t *source_table = hb_face_reference_table(plan->source, tag);
if (likely (source_table))