GSUB lookup processing: only ever one action?
Peter Constable
Posts: 210
I should know this, but I'm not finding this clearly specified in the OpenType spec. It does say this (https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#lookupTbl):
"During text processing, a client applies a lookup to each glyph in the string before moving to the next lookup. A lookup is finished for a glyph after the client makes the substitution/positioning operation."
I have always understood this to mean that, for a given glyph-sequence position, lookup subtables are evaluated in order, and once a subtable is found to match and is processed, then processing continues at the "next" glyph position. But I can't find text in the spec that says exactly that.
Also, I can't find text to explain what is expected if a subtable defines multiple actions that could operate on different positions in a sequence. In particular, in contextual substitution subtables, there is an array of substitution lookup records each of which specifies a position in the input sequence and a lookup index (for the action to be applied at that position). It's clear that the records are processed in order. But it's not completely clear whether processing of the lookup subtable stops after the first record or if all records are processed. It seems to me it would have to be the latter, else it would always be the very first record gets process and remaining records would always be ignored. Can anyone confirm that?
"During text processing, a client applies a lookup to each glyph in the string before moving to the next lookup. A lookup is finished for a glyph after the client makes the substitution/positioning operation."
I have always understood this to mean that, for a given glyph-sequence position, lookup subtables are evaluated in order, and once a subtable is found to match and is processed, then processing continues at the "next" glyph position. But I can't find text in the spec that says exactly that.
Also, I can't find text to explain what is expected if a subtable defines multiple actions that could operate on different positions in a sequence. In particular, in contextual substitution subtables, there is an array of substitution lookup records each of which specifies a position in the input sequence and a lookup index (for the action to be applied at that position). It's clear that the records are processed in order. But it's not completely clear whether processing of the lookup subtable stops after the first record or if all records are processed. It seems to me it would have to be the latter, else it would always be the very first record gets process and remaining records would always be ignored. Can anyone confirm that?
0
Comments
-
You are right that the spec is vague on how lookups are applied “across” an input sequence. I have the same understanding as you, which is that shapers apply the Omar Khayyam principle (“the moving input stream cursor applies lookups, and having applied a lookup moves on”) but I have also not been able to find this clearly documented. In fact the spec seems to imply the opposite - the part you quoted says that the lookup is finished once it is applied, (and so we move onto the next lookup) not that the glyph position is finished once a lookup is applied (and so we move onto the next glyph position).
0 -
The remainder of the paragraph I was quoting from makes clear that the cursor position advances after a lookup is applied:
"To move to the “next” glyph, the client will typically skip all the glyphs that participated in the lookup operation: glyphs that were substituted/positioned as well as any other glyphs that formed a context for the operation. However, in the case of pair positioning operations (i.e., kerning), the “next” glyph in a sequence may be the second glyph of the positioned pair (see pair positioning lookup for details)."
But this paragraph is less clear about whether the cursor advances after a single lookup is processed or if other lookups may be processed at the same position before advancing the cursor. (I'm rusty... I'm pretty sure it's the former.) The spec should make these details clear.
0 -
I think this covers your question related to contextual rules:
If there is a match, then the client finds the target glyph positions for substitutions and completes the substitutions.Source:
0 -
Also:
«If there is a match, then the client finds the target glyph positions for substitutions and completes the substitutions. Please note that (just like in the ContextSubstFormat1 subtable) these lookups are required to operate within the range of text from the covered glyph to the end of the input sequence. [...]
Once the substitutions are complete, the client should move to the glyph position immediately following the matched input sequence and resume the lookup process from there.»
http://https//docs.microsoft.com/en-us/typography/opentype/spec/gsub#61-chaining-context-substitution-format-1-simple-glyph-contexts
1 -
Yes, Karsten picked up on the following paragraph which indicates what the processing model is.
I'd still like to see things stated more clearly in the spec, though.1 -
I am not sure this topic related to the processes I did in Fontforge. All lookups work when the matches are present. So, seem like the process move onto the next glyph ( class ) and not stopping the rest of the substitutions.0
-
Peter Constable said:
"To move to the “next” glyph, the client will typically skip all the glyphs that participated in the lookup operation: glyphs that were substituted/positioned as well as any other glyphs that formed a context for the operation. However, in the case of pair positioning operations (i.e., kerning), the “next” glyph in a sequence may be the second glyph of the positioned pair (see pair positioning lookup for details)."0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 803 Font Technology
- 1K Technique and Theory
- 622 Type Business
- 444 Type Design Critiques
- 542 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 485 Typography
- 303 History of Typography
- 114 Education
- 68 Resources
- 499 Announcements
- 80 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 270 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports