Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Indic: Flag glyphs for features after initial reorder #101

Merged
merged 21 commits into from
Jan 26, 2021
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b101ee1
Add section 2.10 to explicitly tell shapers to flag glyphs for possib…
n8willis Aug 1, 2020
ae01ff0
Gurmukhi; trivial: fix small typos.
n8willis Aug 10, 2020
40ceb0d
Gurmukhi: remove mention of init and haln feature-flagging in 2.10. S…
n8willis Aug 10, 2020
b4cc397
Update chartables through Unicode 12 additions and changes. Fix minor…
n8willis Aug 17, 2020
ad1ef66
Merge branch 'master' of https://github.com/n8willis/opentype-shaping…
n8willis Aug 17, 2020
89ebfdb
Tibetan, chartable: patch fixes to Shaping Class that are absent in U…
n8willis Aug 18, 2020
ae299a4
Update chartables through Unicode 13 additions and changes.
n8willis Aug 18, 2020
758f8dd
Classify numerals as _placeholder_ for syllable-identification regexes.
n8willis Nov 13, 2020
6e01412
Minor; fix overlooked regex removal in Gujarati.
n8willis Nov 13, 2020
65c6317
Trivial; fix typo in Khmer document.
n8willis Dec 2, 2020
ce48d3f
Errata: add notes on ZWJ and ZWNJ ligature ambiguities in Unicode.
n8willis Dec 2, 2020
375c216
Minor, improve wording in ZWJ errata subsection.
n8willis Dec 7, 2020
f95ac18
Merge pull request #112 from n8willis/numeral-placeholders
n8willis Jan 23, 2021
92a515b
Indic2: clarify and regularize discussion of init application in stag…
n8willis Jan 23, 2021
814d0a6
Note Uniscribe behavior for Bengali init context.
n8willis Jan 25, 2021
5718533
Trivial; typo in IG.
n8willis Jan 25, 2021
685515f
Add section 2.10 to explicitly tell shapers to flag glyphs for possib…
n8willis Aug 1, 2020
226caab
Gurmukhi; trivial: fix small typos.
n8willis Aug 10, 2020
8e06a83
Gurmukhi: remove mention of init and haln feature-flagging in 2.10. S…
n8willis Aug 10, 2020
772dd21
Indic all: add feature-flagging step 2.10, regularize wording to flag…
n8willis Jan 25, 2021
fd6db1d
Merge branch 'flag-feature-masks' of https://github.com/n8willis/open…
n8willis Jan 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 74 additions & 13 deletions opentype-shaping-gurmukhi.md
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,9 @@ positioned before or after any post-base consonants, respectively.
For shaping-engine implementers, the names used for the ordering
categories matter only in that they are unambiguous.

For a definition of the "base" consonant, refer to step 2.1, which follows.
For a definition of the "base" consonant, refer to step 2.1, which
follows.


#### 2.1: Base consonant ####

Expand Down Expand Up @@ -1029,12 +1031,63 @@ so that glyphs of the same ordering category remain in the same
relative position with respect to each other.


#### 2.10: Flag sequences for possible feature applications ####

With the inital reordering complete, those glyphs in the syllable that
may have GSUB or GPOS features applied in stages 3, 5, and 6 should be
flagged for each potential feature.

This flagging is preliminary; the set of potential features varies
between different scripts and which features are supported varies
between fonts. It is also possible that the application of
one feature on a glyph sequence will perform a substitution that makes
a later feature no longer applicable to the updated sequence.

Consequently, the flagging must be completed before shaping procedes
n8willis marked this conversation as resolved.
Show resolved Hide resolved
to the stages during which features are applied.

Some shaping features, such as `locl`, can potentially apply to any
glyphs. Therefore it is not necessary to maintain a separate flag for
these features in the bitmask (or other data structure) used to track
the flags -- although shaping engines may do so if desired.

The sequences to flag are summarized in the list below; a full
description of each feature's function and interpretation is provided
in GSUB and GPOS application stages that follow.

- `nukt` should match "_Consonant_,Nukta" sequences
- `akhn` should match "Ka,Halant,Ssa" and "Ja,Halant,Nya"
- `rphf` should match initial "Ra,Halant" sequences but _not_ match
initial "Ra,Halant,ZWJ" sequences
- `blwf` should match "Halant,Ra", "Halant,Ha", and "Halant,Va" in
post-base positions and "Ra,Halant", "Ha,Halant", and
"Va,Halant" in non-initial pre-base positions
- `half` should match "_Consonant_,Halant" in pre-base position but
_not_ match "Ra,Halant" sequences flagged for `rphf` and
_not_ match "_Consonant_,Halant,ZWNJ,_Consonant_" sequences
- `pstf` should match initial "Halant,Ya" in post-base position
- `vatu` should match "_Consonant_,Halant,Ra",
"_Consonant_,Halant,Ha", and "_Consonant_,Halant,Va"
- `cjct` should match "_Consonant_,Halant,_Consonant_" but _not_
match "_Consonant_,Halant,ZWJ,_Consonant_" or
"_Consonant_,Halant,ZWNJ,_Consonant_"
- `init` should match word-initial letters
- `haln` should match word-final "_Consonant_,Halant" sequences
n8willis marked this conversation as resolved.
Show resolved Hide resolved

