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?
Comments
"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.
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. 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
I'd still like to see things stated more clearly in the spec, though.