[beyond-64k/subset] Implement subsetting of hmtx beyond64k
This commit is contained in:
parent
b3da715b9c
commit
639f45ef9e
|
@ -168,12 +168,18 @@ struct hmtxvmtx
|
||||||
lm.sb = _.second;
|
lm.sb = _.second;
|
||||||
if (unlikely (!c->embed<LongMetric> (&lm))) return;
|
if (unlikely (!c->embed<LongMetric> (&lm))) return;
|
||||||
}
|
}
|
||||||
else
|
else if (idx < 0x10000u)
|
||||||
{
|
{
|
||||||
FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size);
|
FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size);
|
||||||
if (unlikely (!sb)) return;
|
if (unlikely (!sb)) return;
|
||||||
*sb = _.second;
|
*sb = _.second;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UFWORD *adv = c->allocate_size<UFWORD> (UFWORD::static_size);
|
||||||
|
if (unlikely (!adv)) return;
|
||||||
|
*adv = _.first;
|
||||||
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +198,7 @@ struct hmtxvmtx
|
||||||
/* Determine num_long_metrics to encode. */
|
/* Determine num_long_metrics to encode. */
|
||||||
auto& plan = c->plan;
|
auto& plan = c->plan;
|
||||||
|
|
||||||
num_long_metrics = plan->num_output_glyphs ();
|
num_long_metrics = hb_min (plan->num_output_glyphs (), 0xFFFFu);
|
||||||
unsigned int last_advance = get_new_gid_advance_unscaled (plan, mtx_map, num_long_metrics - 1, _mtx);
|
unsigned int last_advance = get_new_gid_advance_unscaled (plan, mtx_map, num_long_metrics - 1, _mtx);
|
||||||
while (num_long_metrics > 1 &&
|
while (num_long_metrics > 1 &&
|
||||||
last_advance == get_new_gid_advance_unscaled (plan, mtx_map, num_long_metrics - 2, _mtx))
|
last_advance == get_new_gid_advance_unscaled (plan, mtx_map, num_long_metrics - 2, _mtx))
|
||||||
|
|
Loading…
Reference in New Issue