diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2015-09-01 16:26:35 +0100 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2015-09-01 16:34:12 +0100 |
commit | 5828c45d7a816ccd0a7f10a665ea3cf8cfd63b05 (patch) | |
tree | e78bc970866a19fc34ee795d0945d12962f3fc84 | |
parent | bdc8215949a7add742cc800b4fdea6acaa37d152 (diff) | |
download | harfbuzz-5828c45d7a816ccd0a7f10a665ea3cf8cfd63b05.tar.gz |
[indic] Add comments to merge_clusters calls
-rw-r--r-- | src/hb-ot-shape-complex-indic.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 8b55484a..00526f3d 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1025,7 +1025,11 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan, * around like crazy. In old-spec mode, we move halants around, so in * that case merge all clusters after base. Otherwise, check the sort * order and merge as needed. - * For pre-base stuff, we handle cluster issues in final reordering. */ + * For pre-base stuff, we handle cluster issues in final reordering. + * + * We could use buffer->sort() for this, if there was no special + * reordering of pre-base stuff happening later... + */ if (indic_plan->is_old_spec || end - base > 127) buffer->merge_clusters (base, end); else @@ -1404,12 +1408,17 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, if (info[i - 1].indic_position () == POS_PRE_M) { unsigned int old_pos = i - 1; + if (old_pos < base && base <= new_pos) /* Shouldn't actually happen. */ + base--; + hb_glyph_info_t tmp = info[old_pos]; memmove (&info[old_pos], &info[old_pos + 1], (new_pos - old_pos) * sizeof (info[0])); info[new_pos] = tmp; - if (old_pos < base && base <= new_pos) /* Shouldn't actually happen. */ - base--; + + /* Note: this merge_clusters() is intentionally *after* the reordering. + * Indic matra reordering is special and tricky... */ buffer->merge_clusters (new_pos, MIN (end, base + 1)); + new_pos--; } } else { @@ -1562,12 +1571,12 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, reph_move: { - buffer->merge_clusters (start, new_reph_pos + 1); - /* Move */ + buffer->merge_clusters (start, new_reph_pos + 1); hb_glyph_info_t reph = info[start]; memmove (&info[start], &info[start + 1], (new_reph_pos - start) * sizeof (info[0])); info[new_reph_pos] = reph; + if (start < base && base <= new_reph_pos) base--; } @@ -1640,10 +1649,12 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan, { unsigned int old_pos = i; + buffer->merge_clusters (new_pos, old_pos + 1); hb_glyph_info_t tmp = info[old_pos]; memmove (&info[new_pos + 1], &info[new_pos], (old_pos - new_pos) * sizeof (info[0])); info[new_pos] = tmp; + if (new_pos <= base && base < old_pos) base++; } |