Problem with lib on .glif when converting Glyphs file to ufo format

Hello, I have an issue with converting a glyph file to ufo I never encounter before. Some of the glyphs seems to be corrupted and Robofont crashes when I try to open one of those glyphs. When opening ufo package, I noticed that the problematic glyphs get a weird lib / dict after the outlines data. For example, this is what I have for v glyph :

<?xml version="1.0" encoding="UTF-8"?>
<glyph name="v" format="1">
<advance width="586"/>
  <unicode hex="0076"/>
  <outline>
    <contour>
      <point x="197" y="0" type="line"/>
      <point x="389" y="0" type="line"/>
      <point x="584" y="475" type="line"/>
      <point x="392" y="475" type="line"/>
      <point x="293" y="219" type="line"/>
      <point x="194" y="475" type="line"/>
      <point x="2" y="475" type="line"/>
    </contour>
    <contour>
      <point x="293" y="0" type="move" name="bottom"/>
    </contour>
    <contour>
      <point x="293" y="475" type="move" name="top"/>
    </contour>
  </outline>
  <lib>
    <dict>
      <key>com.schriftgestaltung.Glyphs.lastChange</key>
      <string>2019-01-28 22:08:28 +0000</string>
      <key>com.typemytype.robofont.guides</key>
      <array>
        <dict>
          <key>angle</key>
          <integer>90</integer>
          <key>isGlobal</key>
          <integer>0</integer>
          <key>magnetic</key>
          <integer>5</integer>
          <key>x</key>
          <integer>274</integer>
          <key>y</key>
          <integer>368</integer>
        </dict>
        <dict>
          <key>angle</key>
          <integer>0</integer>
          <key>isGlobal</key>
          <integer>0</integer>
          <key>magnetic</key>
          <integer>5</integer>
          <key>x</key>
          <integer>823</integer>
          <key>y</key>
          <string>-45</string>
        </dict>
      </array>
      <key>public.markColor</key>
      <string>0.67,0.95,0.38,1</string>
    </dict>
  </lib>
</glyph>

When I delete the entire , I dont get a problem anymore. Problem is : many glyphs have the issue. Is there any way to avoid those parasites when converting from Glyphs to UFO ?
I wasnt able to figure out where this comes from.

Many thanks in advance for your help,

R

The problem is that RoboFont minimal changes to the structure of the lib data. So if there is a

    <key>angle</key>
    <integer>0</integer>

but RF expects the angle to be float and crashes if it is an integer ;(
Glyphs tries to preserve the data as good as possible…

1 Like

Thanks Georg for your answer, but I am not sure to understand.
Is there a way I can avoid those on the Glyph file ? It seems to happen to random glyphs on the font file.

Looks like you have guidelines. Have you tried removing those?

Yes, I already tried to remove guidelines and it didn’t change anything unfortunelty. Random glyphs are still corrupted.
#HELPPLEASE

Have you removed the all the lib stuff? Can you send me an example that still fails?

Even if I remove guidelines, some glyphs have still the problem, for example F :

<?xml version="1.0" encoding="UTF-8"?>
<glyph name="F" format="1">
  <advance width="609"/>
  <unicode hex="0046"/>
  <outline>
<contour>
  <point x="105" y="681" type="line"/>
  <point x="105" y="0" type="line"/>
  <point x="207" y="0" type="line"/>
  <point x="207" y="278" type="line"/>
  <point x="509" y="278" type="line"/>
  <point x="509" y="375" type="line"/>
  <point x="207" y="375" type="line"/>
  <point x="207" y="584" type="line"/>
  <point x="524" y="584" type="line"/>
  <point x="524" y="681" type="line"/>
</contour>
<contour>
  <point x="290" y="0" type="move" name="bottom"/>
</contour>
<contour>
  <point x="290" y="681" type="move" name="top"/>
</contour>
  </outline>
  <lib>
<dict>
  <key>anchors</key>
  <array>
  </array>
  <key>back</key>
  <dict>
  </dict>
  <key>com.schriftgestaltung.Glyphs.lastChange</key>
  <string>2019-02-13 17:52:33 +0000</string>
  <key>com.typemytype.robofont.guides</key>
  <array>
    <dict>
      <key>angle</key>
      <integer>0</integer>
      <key>isGlobal</key>
      <integer>0</integer>
      <key>magnetic</key>
      <integer>5</integer>
      <key>x</key>
      <string>-360</string>
      <key>y</key>
      <integer>360</integer>
    </dict>
  </array>
  <key>components</key>
  <array>
  </array>
  <key>contours</key>
  <array>
  </array>
  <key>lib</key>
  <dict>
  </dict>
  <key>name</key>
  <string>F</string>
  <key>public.markColor</key>
  <string>0.67,0.95,0.38,1</string>
  <key>unicodes</key>
  <array>
  </array>
  <key>width</key>
  <integer>555</integer>
</dict>
  </lib>
</glyph>

How can I deleted all the lib in Glyphs ?

You need to make sure that <key>com.typemytype.robofont.guides</key> is gone. It should be in the userData of that glyph.

What version of Glyphs do you have?

I use 2.6
How can I access to userData on the glyph on Glyphs ? And maybe delete those parasites lib on all the glyphs ?

run this in the macro panel

for g in Font.glyphs:
	g.setUserData_(None)
	for l in g.layers:
		l.setUserData_(None)
1 Like

Fantastic ! It works perfectly, no more corrupted glyphs.
Many thanks for your help!

I put the glif in an .ufo and opened it in RF and it opened fine.

How strange… What version of RF did you tried on ? I am (still) on 1.8

I tested with 1.8.4