[subset] A few small fixes for the new subset plan api.

This commit is contained in:
Garret Rieger 2019-01-28 17:05:04 -08:00
parent bdbe047d6c
commit 05e99c86ba
3 changed files with 7 additions and 10 deletions

View File

@ -57,7 +57,7 @@ struct DeviceRecord
}
unsigned int len () const
{ return this->subset_plan->num_glyphs; }
{ return this->subset_plan->num_output_glyphs (); }
const HBUINT8* operator [] (unsigned int new_gid) const
{
@ -143,7 +143,7 @@ struct hdmx
this->version.set (source_hdmx->version);
this->numRecords.set (source_hdmx->numRecords);
this->sizeDeviceRecord.set (DeviceRecord::get_size (plan->num_glyphs));
this->sizeDeviceRecord.set (DeviceRecord::get_size (plan->num_output_glyphs ()));
for (unsigned int i = 0; i < source_hdmx->numRecords; i++)
{
@ -159,7 +159,7 @@ struct hdmx
static size_t get_subsetted_size (const hdmx *source_hdmx, hb_subset_plan_t *plan)
{
return min_size + source_hdmx->numRecords * DeviceRecord::get_size (plan->num_glyphs);
return min_size + source_hdmx->numRecords * DeviceRecord::get_size (plan->num_output_glyphs ());
}
bool subset (hb_subset_plan_t *plan) const

View File

@ -108,10 +108,7 @@ struct hmtxvmtx
DEBUG_MSG(SUBSET, nullptr, "%c%c%c%c in dest has %d advances, %d lsbs, %u bytes",
HB_UNTAG(T::tableTag), num_advances, num_output_glyphs - num_advances, (unsigned int) dest_sz);
const char *source_table = hb_blob_get_data (_mtx.table.get_blob (), nullptr);
// Copy everything over
LongMetric * old_metrics = (LongMetric *) source_table;
FWORD *lsbs = (FWORD *) (old_metrics + _mtx.num_advances);
char * dest_pos = (char *) dest;
bool failed = false;
@ -131,12 +128,12 @@ struct hmtxvmtx
bool has_advance = i < num_advances;
if (has_advance)
{
((LongMetric *) dest_pos)->advance = advance;
((LongMetric *) dest_pos)->sb = side_bearing;
((LongMetric *) dest_pos)->advance.set (advance);
((LongMetric *) dest_pos)->sb.set (side_bearing);
}
else
{
*((FWORD *) dest_pos) = side_bearing;
((FWORD *) dest_pos)->set (side_bearing);
}
dest_pos += (has_advance ? 4 : 2);
}

View File

@ -52,7 +52,7 @@ _plan_estimate_subset_table_size (hb_subset_plan_t *plan,
unsigned int table_len)
{
unsigned int src_glyphs = plan->source->get_num_glyphs ();
unsigned int dst_glyphs = plan->glyphset->get_population ();
unsigned int dst_glyphs = plan->glyphset ()->get_population ();
if (unlikely (!src_glyphs))
return 512 + table_len;