Stroking Tools for Path-Based Fonts?

I’ve been working on a font that should look a bit like it’s written with a ballpoint pen. I designed it as a collection of zero-width paths that look very pretty in the editor, but of course I have to convert them into outlines for actual use.

Now, I’d like to make use of a path stroking tool to do most of the work… but the built-in “Offset Paths” function of Glyphs is extremely limited (e.g., no diagonal stress or rounded caps) and produces uneven stroke thickness.

As a fallback solution, I’ve tried expanding the path to 1 unit thickness in Glyphs, exporting to OTF, importing into FontForge, using “Expand Strokes” there, and then re-import the shapes into Glyphs via the OTF format again. It’s a horrible workflow, though, especially since all the live references and kerning classes are lost. To make things worse, some glyphs just crash FontForge with SegFault during the “Expand Glyphs” procedure, which forced me to redo the same few steps several times until I eventually gave up.

Is there a macro available for Glyphs that does a better job without destroying all the meta-information in the Glyphs font file?

Herzliche Grüße

Servus Christian,

  1. Do not use OTF as interchange format. FontForge can write UFOs.
  2. For diagonal stress, you can rotate the glyph, then expand, then rotate it back.
  3. Ballpoint pen strokes have no diagonal stress though. Aren’t you better of with keeping your monoline paths as they are and using the Roughenizer and Offset Path custom parameters in the instance?

Hi Rainer,

(1) I tried exporting the unstrokes paths with UFO, but the glyphs came out empty. Also, FontForge doesn’t seem able to read UFO. |:(

(2) I don’t see any rotation functionality in the Transformations dialog or related menus. I suppose I could use the rotation tools in the single-character editing environment, but then I’d have to do that manually for each character, right?

I’ve tried it out for two characters, and frankly, it looks much less attractive than in FontForge:

ftp://ftp.mpia.de/pub/thalmann/type/ff.png (FontForge)
ftp://ftp.mpia.de/pub/thalmann/type/gl.png (Glyphs)

I could probably get rounded terminals in Glyphs by applying an additional “Round Corners” filter, but that wouldn’t fix the oogly join on the bottom left of {h}.

(3) Ballpoint pens do create stress patterns – for instance, one typically applies more pressure to downstrokes than upstrokes. I was worried I’d have to make the stress pattern by hand since it doesn’t come from a fixed pen angle, but I find a 40 deg inclination results in a quite convincing appearance.

In any case, I was a bit imprecise about the ballpoint pen optics. The look I’m actually trying to match is that of a nice piece of lettering using metal stripes mounted on a wall, which however looks quite similar to ballpoint pen writing to me:

http://typophile.com/node/103299

Update: I found that I can reliably stroke the paths in FontForge after I remove overlaps and correct path directions of the 1-unit stroked version in Glyphs prior to exporting. So I can continue working with simple paths in Glyphs, knowing I can produce a stroked version almost instantly if needed.

The only thing that’s missing now is a way to re-import the stroked shapes into a copy of my Glyph font file, which contains all of the kerning and features information. I see Glyphs has a menu Item Import… > Outlines… which I could use for this purpose. However, I can’t select OTF or Glyphs font files in the dialog that follows. How can I export the outlines from my stroked font so I can import then into my Glyphs font file? I don’t see such an option in the Export… menu in Glyphs… is there a script for that?

Why not open the .otf in Glyphs?

The OTF will be missing all the kerning class and features information. Can I copy that from one Glyphs file to another somehow?

Oh, and I ran into another problem just now: When running “Remove Overlap” on my 1-unit stroked version in Glyphs prior to exporting into OTF, the counter of the {o} and similar letters disappears. {Ø} just ends up as a solid blob with two small nibs sticking out. I don’t recall having that problem before… Glyphs does that automatically when I export the font to OTF, so I can’t just not do it… any idea why that happens?

EDIT: Problem solved by unlinking live references before expanding the paths in Glyphs. I still don’t know why Remove Overlap behaved the way it did before, though…

SECOND EDIT: The problem reappeared when I exported to OTF. I can recreate the problem within Glyphs by applying Remove Overlap for a second time. Why – shouldn’t two applications of Remove Overlap be identical to one?

EDITCEPTION: I can see now that the double-exporting “workflow” isn’t going to cut it on the long run. For instance, I’ve tried making a thin version (stroke width 5–6 units), and the finite thickness of the 1-unit export from Glyphs is screwing things up. The {g}, for instance, gets its outside and inside stroked separately, and using Remove Overlap then does weird things in both FontForge and Glyphs. I guess I need to stick to the thicker weight, then. :frowning:

Or wait for a better stroking function to be implemented in Glyphs…? I believe FontForge is Open Source; would it be possible to use its Expand Paths algorithm for a Glyphs plugin?

To illustrate the problem with Glyphs’ outline expander, here’s what it does when I add 10 units to my {n} in both dimensions… it’s far from monolinear.

ftp://ftp.mpia.de/pub/thalmann/type/n.png

The expand stroke filter depends on correctly set extreme points. This would be possible. I will support anyone who is interested doing it.

Just found a bug in the ufo code. Open paths are be preserved now.

I had all extrema and inflection points set, though admittedly the handles on some curves near the top left corner come extremely close to overshooting. Awesome! That should help a lot. Now I just have to figure out how to import UFO into FontForge...

Is this version 1.3.23?

You can rotate via the palette, multiple glyphs at once even.

This will be in version 1.3.24

OK, I have managed to export my open-path version of the font with the trick you proposed. When I open it with FontForge, all paths are closed again (I don’t know whether that’s due to the file or FontForge’s treatment of it), but I can just reopen them manually – tedious, but feasible, especially if I only have to do it once. I’ve already checked, and the open paths expand flawlessly, yielding much nicer results than the pre-expanded outlines I tried earlier.

I think I’m going to open all paths, then, and produce a bunch of stroked outline versions of the font in FontForge. Ideally, I’d like to import those shapes back into Glyphs in order to use the kerning classes and features I had originally defined. Alternately, if I can somehow transfer the kerning classes & features of my Glyphs motherfile into the stroked versions I’ll be exporting from FontForge, that would also work.

I know Glyphs has an “import metrics” and “import shapes” feature, but how do I generate an importable metrics or shapes file from an existing OTF font…?

Saving it as a .glyphs file is not an option?

I do intend to save the exports from FontForge as .glyphs again. But then I’ll have to redefine all kerning classes manually, right…? And that for each weight I produce?

I meant: open an OTF in Glyphs and re-save it as a .glyphs file. Then you should be able to import from that file.

If that does not work, there is a script for that:
https://github.com/mekkablue/Glyphs-Scripts/blob/master/Metrics/Copy%20kerning%20grou ps.py

You can open both files, the original .glyphs file with all the kerning and features and the .otf file from FontForge. Then you select all glyphs in the second file, hit cmd+C, change to the original and select all glyphs, too. Then hit cmd+opt+V and select Only replace the active Layer. You need to make sure that the glyph order of both files is the same.

That sounds just like what I’m looking for. Thanks! I’ll give it a try.

@cthalmann, have you considered Metafont? you may be interested in Metapolator