Move add_lookups from map to map-builder

In prep for more changes.
pull/279/head
Behdad Esfahbod 8 years ago
parent 26648cebcd
commit bde5e3959c
  1. 15
      src/hb-ot-map-private.hh
  2. 29
      src/hb-ot-map.cc

@ -139,12 +139,6 @@ struct hb_ot_map_t
private:
HB_INTERNAL void add_lookups (hb_face_t *face,
unsigned int table_index,
unsigned int feature_index,
hb_mask_t mask,
bool auto_zwj);
hb_mask_t global_mask;
hb_prealloced_array_t<feature_map_t, 8> features;
@ -182,7 +176,7 @@ struct hb_ot_map_builder_t
inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func)
{ add_pause (1, pause_func); }
HB_INTERNAL void compile (struct hb_ot_map_t &m);
HB_INTERNAL void compile (hb_ot_map_t &m);
inline void finish (void) {
feature_infos.finish ();
@ -194,6 +188,13 @@ struct hb_ot_map_builder_t
private:
HB_INTERNAL void add_lookups (hb_ot_map_t &m,
hb_face_t *face,
unsigned int table_index,
unsigned int feature_index,
hb_mask_t mask,
bool auto_zwj);
struct feature_info_t {
hb_tag_t tag;
unsigned int seq; /* sequence#, used for stable sorting only */

@ -32,11 +32,12 @@
void
hb_ot_map_t::add_lookups (hb_face_t *face,
unsigned int table_index,
unsigned int feature_index,
hb_mask_t mask,
bool auto_zwj)
hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m,
hb_face_t *face,
unsigned int table_index,
unsigned int feature_index,
hb_mask_t mask,
bool auto_zwj)
{
unsigned int lookup_indices[32];
unsigned int offset, len;
@ -57,7 +58,7 @@ hb_ot_map_t::add_lookups (hb_face_t *face,
{
if (lookup_indices[i] >= table_lookup_count)
continue;
hb_ot_map_t::lookup_map_t *lookup = lookups[table_index].push ();
hb_ot_map_t::lookup_map_t *lookup = m.lookups[table_index].push ();
if (unlikely (!lookup))
return;
lookup->mask = mask;
@ -268,17 +269,17 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
{
if (required_feature_index[table_index] != HB_OT_LAYOUT_NO_FEATURE_INDEX &&
required_feature_stage[table_index] == stage)
m.add_lookups (face, table_index,
required_feature_index[table_index],
1 /* mask */,
true /* auto_zwj */);
add_lookups (m, face, table_index,
required_feature_index[table_index],
1 /* mask */,
true /* auto_zwj */);
for (unsigned i = 0; i < m.features.len; i++)
if (m.features[i].stage[table_index] == stage)
m.add_lookups (face, table_index,
m.features[i].index[table_index],
m.features[i].mask,
m.features[i].auto_zwj);
add_lookups (m, face, table_index,
m.features[i].index[table_index],
m.features[i].mask,
m.features[i].auto_zwj);
/* Sort lookups and merge duplicates */
if (last_num_lookups < m.lookups[table_index].len)

Loading…
Cancel
Save