[subset] A few small fixes for the new subset plan api.
This commit is contained in:
parent
bdbe047d6c
commit
05e99c86ba
|
@ -57,7 +57,7 @@ struct DeviceRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int len () const
|
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
|
const HBUINT8* operator [] (unsigned int new_gid) const
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ struct hdmx
|
||||||
|
|
||||||
this->version.set (source_hdmx->version);
|
this->version.set (source_hdmx->version);
|
||||||
this->numRecords.set (source_hdmx->numRecords);
|
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++)
|
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)
|
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
|
bool subset (hb_subset_plan_t *plan) const
|
||||||
|
|
|
@ -108,10 +108,7 @@ struct hmtxvmtx
|
||||||
DEBUG_MSG(SUBSET, nullptr, "%c%c%c%c in dest has %d advances, %d lsbs, %u bytes",
|
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);
|
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
|
// Copy everything over
|
||||||
LongMetric * old_metrics = (LongMetric *) source_table;
|
|
||||||
FWORD *lsbs = (FWORD *) (old_metrics + _mtx.num_advances);
|
|
||||||
char * dest_pos = (char *) dest;
|
char * dest_pos = (char *) dest;
|
||||||
|
|
||||||
bool failed = false;
|
bool failed = false;
|
||||||
|
@ -131,12 +128,12 @@ struct hmtxvmtx
|
||||||
bool has_advance = i < num_advances;
|
bool has_advance = i < num_advances;
|
||||||
if (has_advance)
|
if (has_advance)
|
||||||
{
|
{
|
||||||
((LongMetric *) dest_pos)->advance = advance;
|
((LongMetric *) dest_pos)->advance.set (advance);
|
||||||
((LongMetric *) dest_pos)->sb = side_bearing;
|
((LongMetric *) dest_pos)->sb.set (side_bearing);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*((FWORD *) dest_pos) = side_bearing;
|
((FWORD *) dest_pos)->set (side_bearing);
|
||||||
}
|
}
|
||||||
dest_pos += (has_advance ? 4 : 2);
|
dest_pos += (has_advance ? 4 : 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ _plan_estimate_subset_table_size (hb_subset_plan_t *plan,
|
||||||
unsigned int table_len)
|
unsigned int table_len)
|
||||||
{
|
{
|
||||||
unsigned int src_glyphs = plan->source->get_num_glyphs ();
|
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))
|
if (unlikely (!src_glyphs))
|
||||||
return 512 + table_len;
|
return 512 + table_len;
|
||||||
|
|
Loading…
Reference in New Issue