[subset] post table to use _subset2

This commit is contained in:
Qunxin Liu 2019-06-05 16:51:31 -07:00 committed by Behdad Esfahbod
parent db938479d7
commit 93d592e0e1
2 changed files with 16 additions and 17 deletions

View File

@ -73,26 +73,25 @@ struct post
{
static constexpr hb_tag_t tableTag = HB_OT_TAG_post;
bool subset (hb_subset_plan_t *plan) const
void serialize (hb_serialize_context_t *c) const
{
unsigned int post_prime_length;
hb_blob_t *post_blob = hb_sanitize_context_t ().reference_table<post>(plan->source);
hb_blob_t *post_prime_blob = hb_blob_create_sub_blob (post_blob, 0, post::min_size);
post *post_prime = (post *) hb_blob_get_data_writable (post_prime_blob, &post_prime_length);
hb_blob_destroy (post_blob);
if (unlikely (!post_prime || post_prime_length != post::min_size))
{
hb_blob_destroy (post_prime_blob);
DEBUG_MSG(SUBSET, nullptr, "Invalid source post table with length %d.", post_prime_length);
return false;
}
post *post_prime = c->allocate_min<post> ();
if (unlikely (!post_prime)) return;
memcpy (post_prime, this, post::min_size);
post_prime->version.major = 3; // Version 3 does not have any glyph names.
bool result = plan->add_table (HB_OT_TAG_post, post_prime_blob);
hb_blob_destroy (post_prime_blob);
}
return result;
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
post *post_prime = c->serializer->start_embed<post> ();
if (unlikely (!post_prime)) return_trace (false);
serialize (c->serializer);
if (c->serializer->in_error () || c->serializer->ran_out_of_room) return_trace (false);
return_trace (true);
}
struct accelerator_t

View File

@ -193,7 +193,7 @@ _subset_table (hb_subset_plan_t *plan,
result = _subset<const OT::OS2> (plan);
break;
case HB_OT_TAG_post:
result = _subset<const OT::post> (plan);
result = _subset2<const OT::post> (plan);
break;
#ifndef HB_NO_SUBSET_CFF