Quadratic (TrueType) v. cubic (Type 1) Bezier curves

Post general font related questions (e.g. how to install, convert and use fonts) and requests (looking for fonts, designers etc.) here.
Post Reply
Chris Eilers
Posts: 42
Joined: Sun Apr 27, 2003 12:21 pm
Location: Christchurch, New Zealand

Quadratic (TrueType) v. cubic (Type 1) Bezier curves

Post by Chris Eilers »

In case it is of interest to others, here’s some info I’ve gleaned on a question that puzzled me for some time. The bottom line of the following---from a practical perspective, and if my assumptions are correct---is that if one wants to create glyphs with the absolute minimum number of points---which result in a small font file size and even flowing curves that can be readily edited---then it is a waste of time to rely solely on a program---any program---to convert Type 1 font curves, or glyph paths created in a drawing program, into TrueType format. Likewise, if you want point-conciseness and/or editability, it is a waste of time to rely solely on a program to convert TrueType curves into Type 1 curves. Of course, not everyone wants or needs to create fonts to this standard of technical perfection in conciseness, but if you do, read on.

First, some basic info. A particular type of mathematical instruction set, called cubic Bezier curves, is utilised by drawing programs like Illustrator, Freehand, CorelDraw, etc. Cubic Bezier curves are also utilised by Type 1 fonts and the PostScript printer language. Another type of mathematical instruction set, called quadratic Bezier curves, is utilised by TrueType fonts. There are advantages and disadvantages in both types of Bezier curves.

I’ve just performed some experiments on a glyph---a capital ‘B’---from a glyph set that I originally drew in Illustrator 8, i.e., as cubic Bezier curves. To create a font file from this glyph set, I exported each glyph from Illustrator as a bitmap, and then imported the bitmaps as background images in Font Creator, and redrew each glyph in Font Creator, i.e., as quadratic Bezier curves. The Illustrator-drawn cubic ‘B’ had a total of 50 points---22 anchor points (the cubic version of Font Creator’s on-curve points) and 28 control points (the cubic version of Font Creator’s off-curve points). The Font-Creator-drawn quadratic ‘B’ had a total of 45 points---22 on-curve points and 23 off-curve points. When completed, the TrueType font file was installed as ‘POW Body’.

Typing a capital ‘B’ from the POW Body font in Illustrator, and applying the Create Outlines command, resulted in a set of Illustrator paths in Illustrator’s native format, that is, cubic Bezier curves. Clearly, Illustrator had converted the quadratic curves in the TrueType font into cubic curves on the fly. The resultant cubic ‘B’ had a total of 78 points---32 anchor points and 46 control points. The additional points were more than enough to seriously complicate any attempt to edit the ‘B’s large sweeping curves. In the original cubic and quadratic ‘B’, each major curve had 3 anchor/on-curve points, one at the beginning of the curve, one at the end of the curve, and one intermediate point. Easy to modify. The Illustrator-converted cubic ‘B’ had 5 anchor/on-curve points on each major curve. Nowhere near as easy to modify, while at the same time retaining an even flowing curve.

Precisely the same result occurred in Corel 3. I typed in a capital ‘B’ from the POW Body font, and applied the Convert to Curves command. The resultant cubic ‘B’ had a total of 78 points---32 anchor points and 46 control points, in exactly the same relative positions as those produced by the Illustrator conversion.

Again, precisely the same result occurred as a result of opening the POW Body font in the demo version of the high-end (and highly expensive) font creation program Fontlab, and specifying ‘Convert TrueType outlines into Type 1 outlines’ under Options in the Open dialog box.

If high-end programs like Illustrator and Fontlab can’t do any better than a conversion from quadratic to cubic which increases the total points on a glyph by about 70%, from 45 quadratic points to 78 cubic points, then it seems unlikely that any other program is going to perform any better.

If the programmatic conversion from quadratic to cubic leaves a lot to be desired, how about the conversion from cubic to quadratic?

I took the original cubic ‘B’ I drew in Illustrator (which had a total of 50 points---22 anchor points and 28 control points) and exported it as an EPS file, which I opened in Corel 3. So far, so good. In Corel, the cubic “B’ still had 50 points, and looked just the same as it did in Illustrator. I then exported the single letter ‘B” from Corel as a TrueType font, B.ttf. Opening B.ttf in Font Creator resulted in a quadratic ‘B’ with a total of 90 points---22 on-curve points and 68 off-curve points. Opening B.ttf in Fontlab resulted in exactly the same quadratic ‘B’.

