Skip to content

Fix handling of included feature files - #150

Merged
justvanrossum merged 3 commits into
mainfrom
included-feature-file-issue-149
Jul 17, 2026
Merged

Fix handling of included feature files#150
justvanrossum merged 3 commits into
mainfrom
included-feature-file-issue-149

Conversation

@justvanrossum

Copy link
Copy Markdown
Member

This fixes #149.

However: the test font (ExternalFeatureFile.glyphs) still does not work with Fontra or fontmake, because it causes the expanded features to have a languagesystem statement that is not at the top of the file.

This file was modeled after a real project, and I'm not sure if this is a construct that Glyphs handles fine on export and only fontc and fontmake complain about, or whether the test file ended up being atypical. Cc @faebiou, @RafalBuchner.

@justvanrossum

justvanrossum commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

FWIW it's about this fragment in the .glyphs file:

featurePrefixes = (
{
code = "include(ExternalFeatureFile.fea);
";
name = include;
},
{
automatic = 1;
code = "languagesystem DFLT dflt;
";
name = Languagesystems;
}
);

The included file comes first bit (the file contains a languagesystem statement), and after the included code we'll see the second languagesystem DFLT dflt (from the second part of the snippet), which causes the errors in fontmake and fontc.

@justvanrossum

Copy link
Copy Markdown
Member Author

@khaledhosny, do you happen to know any Glyphs-based projects that are built with fontmake and use an external .fea file?

@khaledhosny

Copy link
Copy Markdown
Contributor

Inter seems to use external feature files: https://github.com/rsms/inter/tree/master/src

@justvanrossum

Copy link
Copy Markdown
Member Author

I checked with the Inter sources, and the languagesystem declaration in the .glyphs data comes before the include section, and therefore works out of the box with this PR. I've adjusted the test .glyphs file here to follow that pattern.

@justvanrossum
justvanrossum merged commit 95c4e8a into main Jul 17, 2026
3 checks passed
@justvanrossum
justvanrossum deleted the included-feature-file-issue-149 branch July 17, 2026 14:12
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.

External feature file include does not work, breaks error handling

2 participants