MicrosoftDocs / typography-issues

Creative Commons Attribution 4.0 International
47 stars 21 forks source link

Contextual Substitution matching ranges unspecified #184

Open litherum opened 5 years ago

litherum commented 5 years ago

DirectWrite requires that all recursive matches that LookupType 5 references are entirely contained within the match of the outer contextual substitution match.

CoreText requires that all recursive matches that LookupType 5 references begin within the match of the outer contextual substitution match, but are allowed to extend beyond the end of the outer match.

HarfBuzz imposes no such limitation; the recursive match can begin entirely outside of the outer contextual substitution match.

The specification could be more clear on this point.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

PeterCon commented 4 years ago

Cf. #407

PeterCon commented 4 years ago

@litherum Can you clarify: is the scenario one in which a type 5 main lookup is referencing a nested lookup that's also type 5 or maybe type 6?

(If the nested lookup were type 1 to 4, I don't think there's any ambiguity here.)

PeterCon commented 4 years ago

@litherum : I'm wondering if your monitoring and can provide clarification. Thanks.

litherum commented 4 years ago

is the scenario one in which a type 5 main lookup is referencing a nested lookup that's also type 5 or maybe type 6?

Yes.

PeterCon commented 4 years ago

The following is a proposed revision that clarifies some things related to this issue, but not specifically this issue. (These are in a way prior assumptions that should probably be clear before attempting to clarify this issue.) I don't think any of this is in dispute.

This is all in the Lookup Table section of chapter 2. I've quoted starting with the paragraph preceding where changes in question are made to make it easier to see the context.

Each LookupType is defined with one or more subtables, and each subtable definition provides a different representation formatsubtable formats applicable to the given LookupType. The format is determined by the content of the information required for an operation and by required storage efficiency. When glyph information is best presented in more than one format, a single lookup may contain more than one subtable, as long as all the subtables are the same LookupType. For example, within a given lookup, a glyph index array format may best represent one set of target glyphs, whereas a glyph index range format may be better for another set of target glyphs.

During text processing, a client applies a feature to some sequence of glyphs for a string. It then processes the lookups referenced by that feature in their lookup list order. For each lookup, the client processes that lookup over each glyph in the sequence to which the feature has been applied. After that lookup has been processed for each glyph in the sequence, it then processes the next lookup referenced by the feature in the same manner. This continues until all lookups referenced by the feature have been processed.

Note that an application may processes lookups for multiple features simultaneously. In this case, the list of lookups is the union of lookups referenced by all of those features, and then are all processed in their lookup list order. If the different features have been applied to different glyph sub-sequences for a string, each lookup is applied only to the sub-sequence to which the feature that referenced that lookup was applied.

During text processing, a client applies a lookup to each glyph in the string before moving to the next lookup.A lookup specifies an input sequence pattern of one or more glyphs. When the lookup is processed over a glyph sequence within a string, the client starts with the first glyph in the sequence, testing for a match with the input sequence pattern specified by the lookup. If the glyph sequence does not match the lookup input sequence pattern, processing of the lookup is finished for that glyph, and the client advances to the next glyph in the glyph sequence. If the glyph sequence does match the lookup input sequence pattern, then the substitution or position operation is performed on the matched input sequence. A lookup is finished for a glyph after the client makes the substitution/positioning operationhas performed the substitution or positioning operation. 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 operationin the matched input sequence. However, an exception is made in the case of pair positioning operations (i.e.for example,, kerning), the “next” glyph in a sequence may be the second glyph of the positioned input sequence pair (see the pair positioning lookup type for details).

Both the GPOS and GSUB tables include lookup types that allow chained contexts (GSUB lookup type 6, and GPOS lookup type 8). Chained context lookup types support specifying backtrack and lookahead sequence patterns that precede and follow the input sequence pattern and must also be matched in the glyph sequence for a lookup to apply at a given position in the glyph sequence. Unlike the input sequence pattern, matching of the backtrack and lookahead sequences is not restricted to the glyph sequence to which the associated feature was applied. A chained context lookup can specify actions for glyphs in the matched input sequence, but not in the backtrack or lookahead sequences.