huertatipografica / piazzolla

Piazzolla type family
https://piazzolla.huertatipografica.com
SIL Open Font License 1.1
107 stars 1 forks source link

Incomplete STAT table #6

Closed yanone closed 4 years ago

yanone commented 4 years ago

In the latest version of the repo, the variable fonts show an incomplete STAT table. Only the 30pt is defined for the opsz axis; the other two are missing.

You can review the final STAT in the STAT section of https://www.axis-praxis.org/samsa/

yanone commented 4 years ago

Here’s a tip: My strategy for including everything into the STAT table, I generate the fonts with all fvar instances covering all corners of the designspace. Then I delete the unwanted instances at the very end via a hotfix such as this one.

Sadly, this is the only strategy known to me that yields both correct STAT table as well as correct named fvar instances, at least when using statmake for the STAT table.

davelab6 commented 4 years ago

Nice work to get things DONE, @yanone, but yikes. @m4rc1e, we have to sort out a smoother build process for STAT tables :)

@rosawagner have you build a STAT table for a family with an opsz family before? If not, this may be a good pilot for you to smooth out the process based on the pioneering that Marc and Jan have done :)

yanone commented 4 years ago

Nice work to get things DONE, @yanone, but yikes.

I don't understand what this means. Please describe.

@RosaWagner have you build a STAT table for a family with an opsz family before? If not, this may be a good pilot for you to smooth out the process based on the pioneering that Marc and Jan have done :)

I hope it's not annoying but I made this simple one earlier today for an opsz axis straight out of fix-vf-meta:

from fontTools.otlLib.builder import buildStatTable
from fontTools.ttLib import TTFont
import sys

def build_axis_values(ttfont):
    results = []
    nametable = ttfont['name']
    instances = ttfont['fvar'].instances
    for instance in instances:
        name = nametable.getName(
            instance.subfamilyNameID,
            3,
            1,
            1033
        ).toUnicode()
        if name == "":
            name = "Regular"
        inst = {
            "name": name,
            "value": instance.coordinates['opsz'],
        }
        results.append(inst)
    return results

def build_stat(ttfont):
    opsz_axis = dict(
        tag="opsz",
        name="Optical Size",
        values=build_axis_values(ttfont),
    )
    print(opsz_axis)
    buildStatTable(ttfont, [opsz_axis])

def main():
    path = sys.argv[1]
    font = TTFont(path)
    build_stat(font)
    font.save(path)
    print('Created STAT for', font)

if __name__ == "__main__":
    main()

My main issue with making STAT tables is that when you use any form of statmake, it cooks down the STAT table to those corners of the designspace that are defined in fvar. So if you’ve limited the named instances to the allowed names, thus melts the STAT table.

Either a tool doesn't yet exist or I don’t know of one yet that streamlines this process.

juandelperal commented 4 years ago

Thanks @yanone for your help. I dropped statmake and made directly the stat table with fonttools. I think now the table is complete and the process cleaner without hacks. Anyway, if you spot any error, please let me know.

RosaWagner commented 4 years ago

Hello @juandelperal, since Yanone is in Holidays right now, I gonna look at the repo today and get back to you quickly.

RosaWagner commented 4 years ago

The instance naming and the STAT table are now good with the last realease :) So we can close these 2 issues. Although I saw other stuff, I do another issue now with a FB report.

juandelperal commented 4 years ago

Thanks Rosa