-
Notifications
You must be signed in to change notification settings - Fork 95
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
Include relative path starts from within the UFO #157
Comments
For reference, here is what the specs says:
The current implementation follows the “typical implementation” mentioned in the specs. |
Sorry about that! I looked at the UFO spec but didn't check the FDK. Thank you for clarifying, and I can live with the discrepancy between this and other software, which apparently is not generating according to spec. :-) |
On second thought, it’s not clear what the “typical implementation” mentioned in the specs actually means. I was only assuming this was from some *.ufo/features.fea file but it’s actually not explicit and may very well be from a features.fea in any location. Considering that other implementations make the same assumption that the include path is relative to the UFO or VFB instead, it probably makes more sense to follow that logic. This would also make more sense in a future UFO4 single file format. |
the whole having said that, probably we can agree on changing this, and pass to feaLib the path of the UFO itself, instead of the features.fea file that is inside the UFO folder. we only need to change this line here: |
Tal said it should be relative to the UFO, not the features.fea |
it's trivial to make the change in ufo2ft. Though I wonder if there are source files out there meant to be compiled with fontmake which rely on the previous behavior (relative to inner features.fea). |
We can check for the previous behaviour, print a warning that it will be deprecated in the next minor update, otherwise use the logical behaviour. |
how would you check for the previous behavior? |
We could check whether the file exists or not, but there are corner cases where two files with the same name exists in both places. |
I guess it’s good enough to drop the previous behaviour completely and just provide a helpful error message if the file is not found in the correct location. |
even that.. feaLib |
Thank you for addressing this!
FWIW, I have been duplicating the file in both places so that I can build in either environment, and I’m probably not the only one. So yeah I think a helpful error would be my preference, so it’s always clear which file is getting used. |
subclass of FeatureLibError, only raised if IOError.errno == ENOENT (i.e. FileNotFoundError) googlefonts/fontmake#157 (comment) Will be useful in ufo2ft to detect when an included feature file doesn't exist and print a nicer error message explaining that includes must be relative to the UFO itself, and not relative to the embedded features.fea file. unified-font-object/ufo-spec#55
@anthrotype no need to wonder. There are at least 4 public projects that rely on the current behavior: Source Sans/Serif/Code, Adobe Variable Font Prototype. |
Relative to UFO, not the including file, sounds so wrong to me. |
Maybe we can add include paths for search, the way C compilers do. |
Agree. |
yeah, but if you think about a future possible alternative UFO format as a self-contained single file, then it makes sense to resolve includes starting from the path of the UFO itself. The problem is that two major consumers of features files that predate fontmake, namely makeotf and Robofont, both work like that. |
that's interesting. However in the CPP you have two variants, one for system headers with Whereas in feature files, we only have one form of But it's the meaning of the "current" directory which is the problem (the directory of the UFO or the UFO itself as the directory containing the features.fea). |
and I would not like to unilaterally implement things in fontmake but prefer all stakeholders agree on a solution that accommodate all, otherwise we only make the fragmentation problem worse. Incidentally, that's what we did when we changed feaLib's include logic, which originally worked with nested includes like the CPP does (relative includes from included files), and decided to match makeotf's behavior (all nested includes resolved with reference to the first including file), despite the latter is funky. |
related adobe-type-tools/afdko#164 |
From a UI perspective (esp. in RoboFont), it makes a lot of sense. The user sees a field in which fea code can be written. Where it's saved is not interesting: it's part of the UFO blob of data. You don't want other fea files to be placed inside the UFO, so there's also no use case to use the location of |
Spec updated, see: unified-font-object/ufo-spec#66 |
Btw that’s already implement in ufo2ft, a release is coming early next week |
this can be closed now that fontmake 1.5 was released |
Actually I highly disagree with this. I want the UFO folder to be self-contained. |
Then put all your feature code in features.fea. From the perspective of a "normal" user, a *.ufo is a "file", and not a folder containing files. It's a storage blob. On macOS, it actually looks and behaves like a file. An important use case for |
In a UFO with an
include
statement to a relative path, when I use fontmake, it seems to calculate the path relative to the features.fea file within the UFO. As far as I can tell, this is at odds with what other UFO generators do, which is make the path relative to folder that contains the UFO.I figured I'd let you know about the discrepancy for what its worth. Apologies if this is actually a fontTools thing, or if I'm missing something obvious. Thanks!
For example, I have a folder structure modeled after this:
And an internal feature file like this:
This would work generating from RoboFont/FDK, but with fontmake I get something like this.
Thanks!
The text was updated successfully, but these errors were encountered: