gftools: gftools-add-font.py: Not working with variable fonts

gftools-add-font.py works for static fonts, for the root directory of gftools I do the following:

python2 bin/gftools-add-font.py ~/Google/fonts/ofl/staatliches

And get the result:

Wrote /Users/Air/Google/fonts/ofl/font/DESCRIPTION.en_us.html
Wrote /Users/Air/Google/fonts/ofl/font/METADATA.pb

But when I run the same command from the same directory on a variable font, I get the following traceack:

Traceback (most recent call last):
  File "bin/gftools-add-font.py", line 267, in <module>
    app.run()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/apputils/app.py", line 238, in run
    return _actual_start()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/apputils/app.py", line 267, in _actual_start
    really_start()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/apputils/app.py", line 220, in really_start
    sys.exit(main(argv))
  File "bin/gftools-add-font.py", line 253, in main
    metadata = _MakeMetadata(fontdir, is_new)
  File "bin/gftools-add-font.py", line 114, in _MakeMetadata
    file_family_style_weights = _FileFamilyStyleWeights(fontdir)
  File "bin/gftools-add-font.py", line 89, in _FileFamilyStyleWeights
    result = [fonts.FileFamilyStyleWeight(f) for f in files]
  File "/Users/Air/Demo/gftools/Lib/gftools/util/google_fonts.py", line 462, in FileFamilyStyleWeight
    sw = StyleWeight(m.group(2))
  File "/Users/Air/Demo/gftools/Lib/gftools/util/google_fonts.py", line 446, in StyleWeight
    return ('normal', _KNOWN_WEIGHTS[styleweight])
KeyError: 'VF'

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 37 (33 by maintainers)

Most upvoted comments

I have a strong conviction that we must keep the file naming of VFs and static fonts ‘compatible’ to allow them to exist within the same directory.

The only VF in the main GF catalog is Markazi Text, which is named ofl/markazitext/MarkaziText-Roman-VF.ttf

We need both for legacy systems for a long time, I expect

I don’t think we should have any autofixing; we should have fixing scripts in gf-tools that the user is reminded about in an error message.

I think Family-Roman.ttf is better than Family-Style.ttf for VFs, because it sub-communicates the file is a VF without explicitly labelling it, and allows a set of static fonts + VFs to be in the same directory (a) which Family-Style.ttf prevents and (b) which we may want the GF download ZIPs to do.

The default value of the weight axis is 200

Why is that not 400?