designSpaceDocument icon indicating copy to clipboard operation
designSpaceDocument copied to clipboard

add support for axisvaluenames in axis

Open thomgb opened this issue 8 years ago • 7 comments

@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>

thomgb avatar Nov 23 '17 13:11 thomgb

Weren't there ranges of values as well?

LettError avatar Nov 26 '17 11:11 LettError

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?

thomgb avatar Nov 27 '17 12:11 thomgb

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.

LettError avatar Nov 27 '17 16:11 LettError

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.

belluzj avatar Nov 27 '17 16:11 belluzj

Ok then.

  • Considering the axis element is already a bag of all sorts with map and labelname elements, maybe we can do without the valuenames wrapper.
  • 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?

LettError avatar Nov 27 '17 17:11 LettError

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?

:)

thomgb avatar Nov 28 '17 11:11 thomgb

Hi! Now that designspaceDocument has been absorbed into fontTools (fonttools/fonttools#1110), you can move this MR to fontTools as well. To do so:

  1. Clone fonttools

    git clone https://github.com/fonttools/fonttools
    
  2. 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
    
  3. 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

belluzj avatar Jan 22 '18 16:01 belluzj