googlefonts / fontmake

Compile fonts from sources (UFO, Glyphs) to binary (OpenType, TrueType).
Apache License 2.0
764 stars 93 forks source link

Glyphs.app's Feature Condition Syntax is not supported #951

Open kostictype opened 1 year ago

kostictype commented 1 year ago

I'm using fontmake to export VF with CFF2 outlines from a Glyphs3 file. It builds the UFO and designspace but then fails when I have this code in the feature rlig:

feature rlig {
#ifdef VARIABLE
condition 18 < wght < 278, wdth < 40;
sub dollar by dollar.gap;
sub dollar.ss06 by dollar.ss06.gap;
sub cent by cent.gap;

condition 100 < wght < 278, wdth < 100;
sub dollar by dollar.gap;

condition 152 < wght < 278, wdth < 70;
sub dollar.ss06 by dollar.ss06.gap;
sub cent by cent.gap;

condition 18 < wght < 152, wdth < 40;
sub ampersand by ampersand.comp;

#endif

} rlig;

This is the error: Generating fonts from Designspace failed: <features>:510:1: Expected glyph class definition or statement: got NAME condition (line 510 is: condition 18 < wght < 278, wdth < 40;)

Is there way to go around this changing the Glyphs file? Or some other simple solution?

anthrotype commented 1 year ago

I think that's Glyphs.app's specific way to specify FeatureVariations-style conditional substitutions, the official FEA spec is set to encode these differently -- if/when @simoncozens proposal at https://github.com/adobe-type-tools/afdko/pull/1350 is merged (not sure what's the status on that). fonttools, which fontmake uses to compile OT layout features, only supports the latter.

glyphsLib may eventually add support for translating from Glyphs.app's own notation to the FEA variation syntax, but I don't think anybody is actively working on that, see https://github.com/googlefonts/glyphsLib/issues/800

kostictype commented 1 year ago

Thank you for the information!

vv-monsalve commented 1 year ago

I'm having the same situation with another project. I left a comment in the glyphsLib#800 issue linked above.

HugoJourdan commented 1 year ago

Same problem here. Impossible to generate variable with rlig feature syntax from of Glyphs.

arrowtype commented 3 months ago

Running into this, as well. Also posted over on the glyphsLib issue.