[subset-plan] Simplify layout_variation_idx_delta_map allocation
This commit is contained in:
parent
9c45d98f73
commit
b33eb9ecfc
|
@ -51,9 +51,9 @@ struct AnchorFormat3
|
|||
if (unlikely (!c->serializer->embed (yCoordinate))) return_trace (false);
|
||||
|
||||
unsigned x_varidx = xDeviceTable ? (this+xDeviceTable).get_variation_index () : HB_OT_LAYOUT_NO_VARIATIONS_INDEX;
|
||||
if (c->plan->layout_variation_idx_delta_map->has (x_varidx))
|
||||
if (c->plan->layout_variation_idx_delta_map.has (x_varidx))
|
||||
{
|
||||
int delta = hb_second (c->plan->layout_variation_idx_delta_map->get (x_varidx));
|
||||
int delta = hb_second (c->plan->layout_variation_idx_delta_map.get (x_varidx));
|
||||
if (delta != 0)
|
||||
{
|
||||
if (!c->serializer->check_assign (out->xCoordinate, xCoordinate + delta,
|
||||
|
@ -63,9 +63,9 @@ struct AnchorFormat3
|
|||
}
|
||||
|
||||
unsigned y_varidx = yDeviceTable ? (this+yDeviceTable).get_variation_index () : HB_OT_LAYOUT_NO_VARIATIONS_INDEX;
|
||||
if (c->plan->layout_variation_idx_delta_map->has (y_varidx))
|
||||
if (c->plan->layout_variation_idx_delta_map.has (y_varidx))
|
||||
{
|
||||
int delta = hb_second (c->plan->layout_variation_idx_delta_map->get (y_varidx));
|
||||
int delta = hb_second (c->plan->layout_variation_idx_delta_map.get (y_varidx));
|
||||
if (delta != 0)
|
||||
{
|
||||
if (!c->serializer->check_assign (out->yCoordinate, yCoordinate + delta,
|
||||
|
@ -80,8 +80,8 @@ struct AnchorFormat3
|
|||
if (!c->serializer->embed (xDeviceTable)) return_trace (false);
|
||||
if (!c->serializer->embed (yDeviceTable)) return_trace (false);
|
||||
|
||||
out->xDeviceTable.serialize_copy (c->serializer, xDeviceTable, this, 0, hb_serialize_context_t::Head, c->plan->layout_variation_idx_delta_map);
|
||||
out->yDeviceTable.serialize_copy (c->serializer, yDeviceTable, this, 0, hb_serialize_context_t::Head, c->plan->layout_variation_idx_delta_map);
|
||||
out->xDeviceTable.serialize_copy (c->serializer, xDeviceTable, this, 0, hb_serialize_context_t::Head, &c->plan->layout_variation_idx_delta_map);
|
||||
out->yDeviceTable.serialize_copy (c->serializer, yDeviceTable, this, 0, hb_serialize_context_t::Head, &c->plan->layout_variation_idx_delta_map);
|
||||
return_trace (out);
|
||||
}
|
||||
|
||||
|
|
|
@ -298,8 +298,8 @@ struct PairPosFormat2_4
|
|||
for (unsigned class2_idx : + hb_range ((unsigned) class2Count) | hb_filter (klass2_map))
|
||||
{
|
||||
unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2);
|
||||
valueFormat1.copy_values (c->serializer, out->valueFormat1, this, &values[idx], c->plan->layout_variation_idx_delta_map);
|
||||
valueFormat2.copy_values (c->serializer, out->valueFormat2, this, &values[idx + len1], c->plan->layout_variation_idx_delta_map);
|
||||
valueFormat1.copy_values (c->serializer, out->valueFormat1, this, &values[idx], &c->plan->layout_variation_idx_delta_map);
|
||||
valueFormat2.copy_values (c->serializer, out->valueFormat2, this, &values[idx + len1], &c->plan->layout_variation_idx_delta_map);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ struct PairSet
|
|||
newFormats,
|
||||
len1,
|
||||
&glyph_map,
|
||||
c->plan->layout_variation_idx_delta_map
|
||||
&c->plan->layout_variation_idx_delta_map
|
||||
};
|
||||
|
||||
const PairValueRecord *record = &firstPairValueRecord;
|
||||
|
|
|
@ -144,7 +144,7 @@ struct SinglePosFormat1
|
|||
;
|
||||
|
||||
bool ret = bool (it);
|
||||
SinglePos_serialize (c->serializer, this, it, c->plan->layout_variation_idx_delta_map, c->plan->all_axes_pinned);
|
||||
SinglePos_serialize (c->serializer, this, it, &c->plan->layout_variation_idx_delta_map, c->plan->all_axes_pinned);
|
||||
return_trace (ret);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -163,7 +163,7 @@ struct SinglePosFormat2
|
|||
;
|
||||
|
||||
bool ret = bool (it);
|
||||
SinglePos_serialize (c->serializer, this, it, c->plan->layout_variation_idx_delta_map, c->plan->all_axes_pinned);
|
||||
SinglePos_serialize (c->serializer, this, it, &c->plan->layout_variation_idx_delta_map, c->plan->all_axes_pinned);
|
||||
return_trace (ret);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -206,9 +206,9 @@ struct CaretValueFormat3
|
|||
if (!c->serializer->embed (coordinate)) return_trace (false);
|
||||
|
||||
unsigned varidx = (this+deviceTable).get_variation_index ();
|
||||
if (c->plan->layout_variation_idx_delta_map->has (varidx))
|
||||
if (c->plan->layout_variation_idx_delta_map.has (varidx))
|
||||
{
|
||||
int delta = hb_second (c->plan->layout_variation_idx_delta_map->get (varidx));
|
||||
int delta = hb_second (c->plan->layout_variation_idx_delta_map.get (varidx));
|
||||
if (delta != 0)
|
||||
{
|
||||
if (!c->serializer->check_assign (out->coordinate, coordinate + delta, HB_SERIALIZE_ERROR_INT_OVERFLOW))
|
||||
|
@ -223,7 +223,7 @@ struct CaretValueFormat3
|
|||
return_trace (false);
|
||||
|
||||
return_trace (out->deviceTable.serialize_copy (c->serializer, deviceTable, this, c->serializer->to_bias (out),
|
||||
hb_serialize_context_t::Head, c->plan->layout_variation_idx_delta_map));
|
||||
hb_serialize_context_t::Head, &c->plan->layout_variation_idx_delta_map));
|
||||
}
|
||||
|
||||
void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
|
||||
|
|
|
@ -380,7 +380,7 @@ _collect_layout_variation_indices (hb_subset_plan_t* plan)
|
|||
}
|
||||
|
||||
OT::hb_collect_variation_indices_context_t c (&varidx_set,
|
||||
plan->layout_variation_idx_delta_map,
|
||||
&plan->layout_variation_idx_delta_map,
|
||||
font, var_store,
|
||||
&plan->_glyphset_gsub,
|
||||
&plan->gpos_lookups,
|
||||
|
@ -393,7 +393,7 @@ _collect_layout_variation_indices (hb_subset_plan_t* plan)
|
|||
hb_font_destroy (font);
|
||||
var_store->destroy_cache (store_cache);
|
||||
|
||||
gdef->remap_layout_variation_indices (&varidx_set, plan->layout_variation_idx_delta_map);
|
||||
gdef->remap_layout_variation_indices (&varidx_set, &plan->layout_variation_idx_delta_map);
|
||||
|
||||
unsigned subtable_count = gdef->has_var_store () ? gdef->get_var_store ().get_sub_table_count () : 0;
|
||||
_generate_varstore_inner_maps (varidx_set, subtable_count, plan->gdef_varstore_inner_maps);
|
||||
|
@ -857,7 +857,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
|||
plan->reverse_glyph_map = hb_map_create ();
|
||||
plan->glyph_map_gsub = hb_map_create ();
|
||||
|
||||
plan->check_success (plan->layout_variation_idx_delta_map = hb_hashmap_create<unsigned, hb_pair_t<unsigned, int>> ());
|
||||
plan->gdef_varstore_inner_maps.init ();
|
||||
|
||||
plan->check_success (plan->axes_location = hb_hashmap_create<hb_tag_t, int> ());
|
||||
|
|
|
@ -64,7 +64,6 @@ struct hb_subset_plan_t
|
|||
hb_hashmap_destroy (axes_location);
|
||||
hb_hashmap_destroy (hmtx_map);
|
||||
hb_hashmap_destroy (vmtx_map);
|
||||
hb_hashmap_destroy (layout_variation_idx_delta_map);
|
||||
|
||||
#ifdef HB_EXPERIMENTAL_API
|
||||
if (name_table_overrides)
|
||||
|
@ -161,7 +160,7 @@ struct hb_subset_plan_t
|
|||
hb_map_t colr_palettes;
|
||||
|
||||
//Old layout item variation index -> (New varidx, delta) mapping
|
||||
hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *layout_variation_idx_delta_map;
|
||||
hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> layout_variation_idx_delta_map;
|
||||
|
||||
//gdef varstore retained varidx mapping
|
||||
hb_vector_t<hb_inc_bimap_t> gdef_varstore_inner_maps;
|
||||
|
|
Loading…
Reference in New Issue