babelfont icon indicating copy to clipboard operation
babelfont copied to clipboard

Create "cleaned up" glyphs file? (i.e. apply filters and feature variations)

Open arrowtype opened this issue 6 months ago • 4 comments

Hi Simon, I know you are currently very busy, so I’m hoping you will respond to this later, when you have time. However, I want to get the question down, so I don’t forget it.

In a GlyphsLib issue regarding feature variation syntax, you said:

I've just added Glyphs3 variable feature support to babelfont, so you could try that, either as a font compiler or as a filter to produce a "clean" Glyphs file.

Awesome! Thanks for the idea – that sounds really appealing.

My goal/hope is that I could take in a Glyphs3 source that uses various special techniques of Glyphs – like expandable strokes, export filters, and feature variations syntax – and convert these into more basic data that could be easily compiled by FontMake into TTFs or UFOs.

I’ve poked around the docs and tinkered with it a bit, and I’ve managed to load, then save a Glyphs3 file. However, this doesn’t seem to apply any changes that I am hoping for.

from babelfont import load

input = "test.glyphs"
output = "test-cleaned.ttf"

f = load(input)
f.save(output, format=3)

Have I missed something? Is there some way to expand strokes, apply export filters, and convert feature vars to alternate layers?

Thank you for any insights!

One extra note: Many glyphs in the original file have horizontally flipped/mirrored components. The version loaded and saved by Babelfont has added a vertical flip to these. (Example: ж uses a component for the diagonal part, and mirrors this for the left side. The font output by Babelfont has flipped this left side vertically, and pushed it way down below the baseline.) It’s not my font, and it’s not something I would think of when drawing a font, but the outcome seems non-ideal and worth mentioning.

arrowtype avatar Aug 01 '24 21:08 arrowtype