diff options
author | Garret Rieger <grieger@google.com> | 2019-01-28 17:05:04 -0800 |
---|---|---|
committer | Garret Rieger <grieger@google.com> | 2019-01-29 13:19:21 -0800 |
commit | 05e99c86baa0e95c2bff1c87d601eaf022c9d1f8 (patch) | |
tree | 9affc813acf360d49083ed98902d89ac2eab9e5f | |
parent | bdbe047d6ce3d8873c6740500d38d1b0c4e851f8 (diff) |
[subset] A few small fixes for the new subset plan api.
-rw-r--r-- | src/hb-ot-hdmx-table.hh | 6 | ||||
-rw-r--r-- | src/hb-ot-hmtx-table.hh | 9 | ||||
-rw-r--r-- | src/hb-subset.cc | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh index b1ad3eb0..953ccab8 100644 --- a/src/hb-ot-hdmx-table.hh +++ b/src/hb-ot-hdmx-table.hh @@ -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 diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index c743e086..9ef1f571 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -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); } diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 37e7cec2..135265fc 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -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; |