googlefonts / googlefonts/fontmake
A “discrete” axis mapping yields unexpected and non-ideal `fvar` instance records
- Dominant language
- Python
- Stars
- 888
- Forks
- 97
- Avg merge
- 4d 52m
- Merged PRs (30d)
- 1
Description
I’m currently using FontMake 3.6.0 (the current release).
I have a designspace which seems to _mostly_ be building well with:
- An `ital` axis with a mapping to make it a discrete, binary, on/off axis
- A single variable font, including the full ital range
My goal is to have an `ital ` mapping which makes the axis work like an on/off switch. As far as the variable axis input (e.g. a “slider” interaction), this works as expected:
```xml
```
_However,_ I’ve noticed that this axis map yields unexpected instance and axis-value matching. Specifically, instances that should be assigned `ital=0` actually get assigned `ital=0.49994` in `fvar`. And then, these instances work incorrectly in apps like [WakamaiFondue](https://wakamaifondue.com/beta/) and [Fontdue](http://fontdue.com). I’m just guessing, but these apps probably look up the instances in `fvar`, then round this to `0.5`, and that value is mapped to `ital=1`. So then, the result is duplicate instances, all pointing to italics.
Here’s a snippet from `fvar`, showing what I believe to be the problem:
```xml
```
This is unexpected, because my designspace has that instance set up like this:
```xml
```
I would expect my Italic `xvalue="0"` to make it into `fvar`, but ... I guess I can also see how it matches two `output` spots in the axis map, and it can’t really know which `input` value to match, so it defaults to the higher of the two possibilities.
Still, this isn’t ideal. Is there a way to have a discrete axis map, and avoid this unintended `fvar` result?
I have found a workaround, but it doesn’t feel ideal...
To get the upright instances to be assigned `ital=0` as desired, I have to do what feels a little hack-y in the map, adding other small values to the axis map:
```xml
```
That way, the instance definitions only match a single output/input exactly, and this yields an `fvar` table with instances that look better:
```xml
```
And this variable font seems to work better in WakamaiFondue.
Is there a better way than making sure to include small values in the `map` element? Should there be?
Contributor guide
Assessment
This issue has not been assessed yet.