Skip to content

Commit

Permalink
Merge pull request #848 from googlefonts/lookup-use-extension
Browse files Browse the repository at this point in the history
[fea-rs] Parse useExtension keyword in lookups
  • Loading branch information
cmyr authored Jun 11, 2024
2 parents 4c702ab + 3944e91 commit 4d8c14a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fea-rs/src/parse/grammar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ fn table(parser: &mut Parser) {
//or lookup <label>;
fn lookup_block_or_reference(parser: &mut Parser, recovery: TokenSet) {
assert!(parser.matches(0, Kind::LookupKw));
if parser.matches(2, Kind::LBrace) {
if parser.matches(2, Kind::LBrace)
|| (parser.matches(2, Kind::UseExtensionKw) && parser.matches(3, Kind::LBrace))
{
feature::lookup_block(parser, recovery.union(TokenSet::STATEMENT));
} else if parser.matches(2, Kind::Semi) {
parser.in_node(AstKind::LookupRefNode, |parser| {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lookup what useExtension {
sub a by b;
} what;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont>

<GSUB>
<Version value="0x00010000"/>
<ScriptList>
<!-- ScriptCount=0 -->
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=1 -->
<Lookup index="0">
<LookupType value="1"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<SingleSubst index="0">
<Substitution in="a" out="b"/>
</SingleSubst>
</Lookup>
</LookupList>
</GSUB>

</ttFont>

0 comments on commit 4d8c14a

Please sign in to comment.