I then copied the original cubic ‘B’ drawn in Illustrator into Fontlab and saved it as a TrueType file, B2.ttf, as per the instructions in the post: ‘Importing EPS glyphs into Font Creator’. Opening B2.ttf in Font Creator resulted in a quadratic ‘B’ with a total of 76 points---24 on-curve points and 52 off-curve points. Opening B2.ttf in Fontlab resulted in exactly the same quadratic ‘B’. This quadratic ‘B’ represents about a 50% increase in the number of points, in comparison with the original cubic ‘B’.

In terms of the percentage increase in the total number of points (which presumably correlates with an increase in file size), a cubic to quadratic conversion percentage increase of 50% is significantly better than a quadratic to cubic conversion percentage increase of 70%. However, from the perspective of ease of curve editing, the programmatically-generated quadratic ‘B’ was far worse than the programmatically-generated cubic ‘B’. Have you ever attempted to edit a string of evenly-spaced, and fairly tightly-spaced, off-curve points laid out along a wide sweeping curve? Yecch. Don’t even try.

The above results appear to validate the info on cubic and quadratic Bezier curves that I’ve gleaned from various commentators on the Internet who seem to be credible (in combination with a small amount of guesswork on my part):---
1) Cubic and quadratic curves (the latter are sometimes called quadratic splines) are both members of the same Bezier ‘family’ of curves. Cubic Bezier curves are referred to as third order Bezier curves. Quadratic Bezier curves are referred to as second order Bezier curves.
2) According to one commentator on the comp.fonts group, it is possible to convert quadratic curves to cubic curves with absolute mathematical precision. This assertion appears to be substantiated by a visual inspection of the result of the programmatic conversion of quadratic curves to cubic curves. The additional anchor points that result from this conversion bear such a logical consistent relationship with the unconverted points that it is easy to predict the positions that the additional anchor points will appear.
3) By contrast, it is not possible to precisely convert cubic curves to quadratic curves---any conversion will only be an approximation---though the approximated outline will be sufficiently close to the original that it will appear to be visually the same. This cubic to quadratic conversion is performed by ‘recursive subdivision’, which is mathematician-speak for a combination of ‘hit and miss’ and ‘suck it and see’. Again, this appears to be substantiated by a visual inspection of the result of the programmatic conversion of cubic curves to quadratic curves, which invariably look like a dog’s breakfast.

In addition to the odd credible comment, there is good deal of misinformation on the relative nature of cubic and quadratic curves on the Internet. The following is taken from what seems to be the only book ever written on electronic font design: “Fontographer: Type by Design”, by Stephen Moye:-
‘TrueType to PostScript Conversion. When you convert TrueType to PostScript format, you may be in for a surprise---all those drawing points! TrueType is drawn using quadratic splines as opposed to the Bezier curves used by PostScript. Without going into all the math, the bottom line is this: TrueType needs more drawing points than does PostScript, about twice as many. This makes characters much harder to edit...Indeed, I believe it will always be easier to develop TrueType from PostScript rather than doing it directly: the quadratic splines of TrueType are ornery critters that are very difficult to control, whereas the supple Bezier curves are very well behaved and easy to control.”

Of course, Moye is way off with the birds when he is talking about quadratic Bezier curves, but it is easy to figure out how he might have come to his conclusions. When he opened a TrueType font in Fontographer, and saw the dog’s breakfast of points that resulted from Fontographer’s on-the-fly quadratic to cubic conversion, he probably assumed that he was looking at the actual positions of the original quadratic points, and hence he assumed that if a professionally constructed TrueType font had such a lot of points, it did so for the obvious reason that it needed these points in order to generate its curves. (I get the impression that back when “Fontographer: Type by Design” was written, in 1995, there were no commercially available font creation programs with native TrueType editing capability, so Moye may never have had the opportunity to view the architecture of a professionally constructed TrueType font in all its undefiled curvaceous beauty. Presumably, back in 1995, the only professionally constructed TrueType fonts were those made by nerds buried in the bowels of Apple and Microsoft.)

Judging from the comments of a good many font designers on the Internet, it seems that many other people have made exactly the same mistake as Moye, with less excuse---or else they have simply assumed that Moye knew what he was talking about, and have thereby perpetuated the error.

In essence, I made the same mistake myself when I first started playing around with fonts. When I applied the Create Outlines command in Illustrator, or the Convert to Curves command in Corel, I never dreamed that the curves/points in TrueType fonts might be fundamentally different from the curves/points in Type 1 fonts, and that the programs might be converting the TrueType curves/points on the fly. I assumed that the points I saw on TrueType glyphs converted to curves were the original TrueType points. Clearly, I unconsciously leapt to an incorrect conclusion, and in hindsight, it might seem a little daft to have been so naive, but then again, hindsight is a wonderful thing. :-)
Post Reply