Is it safe to use cubic and quadratic curves in one path?

Just noticed that in Glyphs, it’s possible to use cubic and quadratic Bézier curves in one path. Nice! Feels like FontLab in the late 90s. It takes a bit of trickery like cutting and re-joining paths but it seems to work.

Is it okay to do so? Or are there any risks? Is it too hacky?

I feel that for simple, shallow curves, this is the perfect solution, as two cubic handles give unnecessary (and unwanted) control. Retracted cubic BCPs – another long-time favourite of mine even though advised against by some – generally give shallower and more asymmetrical curves than a single-BCP quadratic curve.


That should be relatively easy to test. But I suspect there is some code that might trip over those paths.

As I understand it, there is some work going on in the harfbuzz project to allow mixing cubic and quadratic segments in the glyf table.

So it would be nice if Glyphs allowed to work with that smoothly sooner or later :slight_smile:

I was not even thinking of mixing them in the final font file – of course, that is an interesting long-term goal. Currently, Glyphs simply converts them to one or the other on export anyway.

The question is, just as Georg mentioned, that there might be some code in Glyphs that malfunctions when it encounters mixed paths. This is what I had in mind when I wrote, “is it safe?”

Why is it easy to test, @GeorgSeifert? I tried exporting OTFs, which works perfectly fine, but there is some uncertainty left, some potential for errors that go unnoticed.

Is that a compliment or an insult‽ :crazy_face:

Anyway, I also wonder if that might affect quite a lot of plugins, which operates with paths. You could see with your own ones (Symmetrify, Harmonizer, RMX, …). I’d be curious about that too.

Having it in the UI should be fine.
And I just had a quick look, exporting seems to work, too.

Just wrote a small script that helps play around with quadratic curves:

Two things I noticed:

  • On export, Glyphs’ overlap removal fails if cubic and quadratic curves are mixed. I tried all possible combinations for the path directions; none of them worked. Maybe this could be fixed by changing the order in which the paths are processed (curve conversion vs overlap removal), or skipping an incorrect change of path direction?
  • When using “Convert to Cubic” from the menu, Glyphs likes to duplicate the starting node. Seems to be a little bug.
1 Like

The overlap removal code doesn’t handle quadratic curves at all. because intersecting quadratic curves is quite tricky. In the last few month I wrote some code that might help with this, but I didn’t integrate it with the remove overlap code, yet.

If the font is exported as OTF then all curves are converted to cubic in any case. If you do this before you apply the overlap removal this should fix the problem. No need to support overlap removal with quadratic curves.

I just managed to fix the overlap removal on OTF export by setting up a very simple PreFilter that calls path.convertToCubic() for all paths in the font.

This means this problem should be fairly easy to fix in Glyphs internally. Just convert the paths to cubic before you apply overlap removal.