Skip to content

[fea-rs] Accept valueRecordDef inside feature and lookup blocks#2016

Merged
anthrotype merged 1 commit into
mainfrom
fix-value-record-def-scope
May 18, 2026
Merged

[fea-rs] Accept valueRecordDef inside feature and lookup blocks#2016
anthrotype merged 1 commit into
mainfrom
fix-value-record-def-scope

Conversation

@anthrotype
Copy link
Copy Markdown
Member

@anthrotype anthrotype commented May 18, 2026

The FEA spec says valueRecordDef is a top-level-only statement, but feaLib has accepted it inside feature and lookup blocks since valueRecordDef was first implemented (fonttools/fonttools@c06a377aa, Aug 2015), it was never limited to top-level scope. And as we found out today, real fonts rely on this: e.g. Google Sans Arabic defines a named value record inside a feature block:

feature kern {
    # ...
    valueRecordDef <0 -260 0 0> DOT_SHIFT;
    lookup yehbarree_marks_arabic { ... } yehbarree_marks_arabic;
    # ...
} kern;

This adds valueRecordDef handling to the parser, validator, and compiler for feature/lookup block scope.

Part of #2014.

The spec says valueRecordDef is a top-level statement, but feaLib has
always accepted it inside feature and lookup blocks, and real fonts
use this (e.g. Google Sans Arabic defines DOT_SHIFT inside a feature
block). Accept it for feaLib compatibility.

Part of #2014.
@anthrotype anthrotype force-pushed the fix-value-record-def-scope branch from c989b10 to 61b0ed9 Compare May 18, 2026 15:20
@anthrotype anthrotype added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit 9f9843d May 18, 2026
12 of 13 checks passed
@anthrotype anthrotype deleted the fix-value-record-def-scope branch May 18, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants