[subset-plan] Simplify hmtx_map / vmtx_map allocation
This commit is contained in:
parent
33ce3a0d44
commit
75b33cb04b
|
@ -96,12 +96,12 @@ struct Glyph
|
||||||
unsigned hori_aw = roundf (rightSideX - leftSideX);
|
unsigned hori_aw = roundf (rightSideX - leftSideX);
|
||||||
if (hori_aw < 0) hori_aw = 0;
|
if (hori_aw < 0) hori_aw = 0;
|
||||||
int lsb = roundf (xMin - leftSideX);
|
int lsb = roundf (xMin - leftSideX);
|
||||||
plan->hmtx_map->set (new_gid, hb_pair (hori_aw, lsb));
|
plan->hmtx_map.set (new_gid, hb_pair (hori_aw, lsb));
|
||||||
|
|
||||||
unsigned vert_aw = roundf (topSideY - bottomSideY);
|
unsigned vert_aw = roundf (topSideY - bottomSideY);
|
||||||
if (vert_aw < 0) vert_aw = 0;
|
if (vert_aw < 0) vert_aw = 0;
|
||||||
int tsb = roundf (topSideY - yMax);
|
int tsb = roundf (topSideY - yMax);
|
||||||
plan->vmtx_map->set (new_gid, hb_pair (vert_aw, tsb));
|
plan->vmtx_map.set (new_gid, hb_pair (vert_aw, tsb));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool compile_header_bytes (const hb_subset_plan_t *plan,
|
bool compile_header_bytes (const hb_subset_plan_t *plan,
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct hmtxvmtx
|
||||||
}
|
}
|
||||||
|
|
||||||
const hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>>* get_mtx_map (const hb_subset_plan_t *plan) const
|
const hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>>* get_mtx_map (const hb_subset_plan_t *plan) const
|
||||||
{ return T::is_horizontal ? plan->hmtx_map : plan->vmtx_map; }
|
{ return T::is_horizontal ? &plan->hmtx_map : &plan->vmtx_map; }
|
||||||
|
|
||||||
bool subset_update_header (hb_subset_plan_t *plan,
|
bool subset_update_header (hb_subset_plan_t *plan,
|
||||||
unsigned int num_hmetrics) const
|
unsigned int num_hmetrics) const
|
||||||
|
|
|
@ -867,9 +867,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
|
||||||
plan->all_axes_pinned = false;
|
plan->all_axes_pinned = false;
|
||||||
plan->pinned_at_default = true;
|
plan->pinned_at_default = true;
|
||||||
|
|
||||||
plan->check_success (plan->vmtx_map = hb_hashmap_create<hb_codepoint_t, hb_pair_t<unsigned, int>> ());
|
|
||||||
plan->check_success (plan->hmtx_map = hb_hashmap_create<hb_codepoint_t, hb_pair_t<unsigned, int>> ());
|
|
||||||
|
|
||||||
#ifdef HB_EXPERIMENTAL_API
|
#ifdef HB_EXPERIMENTAL_API
|
||||||
plan->check_success (plan->name_table_overrides = hb_hashmap_create<hb_ot_name_record_ids_t, hb_bytes_t> ());
|
plan->check_success (plan->name_table_overrides = hb_hashmap_create<hb_ot_name_record_ids_t, hb_bytes_t> ());
|
||||||
if (plan->name_table_overrides && input->name_table_overrides)
|
if (plan->name_table_overrides && input->name_table_overrides)
|
||||||
|
|
|
@ -58,8 +58,6 @@ struct hb_subset_plan_t
|
||||||
hb_map_destroy (axes_old_index_tag_map);
|
hb_map_destroy (axes_old_index_tag_map);
|
||||||
|
|
||||||
hb_hashmap_destroy (axes_location);
|
hb_hashmap_destroy (axes_location);
|
||||||
hb_hashmap_destroy (hmtx_map);
|
|
||||||
hb_hashmap_destroy (vmtx_map);
|
|
||||||
|
|
||||||
#ifdef HB_EXPERIMENTAL_API
|
#ifdef HB_EXPERIMENTAL_API
|
||||||
if (name_table_overrides)
|
if (name_table_overrides)
|
||||||
|
@ -172,9 +170,9 @@ struct hb_subset_plan_t
|
||||||
bool has_seac;
|
bool has_seac;
|
||||||
|
|
||||||
//hmtx metrics map: new gid->(advance, lsb)
|
//hmtx metrics map: new gid->(advance, lsb)
|
||||||
hb_hashmap_t<hb_codepoint_t, hb_pair_t<unsigned, int>> *hmtx_map;
|
mutable hb_hashmap_t<hb_codepoint_t, hb_pair_t<unsigned, int>> hmtx_map;
|
||||||
//vmtx metrics map: new gid->(advance, lsb)
|
//vmtx metrics map: new gid->(advance, lsb)
|
||||||
hb_hashmap_t<hb_codepoint_t, hb_pair_t<unsigned, int>> *vmtx_map;
|
mutable hb_hashmap_t<hb_codepoint_t, hb_pair_t<unsigned, int>> vmtx_map;
|
||||||
|
|
||||||
#ifdef HB_EXPERIMENTAL_API
|
#ifdef HB_EXPERIMENTAL_API
|
||||||
// name table overrides map: hb_ot_name_record_ids_t-> name string new value or
|
// name table overrides map: hb_ot_name_record_ids_t-> name string new value or
|
||||||
|
|
Loading…
Reference in New Issue