Move code around

This commit is contained in:
Behdad Esfahbod 2018-10-02 15:02:16 +02:00
parent 0a371fee4d
commit 3cca978723
2 changed files with 11 additions and 14 deletions

View File

@ -762,7 +762,6 @@ struct Ligature
return_trace (true);
}
bool is_mark_ligature = false;
unsigned int total_component_count = 0;
unsigned int match_length = 0;
@ -774,7 +773,6 @@ struct Ligature
nullptr,
&match_length,
match_positions,
&is_mark_ligature,
&total_component_count)))
return_trace (false);
@ -783,7 +781,6 @@ struct Ligature
match_positions,
match_length,
ligGlyph,
is_mark_ligature,
total_component_count);
return_trace (true);

View File

@ -731,7 +731,6 @@ static inline bool match_input (hb_ot_apply_context_t *c,
const void *match_data,
unsigned int *end_offset,
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
bool *p_is_mark_ligature = nullptr,
unsigned int *p_total_component_count = nullptr)
{
TRACE_APPLY (nullptr);
@ -768,8 +767,6 @@ static inline bool match_input (hb_ot_apply_context_t *c,
* https://github.com/harfbuzz/harfbuzz/issues/545
*/
bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->cur());
unsigned int total_component_count = 0;
total_component_count += _hb_glyph_info_get_lig_num_comps (&buffer->cur());
@ -836,15 +833,11 @@ static inline bool match_input (hb_ot_apply_context_t *c,
return_trace (false);
}
is_mark_ligature = is_mark_ligature && _hb_glyph_info_is_mark (&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;
if (p_is_mark_ligature)
*p_is_mark_ligature = is_mark_ligature;
if (p_total_component_count)
*p_total_component_count = total_component_count;
@ -855,7 +848,6 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
unsigned int match_length,
hb_codepoint_t lig_glyph,
bool is_mark_ligature,
unsigned int total_component_count)
{
TRACE_APPLY (nullptr);
@ -864,11 +856,11 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
buffer->merge_clusters (buffer->idx, buffer->idx + match_length);
/*
* - If it *is* a mark ligature, we don't allocate a new ligature id, and leave
/* - If all components of the ligature were marks, we call this a mark ligature.
* If it *is* a mark ligature, we don't allocate a new ligature id, and leave
* the ligature to keep its old ligature id. This will allow it to attach to
* a base ligature in GPOS. Eg. if the sequence is: LAM,LAM,SHADDA,FATHA,HEH,
* and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA wit a
* and LAM,LAM,HEH for a ligature, they will leave SHADDA and FATHA with a
* ligature id and component value of 2. Then if SHADDA,FATHA form a ligature
* later, we don't want them to lose their ligature id/component, otherwise
* GPOS will fail to correctly position the mark ligature on top of the
@ -892,6 +884,14 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
* https://bugzilla.gnome.org/show_bug.cgi?id=437633
*/
bool is_mark_ligature = true;
for (unsigned int i = 0; i < count; i++)
if (!_hb_glyph_info_is_mark (&buffer->info[match_positions[i]]))
{
is_mark_ligature = false;
break;
}
unsigned int klass = is_mark_ligature ? 0 : HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
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());