> Note: Word-initial consonants and independent vowels will be flagged
> for possible `init` feature application here. Any matras that are
> reordered to a word-initial position during the final-reordering
> stage will be flagged for possible `init` feature application
> separately, after final reordering.
n8willis marked this conversation as resolved.
Show resolved Hide resolved



### 3: Applying the basic substitution features from GSUB ###

The basic-substitution stage applies mandatory substitution features
using the rules in the font's GSUB table. In preparation for this
stage, glyph sequences should be tagged for possible application
of GSUB features.
stage, glyph sequences should be flagged for possible application
of GSUB features in stage 2, step 10.

The order in which these substitutions must be performed is fixed for
all Indic scripts:
Expand Down Expand Up @@ -1096,7 +1149,7 @@ feature must be applied before all other many-to-one substitutions.
The `rphf` feature replaces initial "Ra,Halant" sequences with the
"Reph" glyph.

- An initial "Ra,Halant,ZWJ" sequence, however, must not be tagged for
- An initial "Ra,Halant,ZWJ" sequence, however, must not be flagged for
the `rphf` substitution.

> Note: "Reph" usage is rare in Gurmukhi text. Nevertheless,
Expand Down Expand Up @@ -1129,7 +1182,7 @@ forms:
Because Gurmukhi incorporates the `BLWF_MODE_PRE_AND_POST` shaping
characteristic, any pre-base consonants and any post-base consonants
may potentially match a `blwf` substitution; therefore, both cases must
be tagged for comparison. Note that this is not necessarily the case in other
be flagged for comparison. Note that this is not necessarily the case in other
Indic scripts that use a different `BLWF_MODE_` shaping
characteristic.

Expand All @@ -1152,16 +1205,16 @@ base consonant or syllable base with "half forms" of the consonant glyphs. There
three exceptions to the default behavior, for which the shaping engine
must test:

- Initial "Ra,Halant" sequences, which should have been tagged for
the `rphf` feature earlier, must not be tagged for potential
- Initial "Ra,Halant" sequences, which should have been flagged for
the `rphf` feature earlier, must not be flagged for potential
`half` substitutions.

- A sequence matching "_Consonant_,Halant,ZWJ,_Consonant_" must be
tagged for potential `half` substitutions, even though the presence of the
flagged for potential `half` substitutions, even though the presence of the
zero-width joiner suppresses the `cjct` feature in a later step.

- A sequence matching "_Consonant_,Halant,ZWNJ,_Consonant_" must not be
tagged for potential `half` substitutions.
flagged for potential `half` substitutions.

> Note: Half forms are rare in Gurmukhi text. Fonts supporting
> `<gur2>` may implement the `half` feature using explicit "Halant"
Expand Down Expand Up @@ -1198,7 +1251,7 @@ The `cjct` feature replaces sequences of adjacent consonants with
conjunct ligatures. These sequences must match "_Consonant_,Halant,_Consonant_".

A sequence matching "_Consonant_,Halant,ZWJ,_Consonant_" or
"_Consonant_,Halant,ZWNJ,_Consonant_" must not be tagged to form a conjunct.
"_Consonant_,Halant,ZWNJ,_Consonant_" must not be flagged to form a conjunct.

The font's GSUB rules might be implemented so that `cjct`
substitutions apply to half-form consonants; therefore, this feature
Expand Down Expand Up @@ -1352,13 +1405,17 @@ to maintain compatibility with the other Indic scripts.
#### 4.5: Initial matras ####

Any left-side dependent vowels (matras) that are at the start of a
word must be tagged for potential substitution by the `init` feature
word must be flagged for potential substitution by the `init` feature
of GSUB.

### 5: Applying all remaining substitution features from GSUB ###

In this stage, the remaining substitution features from the GSUB table
are applied. The order in which these features are applied is not
are applied. In preparation for this stage, glyph sequences should be
flagged for possible application of GSUB features in stage 2,
step 10.

The order in which these features are applied is not
canonical; they should be applied in the order in which they appear in
the GSUB table in the font.

Expand Down Expand Up @@ -1413,7 +1470,11 @@ typographically problematic.
### 6: Applying remaining positioning features from GPOS ###

In this stage, mark positioning, kerning, and other GPOS features are
applied. As with the preceding stage, the order in which these
applied. In preparation for this stage, glyph sequences should be
flagged for possible application of GSUB features in stage 2,
n8willis marked this conversation as resolved.
Show resolved Hide resolved
step 10.

As with the preceding stage, the order in which these
features are applied is not canonical; they should be applied in the
order in which they appear in the GPOS table in the font.

Expand Down