Variable Font CFF2 Outlines

Hello everyone,

I’m trying to get a Variable font with PostScript outlines. I’ve successfully exported a Variable TTF (directly from Glyphs 3) but after days of removing all the kinks, the results are still disappointing in some of the instances because of the auto-added TT points (testing in Adobe CC). I’ve tried simplifying the outlines (removing points) but in a font with such contrasting styles from compressed to wide there’s only so much you can reduce.
Now I decided to try using fontmake to get the Variable font with CFF2 outlines, but I can’t get it to work. My coding knowledge is non-existent so most probably I’m doing something wrong. This is the message I’m getting from fontmake:

fontmake -g AllotropeItalic14-VAR.glyphs -o variable-cff2
INFO:fontmake.font_project:Building master UFOs and designspace from Glyphs source
INFO:glyphsLib.classes:Parsing "AllotropeItalic14-VAR.glyphs" file into <GSFont>
Traceback (most recent call last):
  File "/usr/local/bin/fontmake", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/fontmake/__main__.py", line 620, in main
    project.run_from_glyphs(inputs.glyphs_path, **args)
  File "/usr/local/lib/python3.10/site-packages/fontmake/font_project.py", line 775, in run_from_glyphs
    designspace_path = self.build_master_ufos(
  File "/usr/local/lib/python3.10/site-packages/fontTools/misc/loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "/usr/local/lib/python3.10/site-packages/fontmake/font_project.py", line 191, in build_master_ufos
    designspace = glyphsLib.to_designspace(
  File "/usr/local/lib/python3.10/site-packages/glyphsLib/builder/__init__.py", line 123, in to_designspace
    return builder.designspace
  File "/usr/local/lib/python3.10/site-packages/glyphsLib/builder/builders.py", line 327, in designspace
    self.to_designspace_sources()  # .sources
  File "/usr/local/lib/python3.10/site-packages/glyphsLib/builder/sources.py", line 40, in to_designspace_sources
    _to_designspace_source_layer(self)
  File "/usr/local/lib/python3.10/site-packages/glyphsLib/builder/sources.py", line 159, in _to_designspace_source_layer
    key = (layer.name, tuple(layer._brace_coordinates()))
  File "/usr/local/lib/python3.10/site-packages/glyphsLib/classes.py", line 3796, in _brace_coordinates
    return [float(c) for c in coordinates.split(",")]
  File "/usr/local/lib/python3.10/site-packages/glyphsLib/classes.py", line 3796, in <listcomp>
    return [float(c) for c in coordinates.split(",")]
ValueError: could not convert string to float: ' 72 off'

I did manage to get some other font (single style) to export as TTF with fontmake so I guess I installed fontmake and Python right. What am I doing wrong?

You might get better responses when you ask on the glyphsLib repo.

1 Like

Oh, OK. I had no idea what causes the problem. I thought the export fails because of some wrong settings in the Glyphs file.

The problem is most likely an incompatibility in glyphsLib.

1 Like

Any news on the Variable CFF2 export from Glyphs 3? :smiley:

Still working on it.

OK, here’s what I got from the glyphsLib repo:

I’m afraid someone with access to the font file will need to debug this. It looks like one of the brace layers has coordinates that glyphsLib does not know how to handle, namely this 72 off looks suspicious as there should be only numbers here (unless it is some extended syntax glyphsLib does not know about).

And that was correct. I found and deleted old brace layers that were deactivated e.g. {275, 72 OFF} but left among other layers. After that I managed to get .designspace and UFO files, but still no luck with the variable font file. Now I have a different error message:

fontmake: Error: In 'AllotropeItalic14-VF.glyphs' -> 'master_ufo/AllotropeItalic-Italic.designspace': Generating fonts from Designspace failed: Locations must be unique.

I found in a similar case that it helped to assign all brace layers to the same master via the Layers panel in the sidebar. I have even written a script that does this.

Doesn’t glyphsLib still isn’t supporting Glyphs 3 brace layers? I though that it was fixed, already.

Thank you Jens. I’ll give it a go.

I guess it still has problems when the brace layer is temporarily turned off? The Glyphs file I’m working on is originally from version 2.

Do you have any idea when the incompatibility with glyphsLib might be getting resolved? Thanks, Georg!

I need to ask the glyphsLibs developers.

I’ve got a new error code:
features.fea:509:1: Expected glyph class definition or statement: got NAME condition

Any ideas where to look or what I should change?

If I understood it correctly the error is pointing to the .ufo file features.fea, this is the line 509:

OK, when I deactivated this feature in the .glyphs file, fontmake finally managed to export the variable font with CFF2 outlines! :smiley:

But why would this code bother fontmake?

FontMake does not support the feature condition syntax. You need to check what syntax they support.

1 Like

@GeorgSeifert you could have just pointed me to this conversation :joy:

(Putting it here in case someone else encounters the same problem)

1 Like