diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 05a6f5edc..0cf969d99 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1031,7 +1031,7 @@ struct MarkBasePosFormat1 do { if (!skippy_iter.prev ()) return TRACE_RETURN (false); /* We only want to attach to the first of a MultipleSubst sequence. Reject others. */ - if (0 == get_lig_comp (c->buffer->info[skippy_iter.idx])) break; + if (0 == _hb_glyph_info_get_lig_comp (&c->buffer->info[skippy_iter.idx])) break; skippy_iter.reject (); } while (1); @@ -1152,11 +1152,11 @@ struct MarkLigPosFormat1 * can directly use the component index. If not, we attach the mark * glyph to the last component of the ligature. */ unsigned int comp_index; - unsigned int lig_id = get_lig_id (c->buffer->info[j]); - unsigned int mark_id = get_lig_id (c->buffer->cur()); - unsigned int mark_comp = get_lig_comp (c->buffer->cur()); + unsigned int lig_id = _hb_glyph_info_get_lig_id (&c->buffer->info[j]); + unsigned int mark_id = _hb_glyph_info_get_lig_id (&c->buffer->cur()); + unsigned int mark_comp = _hb_glyph_info_get_lig_comp (&c->buffer->cur()); if (lig_id && lig_id == mark_id && mark_comp > 0) - comp_index = MIN (comp_count, get_lig_comp (c->buffer->cur())) - 1; + comp_index = MIN (comp_count, _hb_glyph_info_get_lig_comp (&c->buffer->cur())) - 1; else comp_index = comp_count - 1; @@ -1252,10 +1252,10 @@ struct MarkMarkPosFormat1 unsigned int j = skippy_iter.idx; - unsigned int id1 = get_lig_id (c->buffer->cur()); - unsigned int id2 = get_lig_id (c->buffer->info[j]); - unsigned int comp1 = get_lig_comp (c->buffer->cur()); - unsigned int comp2 = get_lig_comp (c->buffer->info[j]); + unsigned int id1 = _hb_glyph_info_get_lig_id (&c->buffer->cur()); + unsigned int id2 = _hb_glyph_info_get_lig_id (&c->buffer->info[j]); + unsigned int comp1 = _hb_glyph_info_get_lig_comp (&c->buffer->cur()); + unsigned int comp2 = _hb_glyph_info_get_lig_comp (&c->buffer->info[j]); if (likely (id1 == id2)) { if (id1 == 0) /* Marks belonging to the same base. */ diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index a07a77925..1a0f183a1 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -302,7 +302,7 @@ struct Sequence else { for (unsigned int i = 0; i < count; i++) { - set_lig_props_for_component (c->buffer->cur(), i); + _hb_glyph_info_set_lig_props_for_component (&c->buffer->cur(), i); c->output_glyph (substitute.array[i], klass); } c->buffer->skip_glyph (); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index f156b9828..329ba4b4a 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -409,7 +409,7 @@ struct hb_apply_context_t if (unlikely (_hb_glyph_info_is_default_ignorable (&info) && (ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) && (ignore_zwj || !_hb_glyph_info_is_zwj (&info)) && - !is_a_ligature (info))) + !_hb_glyph_info_is_ligated (&info))) return SKIP_MAYBE; return SKIP_NO; @@ -788,10 +788,10 @@ static inline bool match_input (hb_apply_context_t *c, bool is_mark_ligature = !!(buffer->cur().glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK); unsigned int total_component_count = 0; - total_component_count += get_lig_num_comps (buffer->cur()); + total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur()); - unsigned int first_lig_id = get_lig_id (buffer->cur()); - unsigned int first_lig_comp = get_lig_comp (buffer->cur()); + unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur()); + unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur()); match_positions[0] = buffer->idx; for (unsigned int i = 1; i < count; i++) @@ -800,8 +800,8 @@ static inline bool match_input (hb_apply_context_t *c, match_positions[i] = skippy_iter.idx; - unsigned int this_lig_id = get_lig_id (buffer->info[skippy_iter.idx]); - unsigned int this_lig_comp = get_lig_comp (buffer->info[skippy_iter.idx]); + unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]); + unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]); if (first_lig_id && first_lig_comp) { /* If first component was attached to a previous ligature component, @@ -818,7 +818,7 @@ static inline bool match_input (hb_apply_context_t *c, } is_mark_ligature = is_mark_ligature && (buffer->info[skippy_iter.idx].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK); - total_component_count += get_lig_num_comps (buffer->info[skippy_iter.idx]); + total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->info[skippy_iter.idx]); } *end_offset = skippy_iter.idx - buffer->idx + 1; @@ -874,14 +874,14 @@ static inline void ligate_input (hb_apply_context_t *c, */ unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE; - unsigned int lig_id = is_mark_ligature ? 0 : allocate_lig_id (buffer); - unsigned int last_lig_id = get_lig_id (buffer->cur()); - unsigned int last_num_components = get_lig_num_comps (buffer->cur()); + unsigned int lig_id = is_mark_ligature ? 0 : _hb_allocate_lig_id (buffer); + unsigned int last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur()); + unsigned int last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur()); unsigned int components_so_far = last_num_components; if (!is_mark_ligature) { - set_lig_props_for_ligature (buffer->cur(), lig_id, total_component_count); + _hb_glyph_info_set_lig_props_for_ligature (&buffer->cur(), lig_id, total_component_count); if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER); } @@ -893,14 +893,14 @@ static inline void ligate_input (hb_apply_context_t *c, { if (!is_mark_ligature) { unsigned int new_lig_comp = components_so_far - last_num_components + - MIN (MAX (get_lig_comp (buffer->cur()), 1u), last_num_components); - set_lig_props_for_mark (buffer->cur(), lig_id, new_lig_comp); + MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->cur()), 1u), last_num_components); + _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp); } buffer->next_glyph (); } - last_lig_id = get_lig_id (buffer->cur()); - last_num_components = get_lig_num_comps (buffer->cur()); + last_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur()); + last_num_components = _hb_glyph_info_get_lig_num_comps (&buffer->cur()); components_so_far += last_num_components; /* Skip the base glyph */ @@ -910,10 +910,10 @@ static inline void ligate_input (hb_apply_context_t *c, if (!is_mark_ligature && last_lig_id) { /* Re-adjust components for any marks following. */ for (unsigned int i = buffer->idx; i < buffer->len; i++) { - if (last_lig_id == get_lig_id (buffer->info[i])) { + if (last_lig_id == _hb_glyph_info_get_lig_id (&buffer->info[i])) { unsigned int new_lig_comp = components_so_far - last_num_components + - MIN (MAX (get_lig_comp (buffer->info[i]), 1u), last_num_components); - set_lig_props_for_mark (buffer->info[i], lig_id, new_lig_comp); + MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->info[i]), 1u), last_num_components); + _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp); } else break; } diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh index 5b16dfc4f..406a04244 100644 --- a/src/hb-ot-layout-private.hh +++ b/src/hb-ot-layout-private.hh @@ -191,7 +191,8 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni } inline void -_hb_glyph_info_set_general_category (hb_glyph_info_t *info, hb_unicode_general_category_t gen_cat) +_hb_glyph_info_set_general_category (hb_glyph_info_t *info, + hb_unicode_general_category_t gen_cat) { info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~MASK0_GEN_CAT); } @@ -203,7 +204,8 @@ _hb_glyph_info_get_general_category (const hb_glyph_info_t *info) } inline void -_hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info, unsigned int modified_class) +_hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info, + unsigned int modified_class) { info->unicode_props1() = modified_class; } @@ -264,52 +266,58 @@ _hb_glyph_info_flip_joiners (hb_glyph_info_t *info) */ #define IS_LIG_BASE 0x10 static inline void -set_lig_props_for_ligature (hb_glyph_info_t &info, unsigned int lig_id, unsigned int lig_num_comps) +_hb_glyph_info_set_lig_props_for_ligature (hb_glyph_info_t *info, + unsigned int lig_id, + unsigned int lig_num_comps) { - info.lig_props() = (lig_id << 5) | IS_LIG_BASE | (lig_num_comps & 0x0F); + info->lig_props() = (lig_id << 5) | IS_LIG_BASE | (lig_num_comps & 0x0F); } static inline void -set_lig_props_for_mark (hb_glyph_info_t &info, unsigned int lig_id, unsigned int lig_comp) +_hb_glyph_info_set_lig_props_for_mark (hb_glyph_info_t *info, + unsigned int lig_id, + unsigned int lig_comp) { - info.lig_props() = (lig_id << 5) | (lig_comp & 0x0F); + info->lig_props() = (lig_id << 5) | (lig_comp & 0x0F); } static inline void -set_lig_props_for_component (hb_glyph_info_t &info, unsigned int comp) +_hb_glyph_info_set_lig_props_for_component (hb_glyph_info_t *info, unsigned int comp) { - set_lig_props_for_mark (info, 0, comp); + _hb_glyph_info_set_lig_props_for_mark (info, 0, comp); } static inline unsigned int -get_lig_id (const hb_glyph_info_t &info) +_hb_glyph_info_get_lig_id (const hb_glyph_info_t *info) { - return info.lig_props() >> 5; + return info->lig_props() >> 5; } static inline bool -is_a_ligature (const hb_glyph_info_t &info) +_hb_glyph_info_is_ligated (const hb_glyph_info_t *info) { - return !!(info.lig_props() & IS_LIG_BASE); + return !!(info->lig_props() & IS_LIG_BASE); } static inline unsigned int -get_lig_comp (const hb_glyph_info_t &info) +_hb_glyph_info_get_lig_comp (const hb_glyph_info_t *info) { - if (is_a_ligature (info)) + if (_hb_glyph_info_is_ligated (info)) return 0; else - return info.lig_props() & 0x0F; + return info->lig_props() & 0x0F; } static inline unsigned int -get_lig_num_comps (const hb_glyph_info_t &info) +_hb_glyph_info_get_lig_num_comps (const hb_glyph_info_t *info) { - if ((info.glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) && is_a_ligature (info)) - return info.lig_props() & 0x0F; + if ((info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) && + _hb_glyph_info_is_ligated (info)) + return info->lig_props() & 0x0F; else return 1; } -static inline uint8_t allocate_lig_id (hb_buffer_t *buffer) { +static inline uint8_t +_hb_allocate_lig_id (hb_buffer_t *buffer) { uint8_t lig_id = buffer->next_serial () & 0x07; if (unlikely (!lig_id)) - lig_id = allocate_lig_id (buffer); /* in case of overflow */ + lig_id = _hb_allocate_lig_id (buffer); /* in case of overflow */ return lig_id; } diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index bc79025f7..0835f7dbe 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -141,7 +141,7 @@ static inline bool is_one_of (const hb_glyph_info_t &info, unsigned int flags) { /* If it ligated, all bets are off. */ - if (is_a_ligature (info)) return false; + if (_hb_glyph_info_is_ligated (&info)) return false; return !!(FLAG (info.indic_category()) & flags); } @@ -1405,7 +1405,8 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, */ if (start + 1 < end && info[start].indic_position() == POS_RA_TO_BECOME_REPH && - ((info[start].indic_category() == OT_Repha) ^ is_a_ligature (info[start]))) + ((info[start].indic_category() == OT_Repha) ^ + _hb_glyph_info_is_ligated (&info[start]))) { unsigned int new_reph_pos; reph_position_t reph_pos = indic_plan->config->reph_pos; diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 17811b59b..b5ac10746 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -151,7 +151,7 @@ static inline bool is_one_of (const hb_glyph_info_t &info, unsigned int flags) { /* If it ligated, all bets are off. */ - if (is_a_ligature (info)) return false; + if (_hb_glyph_info_is_ligated (&info)) return false; return !!(FLAG (info.myanmar_category()) & flags); } diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc index 284d030d5..a7e3b8e9c 100644 --- a/src/hb-ot-shape-fallback.cc +++ b/src/hb-ot-shape-fallback.cc @@ -300,8 +300,8 @@ position_around_base (const hb_ot_shape_plan_t *plan, base_extents.x_bearing += buffer->pos[base].x_offset; base_extents.y_bearing += buffer->pos[base].y_offset; - unsigned int lig_id = get_lig_id (buffer->info[base]); - unsigned int num_lig_components = get_lig_num_comps (buffer->info[base]); + unsigned int lig_id = _hb_glyph_info_get_lig_id (&buffer->info[base]); + unsigned int num_lig_components = _hb_glyph_info_get_lig_num_comps (&buffer->info[base]); hb_position_t x_offset = 0, y_offset = 0; if (HB_DIRECTION_IS_FORWARD (buffer->props.direction)) { @@ -317,8 +317,8 @@ position_around_base (const hb_ot_shape_plan_t *plan, if (_hb_glyph_info_get_modified_combining_class (&buffer->info[i])) { if (num_lig_components > 1) { - unsigned int this_lig_id = get_lig_id (buffer->info[i]); - unsigned int this_lig_component = get_lig_comp (buffer->info[i]) - 1; + unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[i]); + unsigned int this_lig_component = _hb_glyph_info_get_lig_comp (&buffer->info[i]) - 1; /* Conditions for attaching to the last component. */ if (!lig_id || lig_id != this_lig_id || this_lig_component >= num_lig_components) this_lig_component = num_lig_components - 1; diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 4ed6b8420..e68344b92 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -546,7 +546,7 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c) unsigned int j = 0; for (unsigned int i = 0; i < count; i++) { - if (unlikely (!is_a_ligature (info[i]) && + if (unlikely (!_hb_glyph_info_is_ligated (&info[i]) && _hb_glyph_info_is_default_ignorable (&info[i]))) { if (space_status == SPACE_DONT_KNOW)