Closed dscorbett closed 4 years ago
Where exactly is it specified that the contextual analysis is done by shaping engines?
I agree that that's a sensible shaping engine design. And, the Estrangelo Edessa, Segoe UI Historic and NotoSansSyriac* fonts do you GSUB type 1 for both fin2 and fin3, so evidently those font implementations appear to assume that. Microsoft's Syriac implementation spec might be read that way, though it's not explicitly clear.
Apply feature 'fin3' to replace the 'Alaph' glyph at the end of Syriac words when the preceding base character is a 'Dalath', 'Rish', or dotless 'Dalath-Rish'.
It doesn't say, "apply... to the 'Alaph' glyph—and only the 'Alaph' glyph..."
Potentially a type 6 lookup could be used to provide a (backtrack / lookahead) context in the lookup while still acting only on the one glyph; that would work whether the shaping engine applied the feature only to the one glyph or to a longer sequence.
But type 5 certainly isn't the best recommendation.
Changed fin2, fin3 and med2 for next version. Following (for fin3) is representative:
Recommended implementation: The 'fin3' table maps default alphabetic forms to corresponding final forms (GSUB lookup
type 5type 1).
Where exactly is it specified that the contextual analysis is done by shaping engines?
I agree that that's a sensible shaping engine design. And, the Estrangelo Edessa, Segoe UI Historic and NotoSansSyriac* fonts do you GSUB type 1 for both fin2 and fin3, so evidently those font implementations appear to assume that. Microsoft's Syriac implementation spec might be read that way, though it's not explicitly clear.
No one assumes the Syriac spec reads that way. What happened is that I did extensive testing of what Uniscribe does and made HarfBuzz do something similar. Here's my writeup from the time:
As like much of script-specific shaper docs, what the document says is irrelevant.
Apply feature 'fin3' to replace the 'Alaph' glyph at the end of Syriac words when the preceding base character is a 'Dalath', 'Rish', or dotless 'Dalath-Rish'.
It doesn't say, "apply... to the 'Alaph' glyph—and only the 'Alaph' glyph..."
That's irrelevant. The context-analysis is the "when the preceding base character is a 'Dalath', 'Rish', or dotless 'Dalath-Rish'". The 'Alaph' is input to the substitution. If there's something other than Alaph, then the lookup won't be applied worst-case.
Potentially a type 6 lookup could be used to provide a (backtrack / lookahead) context in the lookup while still acting only on the one glyph; that would work whether the shaping engine applied the feature only to the one glyph or to a longer sequence.
In general I find the "Recommended implementation"s widely confusing and unnecessary. Font designer should be free to use any lookup type (and mix of multiple lookup types) for any feature. If any implementation / all implementations have a specific requirement of a specific lookup type, that should be written down, and NOT as a "recommended" but "requirement".
But type 5 certainly isn't the best recommendation.
The context-analysis is the "when the preceding base character is a 'Dalath', 'Rish', or dotless 'Dalath-Rish'". The 'Alaph' is input to the substitution.
It seems obvious that was the intent, but the wording used was a bit sloppy and unclear.
Apply feature 'fin3' to replace the 'Alaph' glyph...
(Emphasis added.) It describes an intended result, but not exactly how it is intended to be obtained.
Here's proposed revision of the descriptions to address this:
'fin2':
Function:
ReplacesUsed to replace the Alaph glyph at the end of Syriac words with its appropriate form, when the preceding base character cannot be joined to, and that preceding base character is not a Dalath, Rish, or dotless Dalath-Rish. ...Application interface:
The application is responsible for noting word boundaries. For GIDs in the middle of words and found in the 'fin2' coverage table, the application passes a GID to the feature and gets back a new GID.The application applies the feature to the Alaph glyph when the preceding base character is non-joining and is a character other than Dalath, Rish, or dotless Dalath-Rish.
'fin3':
Function:
ReplacesUsed to Alaph glyphs at the end of Syriac words when the preceding base character is a Dalath, Rish, or dotless Dalath-Rish....
Application interface:
The application is responsible for noting word boundaries. For GIDs in the middle of words and found in the 'fin3' coverage table, the application passes a GID to the feature and gets back a new GID.The application applies the feature to the Alaph glyph when at the end of Syriac words if the preceding base character is Dalath, Rish, or dotless Dalath-Rish.
'med2':
Function:
ReplacesUsed to replace Alaph glyphs in the middle of Syriac words when the preceding base character can be joined to. This feature is used only for the Syriac script alaph character....
Application interface:
The application is responsible for noting word boundaries. For GIDs in the middle of words and found in the 'med2' coverage table, the application passes a GID to the feature and gets back a new GID.The application applies the feature to the Alaph glyph when the preceding base character is a joining character.
(Btw, this uses the Application interface part in a way that isn't a repeat of GSUB/GPOS details.)
The sections on 'fin2' and 'fin3' recommend using GSUB lookup type 5 (contextual substitution). However, they should recommend GSUB lookup type 1 (single substitution) because the relevant contextual analysis is done by the shaper, not by the font.
The same goes for 'med2' on another page.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.