More variable fonts nonsense



  • After a request to add more axes to the previous simple variable fonts tutorial the follow up escalated a bit. Since there are several files I thought it might be better to put them on github.


  • admin

    this is super cool!



  • @frederik thank you!

    There is one 'issue' that makes it difficult to abstract the code. And I was wondering if this could be implemented differently in drawbot.
    when setting the fontVariations the axis tag cannot be a variable:
    fontVariations( axisTag = someValue )

    It would be quite convenient to do:

    myAxis = 'wght' # or whatever
    # ... do some stuff with myAxis
    # ... and then just place the variable name
    fontVariations( myAxis = someValue )
    

    or to just iterate through axes without ever having to type the axistag.


  • admin

    You can convert a dictionary to keyword arguments:

    myVariations = {
        "wght": 100,
        "wdth": 900
    }
    fontVariations(**myVariations)
    

    similar a list/tuple can be converted to a arguments:

    myColor = (1, 0, 1)
    fill(*myColor)
    stroke(*myColor)
    rect(10, 10, 100, 100)
    


  • oh, yes!
    that is of course a very nice solution.
    will update some of the scripts in the next days.
    thanks!


  • admin

    listFontVariations() returns a (ordered) dict that can be adapted and reused as **keyword arguments while applying the font variations.