Skip to content

Commit

Permalink
Indic all: update 4.3 final-Reph-reordering instructions to be consis…
Browse files Browse the repository at this point in the history
…tently worded and reflect the seven-step algorithm as defined in the MS script-shaping docs. This commit regularized all step-e language -- about moving Reph to just before the first post-base matra or SM or Vedic sign after the Reph-position tag. Full algorithm is listed in Indic General. Do note, however, that as of this writing, there seem to be some differences between the MS docs algorithm and what HarfBuzz does on REPH_POS_AFTER_SUBJOINED scripts, step d, and what it does for all scripts on step e. See issue n8willis#48 in this repo for discussion.
  • Loading branch information
n8willis committed Mar 27, 2020
1 parent a6022f3 commit af71a0d
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 48 deletions.
11 changes: 9 additions & 2 deletions opentype-shaping-bengali.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,8 +1283,15 @@ The algorithm for finding the final "Reph" position is
- If no such non-ligated post-base consonant is found in the
previous step, move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag of `POS_BEFORE_POST` or later. This
will be the final "Reph" position.
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Bengali incorporates the
> `REPH_POS_AFTER_SUBJOINED` shaping characteristic, this means
> any positioning tag of `POS_BEFORE_POST` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_BEFORE_POST`.
- If no other location has been located in the previous steps, move
the "Reph" to the end of the syllable.

Expand Down
11 changes: 9 additions & 2 deletions opentype-shaping-devanagari.md
Original file line number Diff line number Diff line change
Expand Up @@ -1239,8 +1239,15 @@ The algorithm for finding the final "Reph" position is
- If no such non-ligated post-base consonant is found in the
previous step, move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag of `POS_POSTBASE_CONSONANT` or later. This
will be the final "Reph" position.
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Devanagari incorporates the
> `REPH_POS_BEFORE_POST` shaping characteristic, this means
> any positioning tag of `POS_POSTBASE_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_POSTBASE_CONSONANT`.
- If no other location has been located in the previous steps, move
the "Reph" to the end of the syllable.

Expand Down
54 changes: 51 additions & 3 deletions opentype-shaping-gujarati.md
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,57 @@ shaping characteristic, this final position is immediately before any
independent post-base consonant forms (meaning the first post-base
consonant that has not formed a ligature with the syllable base).

- If the syllable does not have any post-base consonants, then the
final "Reph" position is immediately before the first post-base
matra, syllable modifier, or Vedic sign.
The algorithm for finding the final "Reph" position is

<!---
- Find the first explicit "Halant" between the first post-Reph
consonant and the last main consonant. Move the "Reph to the
position immediately after this "Halant".
- If a zero-width joiner (ZWJ) or a zero-width non-joiner (ZWNJ)
follows this "Halant", move the "Reph" to the position
immediately after the ZWJ or ZWNJ.
--->

- Starting at the first post-"Reph" consonant, search forward looking
for the first explicit "Halant", ending the search when the base
consonant is encountered. If such an explicit "Halant" is found,
move the "Reph" to the position immediately after this
"Halant".
* If a zero-width joiner (ZWJ) or a zero-width non-joiner (ZWNJ)
follows this "Halant", move the "Reph" to the position
immediately after the ZWJ or ZWNJ. This will be the final
"Reph" position.
* If no ZWJ or ZWNJ follows this "Halant", leave the "Reph" in
its position immediately after the "Halant". This will be the
final "Reph" position.
- If no such explicit "Halant" is found in the previous step, find
the first post-base consonant that has not formed a ligature with
the base consonant. If such a non-ligated post-base consonant is
found, move the "Reph" to the position immediately before the
non-ligated post-base consonant. This will be the final "Reph"
position.
- If no such non-ligated post-base consonant is found in the
previous step, move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Gujarati incorporates the
> `REPH_POS_BEFORE_POST` shaping characteristic, this means
> any positioning tag of `POS_POSTBASE_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_POSTBASE_CONSONANT`.
- If no other location has been located in the previous steps, move
the "Reph" to the end of the syllable.


Finally, if the final position of "Reph" occurs after a
"_matra_,Halant" subsequence, then "Reph" must be repositioned to the
left of "Halant", to allow for potential matching with `abvs` or
`psts` substitutions from GSUB.




Expand Down
11 changes: 9 additions & 2 deletions opentype-shaping-gurmukhi.md
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,15 @@ The algorithm for finding the final "Reph" position is
- If no such non-ligated post-base consonant is found in the
previous step, move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag of `POS_BELOWBASE_CONSONANT` or later. This
will be the final "Reph" position.
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Gurmukhi incorporates the
> `REPH_POS_BEFORE_SUBJOINED` shaping characteristic, this means
> any positioning tag of `POS_BELOWBASE_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_BELOWBASE_CONSONANT`.
- If no other location has been located in the previous steps, move
the "Reph" to the end of the syllable.

Expand Down
8 changes: 5 additions & 3 deletions opentype-shaping-indic-general.md
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ Reph-position shaping characteristic, and is conditional upon the
presence or absence of certain characters (such as post-base
consonants or "matra,Halant" sequences) in the syllable.

The algorithm for determining the final Reph position has seven steps.
The full algorithm for determining the final Reph position has seven steps.

(a) If the script uses Reph-position rule `REPH_POS_AFTER_POST`, jump
immediately to step (e). Otherwise, proceed to step (b).
Expand Down Expand Up @@ -1353,8 +1353,10 @@ Reph-position rule, proceed to step (e).

(e) Move the "Reph" to a position immediately before the first
post-base matra, syllable modifier sign or Vedic sign that has a
reordering class after the intended Reph position, then proceed to
step (mH). If no such matra or sign is found, proceed to step (f).
reordering class after the intended Reph position in the syllable sort
order (as listed in [stage 2](#2-initial-reordering)). This will be
the final "Reph" position. , then proceed to step (mH). If no such
matra or sign is found, proceed to step (f).

(f) Move the "Reph" to the end of the syllable.

Expand Down
11 changes: 9 additions & 2 deletions opentype-shaping-kannada.md
Original file line number Diff line number Diff line change
Expand Up @@ -1210,8 +1210,15 @@ The algorithm for finding the final "Reph" position is

- Move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag of `POS_FINAL_CONSONANT` or later. This
will be the final "Reph" position.
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Kannada incorporates the
> `REPH_POS_AFTER_POST` shaping characteristic, this means
> any positioning tag of `POS_FINAL_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_FINAL_CONSONANT`.
- If no other location has been located in the previous step, move
the "Reph" to the end of the syllable.

Expand Down
14 changes: 10 additions & 4 deletions opentype-shaping-malayalam.md
Original file line number Diff line number Diff line change
Expand Up @@ -1265,11 +1265,17 @@ after the syllable base.

The algorithm for finding the final "Reph" position is

- If no such non-ligated post-base consonant is found in the
previous step, move the "Reph" to the position immediately before
- Move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag of `POS_ABOVEBASE_CONSONANT` or later. This
will be the final "Reph" position.
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Malayalam incorporates the
> `REPH_POS_AFTER_MAIN` shaping characteristic, this means
> any positioning tag of `POS_ABOVEBASE_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_ABOVEBASE_CONSONANT`.
- If no other location has been located in the previous step, move
the "Reph" to the end of the syllable.

Expand Down
30 changes: 18 additions & 12 deletions opentype-shaping-oriya.md
Original file line number Diff line number Diff line change
Expand Up @@ -1256,18 +1256,24 @@ position. Because Oriya incorporates the `REPH_POS_AFTER_MAIN`
shaping characteristic, this final position is immediately after the
syllable base.

- If the syllable does not have a base consonant (such as a syllable
based on an independent vowel), then the final "Reph" position is
immediately before the first character tagged with the
`POS_BEFORE_POST` position or any later position in the sort
order.

-- If there are no characters tagged with `POS_BEFORE_POST` or
later positions, then "Reph" is positioned at the end of the
syllable.

Finally, if the final position of "Reph" occurs after a
"_matra_,Halant" subsequence, then "Reph" must be repositioned to the
The algorithm for finding the final "Reph" position is

- Move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Oriya incorporates the
> `REPH_POS_AFTER_MAIN` shaping characteristic, this means
> any positioning tag of `POS_ABOVEBASE_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_ABOVEBASE_CONSONANT`.
- If no other location has been located in the previous step, move
the "Reph" to the end of the syllable.

Finally, if the final position of "Reph" or "Repha" occurs after a
"_matra_,Halant" subsequence, then "Reph"/"Repha" must be repositioned to the
left of "Halant", to allow for potential matching with `abvs` or
`psts` substitutions from GSUB.

Expand Down
21 changes: 21 additions & 0 deletions opentype-shaping-sinhala.md
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,27 @@ position. Because Sinhala incorporates the `REPH_POS_AFTER_MAIN`
shaping characteristic, this final position is immediately after the
syllable base.

The algorithm for finding the final "Reph" position is

- Move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Sinhala incorporates the
> `REPH_POS_AFTER_MAIN` shaping characteristic, this means
> any positioning tag of `POS_ABOVEBASE_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_ABOVEBASE_CONSONANT`.
- If no other location has been located in the previous step, move
the "Reph" to the end of the syllable.

Finally, if the final position of "Reph" or "Repha" occurs after a
"_matra_,Halant" subsequence, then "Reph"/"Repha" must be repositioned to the
left of "Halant", to allow for potential matching with `abvs` or
`psts` substitutions from GSUB.


![Reph positioning](/images/sinhala/sinhala-reph-position.png)

Expand Down
26 changes: 17 additions & 9 deletions opentype-shaping-tamil.md
Original file line number Diff line number Diff line change
Expand Up @@ -1195,15 +1195,23 @@ position. Because Tamil incorporates the `REPH_POS_AFTER_POST`
shaping characteristic, this final position is immediately after
any post-base consonant forms.

- If the syllable does not have a base consonant (such as a syllable
based on an independent vowel), then the final "Reph" position is
immediately before the first character tagged with the
`POS_BEFORE_POST` position or any later position in the sort
order.

-- If there are no characters tagged with `POS_BEFORE_POST` or
later positions, then "Reph" is positioned at the end of the
syllable.

The algorithm for finding the final "Reph" position is

- Move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Tamil incorporates the
> `REPH_POS_AFTER_POST` shaping characteristic, this means
> any positioning tag of `POS_FINAL_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_FINAL_CONSONANT`.
- If no other location has been located in the previous step, move
the "Reph" to the end of the syllable.


Finally, if the final position of "Reph" occurs after a
"_matra_,Halant" subsequence, then "Reph" must be repositioned to the
Expand Down
26 changes: 17 additions & 9 deletions opentype-shaping-telugu.md
Original file line number Diff line number Diff line change
Expand Up @@ -1184,15 +1184,23 @@ position. Because Telugu incorporates the `REPH_POS_AFTER_POST`
shaping characteristic, this final position is immediately after
any post-base consonant forms.

- If the syllable does not have a base consonant (such as a syllable
based on an independent vowel), then the final "Reph" position is
immediately before the first character tagged with the
`POS_BEFORE_POST` position or any later position in the sort
order.

-- If there are no characters tagged with `POS_BEFORE_POST` or
later positions, then "Reph" is positioned at the end of the
syllable.

The algorithm for finding the final "Reph" position is

- Move the "Reph" to the position immediately before
the first post-base matra, syllable modifier, or Vedic sign that
has a positioning tag after the script's "Reph" position in the
syllable sort order (as listed in [stage
2](#2-initial-reordering)). This will be the final "Reph"
position.
> Note: Because Telugu incorporates the
> `REPH_POS_AFTER_POST` shaping characteristic, this means
> any positioning tag of `POS_FINAL_CONSONANT` or later,
> although a post-base matra, syllable modifier, or Vedic sign
> would not typically be tagged with `POS_FINAL_CONSONANT`.
- If no other location has been located in the previous step, move
the "Reph" to the end of the syllable.


Finally, if the final position of "Reph" occurs after a
"_matra_,Halant" subsequence, then "Reph" must be repositioned to the
Expand Down

0 comments on commit af71a0d

Please sign in to comment.