designSpaceDocument
designSpaceDocument copied to clipboard
add support for axisvaluenames in axis
@LettError: Maybe this is a way to add AxisValueNames into DSD? Only added things to the 'write' part of code.
<axes>
<axis default="200" maximum="1000" minimum="0" name="Name" tag="NAME">
<valuenames>
<valuename value="300" valuename="Normal" />
</valuenames>
</axis>
</axes>
Weren't there ranges of values as well?
In STAT there is a a section about the axes. That info we can get out of fvar. No need to put that info in the DSD again.
The AxisValueArray how ever want to know how you want to call a particular value of an axis. If you have a design space with weight and width, you instances will called something like BoldCondessed. But STAT want to know width=75, name='Condessed'.
Make sense?
I think so. The other problem is that (cc @anthrotype) this repository is being absorbed into fonttools. So I'm not sure it would be useful to add new things to this one.
Actually there hasn't been any progress yet on https://github.com/fonttools/fonttools/pull/1110 (I'm waiting for review comments) so I can very well redo the two git commands that I have done in the other PR on the new master here, if you want to merge new stuff before going into fonttools.
Ok then.
- Considering the axis element is already a bag of all sorts with
mapandlabelnameelements, maybe we can do without thevaluenameswrapper. - These names would have to be localisable I imagine (pardon the misplaced Farsi in the example) so that would put the name in the element's contents, not an attribute.
- It might have to indicate if the value is in userspace or designspace.
<axes>
<axis default="200" maximum="1000" minimum="0" name="Name" tag="NAME">
<namedvalue value="300" xml:lang="fa-IR">قطر</namedvalue >
<namedvalue value="300" xml:lang="fr-CA">Normal</namedvalue >
</axis>
</axes>
wdyt?
I thought about it some more and the stuff I put in is for the format=1 variant of the Axis value table. The other formats [2,3,4] have more/different things in the table. So there is more then just a name and a value. (rangeMinValue, rangeMaxValue, ...)
What about: axis.valueNames.append({"language":"nl-NL", "name":"Normaal", "value":300})
or is it better to add a class for the valueName? so we can add them like::
v.language = "nl-NL"
v.name = "Normaal"
etc.
if dict: is it wish to filter on keys so that axis.valueNames.append({"language":"nl-NL", "name":"Normaal", "value":300, 'blah':"boo"}) (see last entry) is ignored?
Or is this all overthinking it all?
:)
Hi! Now that designspaceDocument has been absorbed into fontTools (fonttools/fonttools#1110), you can move this MR to fontTools as well. To do so:
-
Clone fonttools
git clone https://github.com/fonttools/fonttools -
Add your fork of designspaceDocument as a remote to fontTools (it's weird but it will work)
cd fonttools git remote add thomgb https://github.com/thomgb/designSpaceDocument git fetch thombg -
Rebase your branch onto fontTools' master branch:
git checkout axisvaluenames git rebase origin/master
The last step should work without conflicts, and your changes should be applied automatically into the new directory. Then it's the normal workflow, you fork fonttools, add it as remote, push to it and so on.
I tested it on my machine and the result is here: https://github.com/belluzj/fonttools/tree/axisvaluenames