[subset] maxp table to use _subset2
This commit is contained in:
parent
d5e5f37832
commit
db938479d7
@ -94,39 +94,35 @@ struct maxp
|
|||||||
return_trace (likely (version.major == 0 && version.minor == 0x5000u));
|
return_trace (likely (version.major == 0 && version.minor == 0x5000u));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subset (hb_subset_plan_t *plan) const
|
bool subset (hb_subset_context_t *c) const
|
||||||
{
|
{
|
||||||
hb_blob_t *maxp_blob = hb_sanitize_context_t().reference_table<maxp> (plan->source);
|
TRACE_SUBSET (this);
|
||||||
hb_blob_t *maxp_prime_blob = hb_blob_copy_writable_or_fail (maxp_blob);
|
maxp *maxp_prime = c->serializer->embed (this);
|
||||||
hb_blob_destroy (maxp_blob);
|
if (unlikely (!maxp_prime)) return_trace (false);
|
||||||
|
|
||||||
if (unlikely (!maxp_prime_blob)) {
|
maxp_prime->numGlyphs = c->plan->num_output_glyphs ();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
maxp *maxp_prime = (maxp *) hb_blob_get_data (maxp_prime_blob, nullptr);
|
|
||||||
|
|
||||||
maxp_prime->set_num_glyphs (plan->num_output_glyphs ());
|
|
||||||
if (plan->drop_hints)
|
|
||||||
drop_hint_fields (plan, maxp_prime);
|
|
||||||
|
|
||||||
bool result = plan->add_table (HB_OT_TAG_maxp, maxp_prime_blob);
|
|
||||||
hb_blob_destroy (maxp_prime_blob);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void drop_hint_fields (hb_subset_plan_t *plan HB_UNUSED, maxp *maxp_prime)
|
|
||||||
{
|
|
||||||
if (maxp_prime->version.major == 1)
|
if (maxp_prime->version.major == 1)
|
||||||
{
|
{
|
||||||
maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*maxp_prime);
|
const maxpV1Tail *src_v1 = &StructAfter<maxpV1Tail> (*this);
|
||||||
v1.maxZones = 1;
|
maxpV1Tail *dest_v1 = c->serializer->embed<maxpV1Tail> (src_v1);
|
||||||
v1.maxTwilightPoints = 0;
|
if (unlikely (!dest_v1)) return_trace (false);
|
||||||
v1.maxStorage = 0;
|
|
||||||
v1.maxFunctionDefs = 0;
|
if (c->plan->drop_hints)
|
||||||
v1.maxInstructionDefs = 0;
|
drop_hint_fields (dest_v1);
|
||||||
v1.maxStackElements = 0;
|
|
||||||
v1.maxSizeOfInstructions = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return_trace (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drop_hint_fields (maxpV1Tail* dest_v1)
|
||||||
|
{
|
||||||
|
dest_v1->maxZones = 1;
|
||||||
|
dest_v1->maxTwilightPoints = 0;
|
||||||
|
dest_v1->maxStorage = 0;
|
||||||
|
dest_v1->maxFunctionDefs = 0;
|
||||||
|
dest_v1->maxInstructionDefs = 0;
|
||||||
|
dest_v1->maxStackElements = 0;
|
||||||
|
dest_v1->maxSizeOfInstructions = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -181,7 +181,7 @@ _subset_table (hb_subset_plan_t *plan,
|
|||||||
result = _subset2<const OT::vmtx> (plan);
|
result = _subset2<const OT::vmtx> (plan);
|
||||||
break;
|
break;
|
||||||
case HB_OT_TAG_maxp:
|
case HB_OT_TAG_maxp:
|
||||||
result = _subset<const OT::maxp> (plan);
|
result = _subset2<const OT::maxp> (plan);
|
||||||
break;
|
break;
|
||||||
case HB_OT_TAG_loca:
|
case HB_OT_TAG_loca:
|
||||||
DEBUG_MSG(SUBSET, nullptr, "skip loca handled by glyf");
|
DEBUG_MSG(SUBSET, nullptr, "skip loca handled by glyf");
|
||||||
|
Loading…
Reference in New Issue
Block a user