UFO export not working with many components

https://github.com/phoikoi/VT323/ has a glyphs file, and a UFO exported from it with Version 2.3.1 (903) and when this is opened with Glyphs or FontForge (or glyph’s UFO previewer in the Finder) it seems badly broken.

Full details:

Also, the TTF exported doesn’t seem to retain components. This is the TTF in FontForge:

When I check the file with ttx, I see that it is full of contours.

    <TTGlyph name="A" xMin="36" yMin="0" xMax="364" yMax="560">
      <contour>
        <pt x="120" y="80" on="1"/>
        <pt x="124" y="64" on="0"/>
        <pt x="124" y="40" on="1"/>
        <pt x="124" y="17" on="0"/>
        <pt x="120" y="0" on="1"/>
        <pt x="40" y="0" on="1"/>
        <pt x="36" y="17" on="0"/>
        <pt x="36" y="40" on="1"/>
        <pt x="36" y="64" on="0"/>
        <pt x="40" y="80" on="1"/>
      </contour>
      <contour>
        <pt x="120" y="160" on="1"/>
        <pt x="124" y="144" on="0"/>
        <pt x="124" y="120" on="1"/>
        <pt x="124" y="97" on="0"/>
        <pt x="120" y="80" on="1"/>
        <pt x="40" y="80" on="1"/>
        <pt x="36" y="97" on="0"/>
        <pt x="36" y="120" on="1"/>
        <pt x="36" y="144" on="0"/>
        <pt x="40" y="160" on="1"/>
      </contour>
      <contour>
        <pt x="150" y="320" on="1"/>
        <pt x="154" y="304" on="0"/>
        <pt x="154" y="280" on="1"/>
        <pt x="154" y="257" on="0"/>
        <pt x="150" y="240" on="1"/>
        <pt x="70" y="240" on="1"/>
        <pt x="66" y="257" on="0"/>
        <pt x="66" y="280" on="1"/>
        <pt x="66" y="304" on="0"/>
        <pt x="70" y="320" on="1"/>
      </contour>
      <contour>
        <pt x="170" y="400" on="1"/>
        <pt x="174" y="384" on="0"/>
        <pt x="174" y="360" on="1"/>
        <pt x="174" y="337" on="0"/>
        <pt x="170" y="320" on="1"/>
        <pt x="90" y="320" on="1"/>
        <pt x="86" y="337" on="0"/>
        <pt x="86" y="360" on="1"/>
        <pt x="86" y="384" on="0"/>
        <pt x="90" y="400" on="1"/>
      </contour>
      <contour>
        <pt x="200" y="240" on="1"/>
        <pt x="204" y="224" on="0"/>
        <pt x="204" y="200" on="1"/>
        <pt x="204" y="177" on="0"/>
        <pt x="200" y="160" on="1"/>
        <pt x="70" y="160" on="1"/>
        <pt x="66" y="177" on="0"/>
        <pt x="66" y="200" on="1"/>
        <pt x="66" y="224" on="0"/>
        <pt x="70" y="240" on="1"/>
      </contour>
      <contour>
        <pt x="280" y="480" on="1"/>
        <pt x="284" y="464" on="0"/>
        <pt x="284" y="440" on="1"/>
        <pt x="284" y="417" on="0"/>
        <pt x="280" y="400" on="1"/>
        <pt x="120" y="400" on="1"/>
        <pt x="116" y="417" on="0"/>
        <pt x="116" y="440" on="1"/>
        <pt x="116" y="464" on="0"/>
        <pt x="120" y="480" on="1"/>
      </contour>
      <contour>
        <pt x="310" y="400" on="1"/>
        <pt x="314" y="384" on="0"/>
        <pt x="314" y="360" on="1"/>
        <pt x="314" y="337" on="0"/>
        <pt x="310" y="320" on="1"/>
        <pt x="230" y="320" on="1"/>
        <pt x="226" y="337" on="0"/>
        <pt x="226" y="360" on="1"/>
        <pt x="226" y="384" on="0"/>
        <pt x="230" y="400" on="1"/>
      </contour>
      <contour>
        <pt x="330" y="320" on="1"/>
        <pt x="334" y="304" on="0"/>
        <pt x="334" y="280" on="1"/>
        <pt x="334" y="257" on="0"/>
        <pt x="330" y="240" on="1"/>
        <pt x="250" y="240" on="1"/>
        <pt x="246" y="257" on="0"/>
        <pt x="246" y="280" on="1"/>
        <pt x="246" y="304" on="0"/>
        <pt x="250" y="320" on="1"/>
      </contour>
      <contour>
        <pt x="330" y="240" on="1"/>
        <pt x="334" y="224" on="0"/>
        <pt x="334" y="200" on="1"/>
        <pt x="334" y="177" on="0"/>
        <pt x="330" y="160" on="1"/>
        <pt x="200" y="160" on="1"/>
        <pt x="196" y="177" on="0"/>
        <pt x="196" y="200" on="1"/>
        <pt x="196" y="224" on="0"/>
        <pt x="200" y="240" on="1"/>
      </contour>
      <contour>
        <pt x="360" y="80" on="1"/>
        <pt x="364" y="64" on="0"/>
        <pt x="364" y="40" on="1"/>
        <pt x="364" y="17" on="0"/>
        <pt x="360" y="0" on="1"/>
        <pt x="280" y="0" on="1"/>
        <pt x="276" y="17" on="0"/>
        <pt x="276" y="40" on="1"/>
        <pt x="276" y="64" on="0"/>
        <pt x="280" y="80" on="1"/>
      </contour>
      <contour>
        <pt x="360" y="160" on="1"/>
        <pt x="364" y="144" on="0"/>
        <pt x="364" y="120" on="1"/>
        <pt x="364" y="97" on="0"/>
        <pt x="360" y="80" on="1"/>
        <pt x="280" y="80" on="1"/>
        <pt x="276" y="97" on="0"/>
        <pt x="276" y="120" on="1"/>
        <pt x="276" y="144" on="0"/>
        <pt x="280" y="160" on="1"/>
      </contour>
      <contour>
        <pt x="260" y="560" on="1"/>
        <pt x="264" y="544" on="0"/>
        <pt x="264" y="520" on="1"/>
        <pt x="264" y="497" on="0"/>
        <pt x="260" y="480" on="1"/>
        <pt x="140" y="480" on="1"/>
        <pt x="136" y="497" on="0"/>
        <pt x="136" y="520" on="1"/>
        <pt x="136" y="544" on="0"/>
        <pt x="140" y="560" on="1"/>
      </contour>
      <instructions><assembly>
        </assembly></instructions>
    </TTGlyph>

