-
Notifications
You must be signed in to change notification settings - Fork 17
Match fontc's check for determining whether a designspace is variable #1422
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
base: main
Are you sure you want to change the base?
Conversation
|
arguably the opposite should happen. A font with only one source can't ever be variable so whatever variable tables fontc they must all be empty and no-op. |
|
i checked the |
|
What is the expected outcome of such a designspace? An inert variable font? |
|
currently in the python toolchain, it depends on what the user asks. If fontmake -o variable, you'd get the dummy variable tables, if fontmake -o ttf, you get one static font. |
|
however, in this particular case, where there is only one source, it's clear that you can't make a meaningful variable font from just one source, so you may argue the expected outcome is a static font. |
|
|
|
Ta both for taking a look :) Agreed that producing a VF with empty variable tables does not respect the intent of these sources, and that we should avoid this; with that said, a few reasons are persuading me that the place for this logic is not inside of the fontc binary itself: The Glyphs file-format is high-level, and it is expected that building a variable or static is determined with a heuristic. On the other hand, the designspace and UFO formats are expected to authoritatively build whatever is contained within them, even when overriding conventional default engineering. To this end, I would expect fontc to always produce an As a fallback, the user has the option to pass the single UFO it contains instead to produce a static build. There are potentially niche engineering uses for the limited VFs too, e.g., a per-script sub-subfamily that can match the axes of its wider parent family even for a writing system that can only vary a subset of them. |
|
after writing, I am now thinking there might be a Plan C for crater/ttx_diff and gftools; if the designspace only has a single source, we pass that UFO through to fontc directly instead? |
|
if the designspace is modified such that the axis min==default==max, then fontc also builds a static font: <axes>
<axis default="100" name="width" maximum="100" tag="wdth" minimum="100">
<labelname xml:lang="en">Width</labelname>
</axis>
</axes>so if we want the logic in ttx_diff.py to match fontc's "variable first" approach, it's not sufficient that you count the number of axes > 0. You want to check that all the axes are not "point" axes (i.e. their min != default or default != max). fontc counts only the variable axes thus defined. And actually, len(axes) == 0 is not even a valid designspace, even fontmake rejects it. |
|
But if we were to take the font developer's intentions into account (which I believe we should), ttx_diff.py should read the config.yaml file (if present) and check for the presence of buildVariable: true|false to determine if a source was meant to be build as variable or not. |
|
config.yaml is Google-only and probably not appropriate to read from a general purpose compiler? - certainly whatever our replacement for gftools ends up being could do so. |
|
of course, I didn't mean fontc should check config.yaml, but that ttx_diff.py does that in order to decide whether to build a variable or static font |
|
Crater produced this command based on the config.yaml: I don't think it makes sense for ttx_diff to turn around and reparse config.yaml so perhaps we should add flags for crater to advise it. I suppose we would then need the ability for fontc to be specifically advised to not build a variable font even if the source appears to suggest it. Which is ... weird. ...are we sure this isn't a source issue? Why does it make sense for BacasimeAntique to specify variable width if it doesn't actually want that? <axes>
<axis default="100" name="width" maximum="220" tag="wdth" minimum="80">
<labelname xml:lang="en">Width</labelname>
<map output="80" input="80"/>
<map output="100" input="100"/>
<map output="300" input="220"/>
</axis>
</axes> |
it doesn't make sense, in fact I initially commented that "the entire .designspace file is technically useless". Yes, I agree this is a source issue and can and should be fixed there, to align the source data with the expected result (a static font). |
Some of the larger diffs on crater come from designspaces that
ttx_diff.pyis instructing fontmake to build as statics, but which fontc will always build as variable (e.g.docrepair-fonts/bacasime-antique-fonts). This PR brings the condition inttx_diff.pyin line with the one in fontc, which resolves these.Trade-off
Any designspace that is single source is probably being instructed to be built as static by gftools. This means that after the change, the TTFs on crater would be less representative of those produced by gftools in the real world, even if as a superset of the tables and data that would be included in the statics. (UFOs are unaffected)
The alternative to this PR would be either:
buildStaticsis enabled.