Rename "pause" to "stage"

The compile() function is starting to become illegible...
This commit is contained in:
Behdad Esfahbod 2013-04-21 15:19:38 -04:00
parent dd0641a432
commit 8ac3c9c0b6
2 changed files with 31 additions and 31 deletions

View File

@ -67,7 +67,7 @@ struct hb_ot_map_t
typedef void (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer);
struct pause_map_t {
struct stage_map_t {
unsigned int num_lookups; /* Cumulative */
pause_func_t callback;
};
@ -110,9 +110,9 @@ struct hb_ot_map_t
*lookup_count = 0;
return;
}
assert (stage <= pauses[table_index].len);
unsigned int start = stage ? pauses[table_index][stage - 1].num_lookups : 0;
unsigned int end = stage < pauses[table_index].len ? pauses[table_index][stage].num_lookups : lookups[table_index].len;
assert (stage <= stages[table_index].len);
unsigned int start = stage ? stages[table_index][stage - 1].num_lookups : 0;
unsigned int end = stage < stages[table_index].len ? stages[table_index][stage].num_lookups : lookups[table_index].len;
*plookups = &lookups[table_index][start];
*lookup_count = end - start;
}
@ -125,8 +125,8 @@ struct hb_ot_map_t
features.finish ();
lookups[0].finish ();
lookups[1].finish ();
pauses[0].finish ();
pauses[1].finish ();
stages[0].finish ();
stages[1].finish ();
}
public:
@ -145,7 +145,7 @@ struct hb_ot_map_t
hb_prealloced_array_t<feature_map_t, 8> features;
hb_prealloced_array_t<lookup_map_t, 32> lookups[2]; /* GSUB/GPOS */
hb_prealloced_array_t<pause_map_t, 1> pauses[2]; /* GSUB/GPOS */
hb_prealloced_array_t<stage_map_t, 1> stages[2]; /* GSUB/GPOS */
};
enum hb_ot_map_feature_flags_t {
@ -195,8 +195,8 @@ struct hb_ot_map_builder_t
inline void finish (void) {
feature_infos.finish ();
pauses[0].finish ();
pauses[1].finish ();
stages[0].finish ();
stages[1].finish ();
}
private:
@ -213,8 +213,8 @@ struct hb_ot_map_builder_t
{ return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) : (a->seq < b->seq ? -1 : 1); }
};
struct pause_info_t {
unsigned int stage;
struct stage_info_t {
unsigned int index;
hb_ot_map_t::pause_func_t callback;
};
@ -233,7 +233,7 @@ struct hb_ot_map_builder_t
unsigned int current_stage[2]; /* GSUB/GPOS */
hb_prealloced_array_t<feature_info_t,16> feature_infos;
hb_prealloced_array_t<pause_info_t, 1> pauses[2]; /* GSUB/GPOS */
hb_prealloced_array_t<stage_info_t, 1> stages[2]; /* GSUB/GPOS */
};

View File

@ -107,18 +107,18 @@ void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, h
const unsigned int table_index = 0;
unsigned int i = 0;
for (unsigned int pause_index = 0; pause_index < pauses[table_index].len; pause_index++) {
const pause_map_t *pause = &pauses[table_index][pause_index];
for (; i < pause->num_lookups; i++)
for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) {
const stage_map_t *stage = &stages[table_index][stage_index];
for (; i < stage->num_lookups; i++)
hb_ot_layout_substitute_lookup (font, buffer,
lookups[table_index][i].index,
lookups[table_index][i].mask,
lookups[table_index][i].auto_zwj);
if (pause->callback)
if (stage->callback)
{
buffer->clear_output ();
pause->callback (plan, font, buffer);
stage->callback (plan, font, buffer);
}
}
}
@ -128,15 +128,15 @@ void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
const unsigned int table_index = 1;
unsigned int i = 0;
for (unsigned int pause_index = 0; pause_index < pauses[table_index].len; pause_index++) {
const pause_map_t *pause = &pauses[table_index][pause_index];
for (; i < pause->num_lookups; i++)
for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) {
const stage_map_t *stage = &stages[table_index][stage_index];
for (; i < stage->num_lookups; i++)
hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index,
lookups[table_index][i].mask,
lookups[table_index][i].auto_zwj);
if (pause->callback)
pause->callback (plan, font, buffer);
if (stage->callback)
stage->callback (plan, font, buffer);
}
}
@ -148,10 +148,10 @@ void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_o
void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
{
pause_info_t *p = pauses[table_index].push ();
if (likely (p)) {
p->stage = current_stage[table_index];
p->callback = pause_func;
stage_info_t *s = stages[table_index].push ();
if (likely (s)) {
s->index = current_stage[table_index];
s->callback = pause_func;
}
current_stage[table_index]++;
@ -268,7 +268,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
&required_feature_index))
m.add_lookups (face, table_index, required_feature_index, 1, true);
unsigned int pause_index = 0;
unsigned int stage_index = 0;
unsigned int last_num_lookups = 0;
for (unsigned stage = 0; stage < current_stage[table_index]; stage++)
{
@ -298,14 +298,14 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
last_num_lookups = m.lookups[table_index].len;
if (pause_index < pauses[table_index].len && pauses[table_index][pause_index].stage == stage) {
hb_ot_map_t::pause_map_t *pause_map = m.pauses[table_index].push ();
if (stage_index < stages[table_index].len && stages[table_index][stage_index].index == stage) {
hb_ot_map_t::stage_map_t *pause_map = m.stages[table_index].push ();
if (likely (pause_map)) {
pause_map->num_lookups = last_num_lookups;
pause_map->callback = pauses[table_index][pause_index].callback;
pause_map->callback = stages[table_index][stage_index].callback;
}
pause_index++;
stage_index++;
}
}
}