-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhance support for external feature files (adapt file path) #797
enhance support for external feature files (adapt file path) #797
Comments
hm not good. So, fontmake has a way to --expand-features-to-instances but that's only for instance UFOs, here the issue is in the master UFOs themselves as produced by glyphsLib.
Yes, I agree
I know this is only a workaround, but how about you force fontmake to generate the master UFOs in the same directory as the source .glyphs file? Fontmake has a --master_dir option to control that |
Good tip. But at GF we use gftools builder to wrap fontmake and post-process scripts. Maybe we can add the argument in the yaml file. Let's ask gftools wizard @m4rc1e. |
I don't think it's a good idea to modify gftools builder to pollute the source directory with temporary generated files to work around this. This should be fixed in glyphsLib. |
maybe as a quick hack, gftools could copy the source file to the build directory, and tell fontmake to use the same build directory as the --master_dir. But really, it'd be better to fix this properly here. |
I agree |
we already use the fontTools.feaLib Parser, but it looks like it is intentional that we call it with glyphsLib/Lib/glyphsLib/builder/features.py Line 514 in 76db340
Maybe we don't follow includes by default because we want to be able to round-trip from .glyphs => UFO => .glyphs and keep the include statements? If that's the case, I suggest the builder adds an option (False by default) that lets fontmake turn the followIncludes=True when parsing the features.fea. |
Or maybe better, we can rereuse the option named glyphsLib/Lib/glyphsLib/builder/__init__.py Lines 50 to 52 in 76db340
|
fontmake already calls glyphsLib with minimal=True to build the master UFOs |
correction: currently we call the feaLib Parser (with followIncludes=False as in the snipped quoted above) only when converting UFO features.fea => .glyphs features, but the issue here regards the other way around, .glyphs => UFO. So one way to fix the current issue with includes is, at the end of |
actually we don't even need to call the feaLib Parser, we just need to use the IncludingLexer and concatenate all the tokens yielded by the lexer (which follows includes) into a new string |
wish it were that simple.. The lexer skips over the special characters that identify each token type so the returned strings can't simply be joined back together. I would like to avoid having to call the full Parser just to resolve the includes, parsing needs to happen later on in the pipeline when the tables are built so it feels unnecessary to do it here again only to resolve includes.. |
Couldn't you add an additional search path so that fontMake scan find the external files? Kind of like a header search path for c build settings? |
hm, that's an option too, however currently the feaLib IncludingLexer only takes one includeDir, not a list of them to search within. Though a single includeDir should be enough; in the case of a .glyphs input, fontmake could tell ufo2ft to use the directory of the original .glyphs source instead of the directory of the master UFO. |
I’m in favor of fixing this in glyphsLib, this is the kind of thing |
I already have wip branches to fix this in ufo2ft and fontmake. I actually prefer to do that there, because I think it's pointless to having to parse the features when doing .glyphs => ufos, then again when building off these ufos. |
if one really wishes that glyphs2ufo also expands all the includes, we could add an option for that later. |
This is intended to fix googlefonts/glyphsLib#797, by allowing fontmake to override the default include directory used for parsing a UFO features.fea; useful when the UFOs where generated from a .glyphs source whose features contain some `include` statements and they are saved in a different directory (or not saved to disk at all). fontmake will need to be modified to call ufo2ft with this new option when starting to build from a .glyphs input.
…irectory when building from Glyphs Fixes googlefonts/glyphsLib#797 Requires googlefonts/ufo2ft#637
Expanding the features here means fontmake Font.glyphs works out of box, your proposed solution adds another option for user to discover and further complicates the already unreasonably complex fontmake. |
no, my proposed solution doesn't require any new option, fontmake would automatically pass to ufo2ft the correct include directory when building from .glyphs source. |
As suggested in #797, it may be useful sometimes to resolve and expand include statements in features, to create self-contained UFOs/glyphs sources that don't reference any external files. It is disabled by default, to make sure rountripping continues to work. It is not conflated with 'minimal' option because they are distinct things, one may want to enable one without the other.
…irectory when building from Glyphs Fixes googlefonts/glyphsLib#797 Requires googlefonts/ufo2ft#637
…irectory when building from Glyphs Fixes googlefonts/glyphsLib#797 Requires googlefonts/ufo2ft#637
…irectory when building from Glyphs Fixes googlefonts/glyphsLib#797 Requires googlefonts/ufo2ft#637
As suggested in #797, it may be useful sometimes to resolve and expand include statements in features, to create self-contained UFOs/glyphs sources that don't reference any external files. It is disabled by default, to make sure rountripping continues to work. It is not conflated with 'minimal' option because they are distinct things, one may want to enable one without the other.
As suggested in #797, it may be useful sometimes to resolve and expand include statements in features, to create self-contained UFOs/glyphs sources that don't reference any external files. It is disabled by default, to make sure rountripping continues to work. It is not conflated with 'minimal' option because they are distinct things, one may want to enable one without the other.
As suggested in #797, it may be useful sometimes to resolve and expand include statements in features, to create self-contained UFOs/glyphs sources that don't reference any external files. It is disabled by default, to make sure rountripping continues to work. It is not conflated with 'minimal' option because they are distinct things, one may want to enable one without the other.
As suggested in #797, it may be useful sometimes to resolve and expand include statements in features, to create self-contained UFOs/glyphs sources that don't reference any external files. It is disabled by default, to make sure rountripping continues to work. It is not conflated with 'minimal' option because they are distinct things, one may want to enable one without the other.
As suggested in googlefonts#797, it may be useful sometimes to resolve and expand include statements in features, to create self-contained UFOs/glyphs sources that don't reference any external files. It is disabled by default, to make sure rountripping continues to work. It is not conflated with 'minimal' option because they are distinct things, one may want to enable one without the other.
Trying to build this font; https://github.com/rsms/inter-gf-tight
The features are contained in separated feature files, and I have this error when building;
GlyphsApp can build the font, and it finds the features of course.
I figured that the problem was that the master_ufo is another directory, and therefore the path of the feature should be adapted; instead of having
include(features/ccmp.fea);
, it should then beinclude(../features/ccmp.fea);
. Doing it in the Glyphs file makes it works but breaks the export with Glyphs for other users. IMO glyphsLib or glyphs2ufo should adapt the feature path accordingly.The text was updated successfully, but these errors were encountered: