提交 db938479 编写于 作者: Q Qunxin Liu 提交者: Garret Rieger

[subset] maxp table to use _subset2

上级 d5e5f378
......@@ -94,39 +94,35 @@ struct maxp
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);
hb_blob_t *maxp_prime_blob = hb_blob_copy_writable_or_fail (maxp_blob);
hb_blob_destroy (maxp_blob);
TRACE_SUBSET (this);
maxp *maxp_prime = c->serializer->embed (this);
if (unlikely (!maxp_prime)) return_trace (false);
if (unlikely (!maxp_prime_blob)) {
return false;
}
maxp *maxp_prime = (maxp *) hb_blob_get_data (maxp_prime_blob, nullptr);
maxp_prime->numGlyphs = c->plan->num_output_glyphs ();
if (maxp_prime->version.major == 1)
{
const maxpV1Tail *src_v1 = &StructAfter<maxpV1Tail> (*this);
maxpV1Tail *dest_v1 = c->serializer->embed<maxpV1Tail> (src_v1);
if (unlikely (!dest_v1)) return_trace (false);
maxp_prime->set_num_glyphs (plan->num_output_glyphs ());
if (plan->drop_hints)
drop_hint_fields (plan, maxp_prime);
if (c->plan->drop_hints)
drop_hint_fields (dest_v1);
}
bool result = plan->add_table (HB_OT_TAG_maxp, maxp_prime_blob);
hb_blob_destroy (maxp_prime_blob);
return result;
return_trace (true);
}
static void drop_hint_fields (hb_subset_plan_t *plan HB_UNUSED, maxp *maxp_prime)
static void drop_hint_fields (maxpV1Tail* dest_v1)
{
if (maxp_prime->version.major == 1)
{
maxpV1Tail &v1 = StructAfter<maxpV1Tail> (*maxp_prime);
v1.maxZones = 1;
v1.maxTwilightPoints = 0;
v1.maxStorage = 0;
v1.maxFunctionDefs = 0;
v1.maxInstructionDefs = 0;
v1.maxStackElements = 0;
v1.maxSizeOfInstructions = 0;
}
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:
......
......@@ -181,7 +181,7 @@ _subset_table (hb_subset_plan_t *plan,
result = _subset2<const OT::vmtx> (plan);
break;
case HB_OT_TAG_maxp:
result = _subset<const OT::maxp> (plan);
result = _subset2<const OT::maxp> (plan);
break;
case HB_OT_TAG_loca:
DEBUG_MSG(SUBSET, nullptr, "skip loca handled by glyf");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册