question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

glyphsLib fails to build UFOs from specific .glyphs file

See original GitHub issue
  1. Get https://raw.githubusercontent.com/madig/cantarell-fonts/f17124d041e6ee370a9fcddcc084aa6cbf3d5500/src/Cantarell.glyphs
  2. fontmake -g Cantarell.glyphs -o otf
INFO:fontmake.font_project:Building master UFOs and designspace from Glyphs source
INFO:glyphsLib.parser:Parsing .glyphs file
INFO:glyphsLib:Loading to UFOs
Traceback (most recent call last):
  File "/home/nikolaus/.local/bin/fontmake", line 11, in <module>
    sys.exit(main())
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/__main__.py", line 183, in main
    project.run_from_glyphs(glyphs_path, **args)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/font_project.py", line 376, in run_from_glyphs
    glyphs_path, family_name, mti_source=mti_source)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontTools/misc/loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/fontmake/font_project.py", line 77, in build_master_ufos
    family_name=family_name)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/glyphsLib/__init__.py", line 81, in build_masters
    propagate_anchors=propagate_anchors)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/glyphsLib/__init__.py", line 59, in load_to_ufos
    propagate_anchors=propagate_anchors)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/glyphsLib/builder/__init__.py", line 43, in to_ufos
    result = list(builder.masters)
  File "/home/nikolaus/.local/lib/python3.6/site-packages/glyphsLib/builder/builders.py", line 137, in masters
    ufo_font = self._ufos[layer_id]
KeyError: ''

The same happens with

import glyphsLib
ufos = glyphsLib.build_instances('Cantarell.glyphs', "masters", "instances")

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MrBrezinacommented, Nov 13, 2017

I had the same problem. It is because I copied some glyphs from another font with more masters and the extra layers got preserved. It is not just layers without names, but also others which should not be there.

This Glyphs.app script helps to clean things up. (Run it multiple times. That’s because I am lazy to figure out how to delete all phantom layer systematically in one run.)

import GlyphsApp

font = Glyphs.font
real_layers = [m.id for m in font.masters]

for g in font.glyphs:
	for l in g.layers:
		if l.layerId not in real_layers:
			del(font.glyphs[g.name].layers[l.layerId])
			print "Deleting layer from", g.name
0reactions
anthrotypecommented, Dec 2, 2017

should be fixed by #291

Read more comments on GitHub >

github_iconTop Results From Across the Web

error when exporting to UFO and duplicate layers contain ...
When we export from .glyphs to UFO we need to make their name unique if we want to be able to store them....
Read more >
Glyphs should clean-up or prune phantom layers when ...
I copied the glyph "verticallineabovecomb" from NotoSans-MM.glyphs over ... Issue: glyphsLib fails to build UFOs from specific .glyphs file.
Read more >
fontmake - compile fonts from UFO or Glyphs to OTF/TTF
--no-production-names --subset Subset font using export flags set by glyphsLib --no-subset -s, --subroutinize Optimize CFF table using compreffor (default) ...
Read more >
SIL Font Development Notes: Modifying Font Sources
Open the .glyphs file in Glyphs, make changes, and save. Run ./preflightg from the individual project folder. This reads the .glyphs file and ......
Read more >
fontmake — Debian testing
NAME¶. fontmake - compile fonts from UFO or Glyphs to OTF/TTF ... --subset: Subset font using export flags set by glyphsLib. --no-subset.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found