But the file in Glyphs appears to have them:

The regularity means they file will compress well, but still, this seems unexpected to me. Why is glyphs showing components when they aren’t really there?

More importantly, why isn’t glyphs using components at export? Is it because component glyph name is _part.pixel?

The distortion in the .ufo is caused by the smart components. They are not supposed in .ufo.

On export, if a component points to a none exporting glyph, it will be decomposed. And if it is a smart component, it will be decomposed. Both cases apply here.

And the .ttf file in the repository was exported without removing overlap. What you see in the screenshot from glyphs, are the flat path.

I am working with Dave on this one.
When exporting to UFO, an option to decompose smart components would be a nice feature.

The importscript for Fontlab doesn’t cope well with smart components. Maybe you have a solution ?

noted.

please decompose them before you import in FLS. The import script can’t do that (to add that to the script, it would mean to reimplement a major part of Glyphs).

Thanks Georg! That helps clarify things :slight_smile:

So, in order to realise the filesize gain of using components, Jacques will need to pick which ‘instances’ of the smart component he has used, and ‘decompose’ them into their own glyphs as regular components, and mark those as exporting glyphs; then replace each smart component with its corresponding regular component. This will then ensure that when exporting a TTF. the regular components are exported and not converted to outlines, reducing the filesize substantially (and better than what woff2 can do, I expect) and also mean that the UFO export will work reliably.

Yes. And he might need to add the custom parameter Keep Overlapping Components in the instance.

1 Like

Great tip, thanks!