|
|
|
@ -81,14 +81,13 @@ _add_head_and_set_loca_version (hb_subset_plan_t *plan, bool use_short_loca) |
|
|
|
|
template<typename Iterator, |
|
|
|
|
hb_requires (hb_is_source_of (Iterator, unsigned int))> |
|
|
|
|
static bool |
|
|
|
|
_add_loca_and_head (hb_subset_plan_t * plan, |
|
|
|
|
_add_loca_and_head (hb_subset_context_t *c, |
|
|
|
|
Iterator padded_offsets, |
|
|
|
|
const hb_sorted_vector_t<hb_codepoint_pair_t> new_to_old_gid_list, |
|
|
|
|
unsigned num_glyphs, |
|
|
|
|
bool use_short_loca) |
|
|
|
|
{ |
|
|
|
|
unsigned num_offsets = num_glyphs + 1; |
|
|
|
|
unsigned num_offsets = c->plan->num_output_glyphs () + 1; |
|
|
|
|
unsigned entry_size = use_short_loca ? 2 : 4; |
|
|
|
|
|
|
|
|
|
char *loca_prime_data = (char *) hb_malloc (entry_size * num_offsets); |
|
|
|
|
|
|
|
|
|
if (unlikely (!loca_prime_data)) return false; |
|
|
|
@ -97,9 +96,9 @@ _add_loca_and_head (hb_subset_plan_t * plan, |
|
|
|
|
entry_size, num_offsets, entry_size * num_offsets); |
|
|
|
|
|
|
|
|
|
if (use_short_loca) |
|
|
|
|
_write_loca (padded_offsets, new_to_old_gid_list, true, (HBUINT16 *) loca_prime_data, num_offsets); |
|
|
|
|
_write_loca (padded_offsets, c->plan->new_to_old_gid_list, true, (HBUINT16 *) loca_prime_data, num_offsets); |
|
|
|
|
else |
|
|
|
|
_write_loca (padded_offsets, new_to_old_gid_list, false, (HBUINT32 *) loca_prime_data, num_offsets); |
|
|
|
|
_write_loca (padded_offsets, c->plan->new_to_old_gid_list, false, (HBUINT32 *) loca_prime_data, num_offsets); |
|
|
|
|
|
|
|
|
|
hb_blob_t *loca_blob = hb_blob_create (loca_prime_data, |
|
|
|
|
entry_size * num_offsets, |
|
|
|
@ -107,8 +106,8 @@ _add_loca_and_head (hb_subset_plan_t * plan, |
|
|
|
|
loca_prime_data, |
|
|
|
|
hb_free); |
|
|
|
|
|
|
|
|
|
bool result = plan->add_table (HB_OT_TAG_loca, loca_blob) |
|
|
|
|
&& _add_head_and_set_loca_version (plan, use_short_loca); |
|
|
|
|
bool result = c->plan->add_table (HB_OT_TAG_loca, loca_blob) |
|
|
|
|
&& _add_head_and_set_loca_version (c->plan, use_short_loca); |
|
|
|
|
|
|
|
|
|
hb_blob_destroy (loca_blob); |
|
|
|
|
return result; |
|
|
|
|