googlefonts / googlefonts/fontc

fea-rs: miscompilation of script/language statements inside named lookup block

Open
#1,837 3 comments 0 reactions 0 assignees View on GitHub
correctness crater
Dominant language
Rust
Stars
193
Forks
21
Avg merge
1d 17h
Merged PRs (30d)
65

Description

A funny issue related to the following FEA:

```fea
feature derp {
lookup derp_0 {
script latn;
language merp;
sub a by b;
} derp_0;
} derp;

feature merp {
lookup derp_0;
} merp;
```

what's strange here is that when we encounter a script/language statement, under the covers it means that we are creating a new lookup. A named lookup block refers to a single lookup, which makes the syntax ambiguous in a case like,

```fea
lookup what {
sub a by b;
script cyrl;
sub a-cy by b-cy;
} what;
```

In that we have a single 'named lookup block' but we actually create two lookups?

Currently the first 'script' statement ends the named lookup, and everything after that ends up getting added to an anonymous lookup. This feels bad? I'm not sure what the right answer is here, but opening this so I can investigate later.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the behavior with the two FEA examples, then trace how script/language statements are handled inside named lookup blocks. Done means the semantics are clearly decided and the demonstrated cases no longer split a named block unexpectedly between named and anonymous lookups.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.