More massaging
This commit is contained in:
parent
16c6a27b4b
commit
3e38c0f288
|
@ -62,15 +62,11 @@ struct hb_ot_map_t
|
||||||
{ return a->index < b->index ? -1 : a->index > b->index ? 1 : 0; }
|
{ return a->index < b->index ? -1 : a->index > b->index ? 1 : 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*pause_func_t) (const hb_ot_map_t *map, hb_font_t *font, hb_buffer_t *buffer, void *user_data);
|
typedef void (*pause_func_t) (const hb_ot_map_t *map, hb_font_t *font, hb_buffer_t *buffer);
|
||||||
typedef struct {
|
|
||||||
pause_func_t func;
|
|
||||||
void *user_data;
|
|
||||||
} pause_callback_t;
|
|
||||||
|
|
||||||
struct pause_map_t {
|
struct pause_map_t {
|
||||||
unsigned int num_lookups; /* Cumulative */
|
unsigned int num_lookups; /* Cumulative */
|
||||||
pause_callback_t callback;
|
pause_func_t callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,10 +152,10 @@ struct hb_ot_map_builder_t
|
||||||
inline void add_bool_feature (hb_tag_t tag, bool global = true)
|
inline void add_bool_feature (hb_tag_t tag, bool global = true)
|
||||||
{ add_feature (tag, 1, global); }
|
{ add_feature (tag, 1, global); }
|
||||||
|
|
||||||
inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func, void *user_data)
|
inline void add_gsub_pause (hb_ot_map_t::pause_func_t pause_func)
|
||||||
{ add_pause (0, pause_func, user_data); }
|
{ add_pause (0, pause_func); }
|
||||||
inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func, void *user_data)
|
inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func)
|
||||||
{ add_pause (1, pause_func, user_data); }
|
{ add_pause (1, pause_func); }
|
||||||
|
|
||||||
HB_INTERNAL void compile (hb_face_t *face,
|
HB_INTERNAL void compile (hb_face_t *face,
|
||||||
const hb_segment_properties_t *props,
|
const hb_segment_properties_t *props,
|
||||||
|
@ -187,10 +183,10 @@ struct hb_ot_map_builder_t
|
||||||
|
|
||||||
struct pause_info_t {
|
struct pause_info_t {
|
||||||
unsigned int stage;
|
unsigned int stage;
|
||||||
hb_ot_map_t::pause_callback_t callback;
|
hb_ot_map_t::pause_func_t callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
HB_INTERNAL void add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func, void *user_data);
|
HB_INTERNAL void add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func);
|
||||||
|
|
||||||
unsigned int current_stage[2]; /* GSUB/GPOS */
|
unsigned int current_stage[2]; /* GSUB/GPOS */
|
||||||
hb_prealloced_array_t<feature_info_t,16> feature_infos;
|
hb_prealloced_array_t<feature_info_t,16> feature_infos;
|
||||||
|
|
|
@ -87,8 +87,8 @@ void hb_ot_map_t::substitute (hb_font_t *font, hb_buffer_t *buffer) const
|
||||||
|
|
||||||
buffer->clear_output ();
|
buffer->clear_output ();
|
||||||
|
|
||||||
if (pause->callback.func)
|
if (pause->callback)
|
||||||
pause->callback.func (this, font, buffer, pause->callback.user_data);
|
pause->callback (this, font, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < lookups[table_index].len; i++)
|
for (; i < lookups[table_index].len; i++)
|
||||||
|
@ -105,8 +105,8 @@ void hb_ot_map_t::position (hb_font_t *font, hb_buffer_t *buffer) const
|
||||||
for (; i < pause->num_lookups; i++)
|
for (; i < pause->num_lookups; i++)
|
||||||
hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
|
hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index, lookups[table_index][i].mask);
|
||||||
|
|
||||||
if (pause->callback.func)
|
if (pause->callback)
|
||||||
pause->callback.func (this, font, buffer, pause->callback.user_data);
|
pause->callback (this, font, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < lookups[table_index].len; i++)
|
for (; i < lookups[table_index].len; i++)
|
||||||
|
@ -129,13 +129,12 @@ void hb_ot_map_t::substitute_closure (hb_face_t *face,
|
||||||
hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
|
hb_ot_layout_substitute_closure_lookup (face, glyphs, lookups[table_index][i].index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func, void *user_data)
|
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 ();
|
pause_info_t *p = pauses[table_index].push ();
|
||||||
if (likely (p)) {
|
if (likely (p)) {
|
||||||
p->stage = current_stage[table_index];
|
p->stage = current_stage[table_index];
|
||||||
p->callback.func = pause_func;
|
p->callback = pause_func;
|
||||||
p->callback.user_data = user_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
current_stage[table_index]++;
|
current_stage[table_index]++;
|
||||||
|
@ -249,8 +248,8 @@ hb_ot_map_builder_t::compile (hb_face_t *face,
|
||||||
feature_infos.shrink (0); /* Done with these */
|
feature_infos.shrink (0); /* Done with these */
|
||||||
|
|
||||||
|
|
||||||
add_gsub_pause (NULL, NULL);
|
add_gsub_pause (NULL);
|
||||||
add_gpos_pause (NULL, NULL);
|
add_gpos_pause (NULL);
|
||||||
|
|
||||||
for (unsigned int table_index = 0; table_index < 2; table_index++) {
|
for (unsigned int table_index = 0; table_index < 2; table_index++) {
|
||||||
hb_tag_t table_tag = table_tags[table_index];
|
hb_tag_t table_tag = table_tags[table_index];
|
||||||
|
|
|
@ -182,19 +182,19 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
|
||||||
map->add_bool_feature (HB_TAG('c','c','m','p'));
|
map->add_bool_feature (HB_TAG('c','c','m','p'));
|
||||||
map->add_bool_feature (HB_TAG('l','o','c','l'));
|
map->add_bool_feature (HB_TAG('l','o','c','l'));
|
||||||
|
|
||||||
map->add_gsub_pause (NULL, NULL);
|
map->add_gsub_pause (NULL);
|
||||||
|
|
||||||
unsigned int num_features = plan->props.script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
|
unsigned int num_features = plan->props.script == HB_SCRIPT_SYRIAC ? SYRIAC_NUM_FEATURES : COMMON_NUM_FEATURES;
|
||||||
for (unsigned int i = 0; i < num_features; i++)
|
for (unsigned int i = 0; i < num_features; i++)
|
||||||
map->add_bool_feature (arabic_syriac_features[i], false);
|
map->add_bool_feature (arabic_syriac_features[i], false);
|
||||||
|
|
||||||
map->add_gsub_pause (NULL, NULL);
|
map->add_gsub_pause (NULL);
|
||||||
|
|
||||||
map->add_bool_feature (HB_TAG('r','l','i','g'));
|
map->add_bool_feature (HB_TAG('r','l','i','g'));
|
||||||
map->add_gsub_pause (NULL, NULL);
|
map->add_gsub_pause (NULL);
|
||||||
|
|
||||||
map->add_bool_feature (HB_TAG('c','a','l','t'));
|
map->add_bool_feature (HB_TAG('c','a','l','t'));
|
||||||
map->add_gsub_pause (NULL, NULL);
|
map->add_gsub_pause (NULL);
|
||||||
|
|
||||||
/* ArabicOT spec enables 'cswh' for Arabic where as for basic shaper it's disabled by default. */
|
/* ArabicOT spec enables 'cswh' for Arabic where as for basic shaper it's disabled by default. */
|
||||||
map->add_bool_feature (HB_TAG('c','s','w','h'));
|
map->add_bool_feature (HB_TAG('c','s','w','h'));
|
||||||
|
|
|
@ -194,13 +194,11 @@ indic_other_features[] =
|
||||||
static void
|
static void
|
||||||
initial_reordering (const hb_ot_map_t *map,
|
initial_reordering (const hb_ot_map_t *map,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer);
|
||||||
void *user_data HB_UNUSED);
|
|
||||||
static void
|
static void
|
||||||
final_reordering (const hb_ot_map_t *map,
|
final_reordering (const hb_ot_map_t *map,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer);
|
||||||
void *user_data HB_UNUSED);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
collect_features_indic (hb_ot_shape_planner_t *plan)
|
collect_features_indic (hb_ot_shape_planner_t *plan)
|
||||||
|
@ -212,14 +210,14 @@ collect_features_indic (hb_ot_shape_planner_t *plan)
|
||||||
* there is a use of it, it's typically at the beginning. */
|
* there is a use of it, it's typically at the beginning. */
|
||||||
map->add_bool_feature (HB_TAG('c','c','m','p'));
|
map->add_bool_feature (HB_TAG('c','c','m','p'));
|
||||||
|
|
||||||
map->add_gsub_pause (initial_reordering, NULL);
|
map->add_gsub_pause (initial_reordering);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (indic_basic_features); i++) {
|
for (unsigned int i = 0; i < ARRAY_LENGTH (indic_basic_features); i++) {
|
||||||
map->add_bool_feature (indic_basic_features[i].tag, indic_basic_features[i].is_global);
|
map->add_bool_feature (indic_basic_features[i].tag, indic_basic_features[i].is_global);
|
||||||
map->add_gsub_pause (NULL, NULL);
|
map->add_gsub_pause (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
map->add_gsub_pause (final_reordering, NULL);
|
map->add_gsub_pause (final_reordering);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < ARRAY_LENGTH (indic_other_features); i++)
|
for (unsigned int i = 0; i < ARRAY_LENGTH (indic_other_features); i++)
|
||||||
map->add_bool_feature (indic_other_features[i].tag, indic_other_features[i].is_global);
|
map->add_bool_feature (indic_other_features[i].tag, indic_other_features[i].is_global);
|
||||||
|
@ -697,8 +695,7 @@ initial_reordering_non_indic (const hb_ot_map_t *map HB_UNUSED,
|
||||||
static void
|
static void
|
||||||
initial_reordering (const hb_ot_map_t *map,
|
initial_reordering (const hb_ot_map_t *map,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer)
|
||||||
void *user_data HB_UNUSED)
|
|
||||||
{
|
{
|
||||||
update_consonant_positions (map, buffer, font);
|
update_consonant_positions (map, buffer, font);
|
||||||
|
|
||||||
|
@ -1062,8 +1059,7 @@ final_reordering_syllable (hb_buffer_t *buffer,
|
||||||
static void
|
static void
|
||||||
final_reordering (const hb_ot_map_t *map,
|
final_reordering (const hb_ot_map_t *map,
|
||||||
hb_font_t *font HB_UNUSED,
|
hb_font_t *font HB_UNUSED,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer)
|
||||||
void *user_data HB_UNUSED)
|
|
||||||
{
|
{
|
||||||
unsigned int count = buffer->len;
|
unsigned int count = buffer->len;
|
||||||
if (!count) return;
|
if (!count) return;
|
||||||
|
|
Loading…
Reference in New Issue