Professional Documents
Culture Documents
Random Font:
1. Problems
First of all, we should understand that each desktop publishing software
is going to compile the font files in its own way. More so, each one of
them is going to convert the curves through their unique algorithm,
sometimes unleashing hell.
Flash IDE, for example, is notorious for wrecking curves. It does so,
based on the size of your vector artwork, in order to keep the smallest
file possible. If fonts are not embedded, the same happens.
Some programs, like 3D applications, simply break the curve into several
facets. So even if you are doing something in Illustrator to use in 3DS
Max, for example, read on, it might save you some trouble.
2. Reasons
Usually, all of this revolves around how PostScript and TrueType deal
with outlines: TrueType uses quadratic Bzier curves, and
PostScript uses cubic Bzier curves.
I know, I know, geek stuff. Heres the simple explanation:
Counting points might seem unpractical and silly, but it can tell you a
couple of things right away:
The most obvious one is about file size: less points, less point
coordinates, which means a smaller file size. Cubic curves win
in this matter;
If this is so, it seems that cubic curves win over quadratic ones; so why
arent quadratic curves obsolete?
3. Digging deeper
So how are Bzier curves calculated? Lets start with quadratic curves.
3.1 Quadratic Curve rasterization
So, we have our 3 points: 2 anchor (in and out) and 1 control point. Lets
say that the anchors are called A1 and A2, and that the control point is
called C. Lets connect A1 to C and C to A2 with straight lines, as shown
below:
Now, well add two points: one that travels from A1 to C and another
that travels from C to A2, and theyll take exactly the same time to make
their trip. And for the sake of this exercise, well also add a straight line
that connect the two traveling points (shown in orange, below):
Now, lets add a new point, one that travels between the two orange
points, taking the same time to travel from one point to another (shown
below in light gray). If we track its path while traveling, voil, we have
our quadrativ curve rasterized:
The same applies when you zoom in or out, or when your printer
controller prepares a document to print: it rasters the curve to the
intended resolution.
See what they did there? Right, a moving quadratic curve inside a cubic
one! Heres some deductions on cubic curve rasterization:
Weve noted that Cubic curves reduce the file size by 1/8, but
the demands on processing power triples.
We already know that you can draw the same thing with less points with
cubic curves, but theres also some other things that we can have in
consideration, regarding file size.
4.1 Always work with integers
FontLab, for example, doesnt even let you use decimal data in x/y
coordinates data, and no sane developer will do a vector drawing
application that would allow point data to infinity. Since we still need a
worldwide network of computers just to find some more pi digits, no
perfect circles to anyone.
But then again, if your eye cant tell the difference and, in fact, you still
have to cheat the circle to make it look like a circle (when you adjust
forms optically), using decimal numbers on type design is just some sort
of geek stubbornness.
And theres the workflow issue: ask professional type designers if they
use Illustrator or other vector drawing application that uses decimal
numbers by default and youll find very few that say yes, and even fewer
that say yes and with no corrections.
Its way easier to nudge with the keyboard arrows than using a text box
to input integer values. On the other hand, a lot algorithms used for font
handling in DTP software simply round the points to integers, so they
can handle them with less storage and processing resources.
Edit: And, as Pomax kindly pointed out, the OpenType specs only
allows for integer point coordinates.
But the big issue here is file size: if you have a file with integers and 4
points, it will be smaller than a file with two decimal figures and 2
points. Make some thousands of points and the difference in file size is
dramatic, as well as for processing power.
5. Always work with cubic curves
Cubic curves win, for all the reasons mentioned above: easier drawing,
better conversion to quadratic than the other way around, smaller file
size. You know the drill.
6. Keep anchor points at extrema and handles straight
This is a big one. Most of the time, the most common problem I see (in
situations as described in the introduction) is that the anchor points are
spread all over the place. This results in jagged lines, poor rasterization,
bigger file size (because youll need more points), increased difficulty in
drawing, and the list goes on.
If you want to draw a smooth curve, having the anchor points at the
horizontal and vertical extrema and keeping the handles vertical or
horizontal is enough. It gives you a better control over the curve path and
less stuff to adjust.
Edit: And, although implied above, is good to mention: do not invert the
path direction with you handles (thanks to Pedro Amado for pointing that
out). Heres what I mean:
Hrant Papazian made me notice, over Twitter, that Ive missed a point
here (pun intended!). The example above, on the right, lacks an explicit
inflection point.
What the hell is that?, you may ask. Well, in an ideal scenario, all
points should alternate between vertical and horizontal handle position.
Why? Because we want to keep each curve segment without inflection
points, in order to have an optimal conversion from cubic to quadratic.
OK, lovely, but you havent explained what a inflection point is. True.
Here you go: the inflection point is where the curve changes direction.
So, if your walking from left to right and start leaning to the left, the
place where you start doing so is your paths inflection point. Simple.
So, in the example in 6, the curve changes paths between the two
horizontal handlers, creating an inflection point. How to avoid it? Well,
make it explicit; i.e., make it an anchor point. In this way, the curve is
split to one-direction-only segments:
I know this was lengthy and somewhat technical, but I believe its
important to know why instead of just how. Computers have limitations
and will always have so its important to make the best of it; and for
that, knowledge is key.
I hope you had as much fun reading this as I had making this article.
Thanks for your time!
References: