-
Notifications
You must be signed in to change notification settings - Fork 17
[fea-rs] Support inline alternate substitution in contextual rules #1925
Copy link
Copy link
Open
Description
fea-rs currently rejects inline alternate substitution rules in contextual (chained) context:
feature calt {
sub a' comma from [A a.alt1 a.alt2];
sub b' comma from [B b.alt];
} calt;
error: alternate substition rules cannot be specified inline
|
6 | sub a' comma from [A a.alt1 a.alt2];
| ^^^^Although exotic, this is valid OpenType Feature File syntax. fonttools has supported compiling this since 2016 (fonttools/fonttools@db49f20d6, PR fonttools/fonttools#445). Just today, I added an optimization to reuse the same nested AlternateSubst lookup when consecutive chained alternate rules share the same context (fonttools/fonttools@0903764f8, PR fonttools/fonttools#4061).
In order to match feaLib, fea-rs should:
- Parse and compile
sub <glyph>' <context> from <alternates>;by creating a nested AlternateSubst lookup - Reuse the same nested lookup when consecutive rules share the same context
fonttools has a test for this: fontTools/Tests/feaLib/data/contextual_merge_alternate.{fea,ttx}.
Discovered while working on #1922 (contextual rule merging).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels