-
Notifications
You must be signed in to change notification settings - Fork 168
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
[spec] Clarify path resolution of include statements #164
Comments
@brawer @miguelsousa @bobh0303 @behdad @anthrotype @justvanrossum @typesupply A case where the relative-to-base-file model is better is referencing files that are specific to a font instances, such as: Then 'base_features.fea' alone can contain the references: I now favor changed the feature file spec to support the relative-to-base-file model. Because of history, however, I would also say that implementations should additionally support the relative-to-including-file system. More specifically, a feature file should first be located using the relative-to-base-file model, If this fails, the implementation should check to see if can be found with the relative-to-including-file. AS an additional issue, I suggest changing the feature file spec to state a specific exception for UFO fonts, that include statements are relative to the directory of the font directory, rather than the base feature file. I don't really like this much, but I understand that paths which are relative to a hidden file may be confusing to UFO users. Comments? |
@readroberts sounds fine to me. |
I see the use for both models. I, again, propose the following:
|
As long as it's clear that only Yes, this is likely to be non-ideal in some use cases, but it also means that data that isn't part of the UFO Spec won't be ignored/deleted. Do like the proposed syntax! |
@readroberts an urgent fix for this issue is needed. Currently it's impossible to run |
Sounds good to me. |
Fix issue that feature files referenced from a UFO font won't work in makeotfexe. Note that for each include statement encountered, the current logic will try in order: - If the source font is UFO format, resolve path relative to the UFO's font directory - resolve path relative to the top-level include file - resolve path relative to the parent include file This does mean that a font project will build even if it mixes all three models in different include files. The problem is that there is no way to know which model is intended until the first relative include path is encountered that will work with only one of the models, and even then it would be possible to draw the wrong conclusion. Ultimately, the most reliable approach would be to provide options so that a user could force one method or another. I think that scenarios where this will be a problem are sufficiently rare so as to not to be worth dealing with. Fixes #164
Fix issue that feature files referenced from a UFO font won't work in makeotfexe. Note that for each include statement encountered, the current logic will try in order: - If the source font is UFO format, resolve path relative to the UFO's font directory - resolve path relative to the top-level include file - resolve path relative to the parent include file This does mean that a font project will build even if it mixes all three models in different include files. The problem is that there is no way to know which model is intended until the first relative include path is encountered that will work with only one of the models, and even then it would be possible to draw the wrong conclusion. Ultimately, the most reliable approach would be to provide options so that a user could force one method or another. I think that scenarios where this will be a problem are sufficiently rare so as to not to be worth dealing with. Fixes #164
Fix issue that feature files referenced from a UFO font won't work in makeotfexe. Note that for each include statement encountered, the current logic will try in order: - If the source font is UFO format, resolve path relative to the UFO's font directory - resolve path relative to the top-level include file - resolve path relative to the parent include file This does mean that a font project will build even if it mixes all three models in different include files. The problem is that there is no way to know which model is intended until the first relative include path is encountered that will work with only one of the models, and even then it would be possible to draw the wrong conclusion. Ultimately, the most reliable approach would be to provide options so that a user could force one method or another. I think that scenarios where this will be a problem are sufficiently rare so as to not to be worth dealing with. Fixes #164
It might be good to adjust the wording of Section 3 of the feature file syntax. Currently, it could be interpreted as if
include
statements in feature files worked like in other programming languages, such as the C preprocessor:However, according to @miguelsousa in fonttools/fonttools#838, this is actually not the case. Instead, include paths are getting resolved relative to the first file being compiled; see Miguel’s example. It would be good if the feature file spec could make the (somewhat unusual) behavior of
include
statements more explicit.The text was updated successfully, but these errors were encountered: