LettError / designSpaceDocument

Python reader and writer object for designspace files.
35 stars 9 forks source link

add support for axisvaluenames in axis #29

Open thomgb opened 6 years ago

thomgb commented 6 years ago

@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>
LettError commented 6 years ago

Weren't there ranges of values as well?

thomgb commented 6 years ago

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?

LettError commented 6 years ago

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.

belluzj commented 6 years ago

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.

LettError commented 6 years ago

Ok then.

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

thomgb commented 6 years ago

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?

:)

belluzj commented 6 years ago

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