Badly drawn outlines can cause headache. Your letters may look mangled or not appear at all. You can avoid these difficulties if you keep a few basic rules in mind.
The Magic Triangle
This is important: every curve segment should fit nicely in a triangle.
‘What’s a segment?’ I hear you ask. Simple, it’s everything between two adjacent on-curve points a.k.a. nodes. There are two types of segments, straight lines and curves. Straight lines only consist of those two nodes. Curve segments additionally sport two off-curve points a.k.a. Bézier control points (BCPs) or ‘handles’.
It’s important to note that the magic triangle is described by the two nodes encompassing the segment and the point where the elongations of the handles intersect. This means that the handles must never extend outside the triangle. If they do, you may want to reconsider the position of your nodes. So these two things should not happen: a handle crossing the other handle, and a handle crossing the elongation of the other handle. This may produce unnecessary inflections, cusp curves or even self-intersections, all of which may put a rasterizer into trouble.
This may come as a surprise to you if you have prior experience in vector applications like Illustrator. First, the handles do not belong to the nodes, but to the segment. Secondly, a curve segment always has two BCPs, never just one. Illustrator seems to let you draw curve segments with only one BCP. But actually, what Illustrator really does is hide the second BCP in one of the surrounding nodes. This is pretty bad because in font vectors, no two points should share the same coordinates. Plus, you have more control over the path if you make good use of both BCPs.
If one of the BCPs appears to be missing, it’s hiding in the node next to it. The easiest way to fix this is to select a point in the vicinity, be it a handle or a node, and then tab to the hiding handle. Use Shift-tab to go into the opposite direction. A light-grey highlight indicates that the handle is selected. Now, use your arrow keys to drag the handle out of the node. If you add the option key, your handle will keep its direction. Hold down Shift for increments of 10:
The triangle rule also implies that a curve segment should only have a single orientation, i.e. not inflect, not switch from clockwise to counter clockwise. There are, however, exceptions to this rule. Very often, you’re better off with an inflection when drawing glyphs like an
S or a
tilde, especially if you are drawing for interpolation.
Special case: When you draw cupped serifs in a font that is supposed to be optimised for the screen, you even need curve segments with inflections:
Make sure Points A and C are on the same height, all the BCPs are horizontal (or between the heights of B and A/C, i.e. they do not go beyond the area spanned by these two heights), and the distance between the base and B is less than 20 units. In File > Font Info > Font, add a
blueShiftcustom parameter with the depth of your cups plus one as value. Then the PostScript autohinter can apply a so-called flex hint, which suppresses display of the cups at very low resolutions. And most importantly, make sure B sits on the baseline. Yes, you heard right, the B point! And the cup parts with the A and C need to immerse completely in the baseline alignment zone. Read more about PostScript hinting.
Path Orientation and Order
Wrong path directions can mess up counters and make proper hinting impossible. Paths need to be oriented counter-clockwise, counters need to be oriented clockwise. You can control path directions by selecting paths, right-clicking and picking Reverse Selected Contours from the context menu. Don’t wanna keep that in mind? No problem. Glyphs can do that for you. Just pick Paths > Correct Path Direction (Cmd-Shift-R) and you’re done. This command also works on multiple glyphs, or even the whole font.
By the way, Paths > Correct Path Direction (Cmd-Shift-R) also re-orders your paths and resets the starting point in each closed path.
Working with multiple masters? Hold down the Option key, and the menu command will change to Paths > Correct Path Direction for All Masters (Cmd-Opt-Shift-R), which, as the name implies, will do its magic on all layers of the selected glyph(s) simultaneously. Comes in handy when you want to quickly make a glyph with multiple masters compatible again. You can quickly cure most interpolation problems this way. Read more about keeping outlines compatible.
A path in an exported font must not intersect itself. You can fix a self-intersection by selecting the contour in question and choosing Filter > Remove Overlap (Cmd-Shift-O). But then again, in your Glyphs file, you may want to keep an intersection for easier editing and better interpolation. In this case, make sure you activate the Remove Overlap option when you export your font (Cmd-E).
Hint: This does not apply to Variable Fonts.
You can even add overlaps with the Open Corner and Reconnect Nodes commands from your context menu:
Pro tip: These commands are also available in the Paths > Other submenu, so you can easily add a keyboard shortcut in System Preferences > Keyboard > Shortcuts > App Shortcuts.
There is one problem with keeping overlaps though: double overlaps. That is, if you have another overlap inside an overlap. They may show as tiny white gaps inside your shapes. This can happen when, inside the overlap, a curve segment connects to a straight line, and the curve bends a little too much to the wrong side:
How can we find these spots? Well, a Python script could have a look at what your glyphs would look like after overlap removal, and see if there is some outline debris left over somewhere. In the mekkablue script repository, there is a script called Paths > New Tab with Small Paths, which opens a new Edit tab with all the glyphs it can find that contain such a tiny path:
Superfluous Points and Wrong Node Types
Not really a biggie, but it can improve the rendering performance of your font: Paths > Tidy Up Paths (Cmd-Opt-Shift-T) will remove superfluous nodes and superfluous BCPs. In other words, it will remove all points not necessary for displaying the shape at hand, e.g., handles on a completely straight segment, and so on. This command will also fix the type of your nodes, thus changing a blue corner point into a green curve point (or vice versa) where appropriate. And it will fix two consecutive points sharing the exact same coordinates, also known as a ‘zero-length segment’, indicated by a red circle.
While we’re at it, a lot of stuff is much easier if you insert nodes at the x and y extremes of your paths, i.e., the spots where your paths have completely horizontal or vertical tangents. Very often, this allows you to get rid of the other points while achieving simpler paths, fewer points, smaller file sizes.
You can either choose Paths > Add Extremes to add extrema to the selected outlines, selected glyphs or even the whole font. Or, if you want to have more control, just take your Pen tool (P) and Shift-click on the path. Glyphs will look for the nearest extremum or inflection point of the curve and insert a node there.
After you inserted extremum points, you can often get rid of intermediate points without compromising on the shape:
You do that by selecting one of the green diagonal points, and pressing the Delete key. If you delete one node at a time, Glyphs will do its best to reconstruct the shape with a single segment. Your mileage may vary.
Pro tip: You may want to avoid an extremum point if it would create a so-called shallow curve, i.e. a curve segment that is only a handful of units deep. Why would you want to avoid shallow curves? Because point coordinates usually do not have decimals, and the curve segment will mess up the shape no matter how smartly you are trying to place your on- and off-curve points.
Open and Closed
Did a whole path go missing in the final font? Perhaps it was open. Open paths are ignored at export time. So, all paths should be closed.
To close a path, just drag one of the open ends onto the other one with your Edit tool (V). Or switch to the Pen tool (P) and subsequently click on both end points to add a closing segment. Or, select open paths, right click to open the context menu and choose Close Open Paths.
Vectors Out of Bounds
Got super-weird left or right sidebearing values? You probably have some object way off the visible part of your glyph. Here’s how to get rid of it:
- Make sure the right glyph is active, i.e. the cursor is placed before it. Hint: pay attention to the LSB and RSB values in the grey info box (Cmd-Shift-I), and see if you can spot a ridiculously large, probably negative, number there.
- Switch to the Edit tool by clicking on the arrow symbol in the toolbar.
- Choose Edit > Select All (Cmd-A). All paths in the glyph are selected now.
- While simultaneously holding down your Shift key, drag a rectangle selection across the parts you want to keep. This will deselect them. Now, only the out-of-bounds debris remains selected.
- Hit the Delete key.
Via Window > Plugin Manager, you can put your hands on a couple of analytic View menu plug-ins that help you identify potentially problematic spots in your outlines. Good plug-ins in that respect are Show Angled Handles, Jens Kutílek’s Red Arrow, Simon Cozens’ Heatmap, and perhaps Show Tops and Bottoms can also be helpful.
In the Plugin Manager, you will also find Filter menu extensions that help fix problems. Fix Zero Handles and Delete Small Paths are two examples. But think of what you need for your design, and see if there is a plug-in for that.
Also, take a look at the script repositories listed on the Extend page, many of which contain scripts that help you fix problems in your fonts, like the one mentioned above.
Now is a good time to go through your glyphs and optimize the vectors. Trust me, it will save you some hassle later.
Update 2018-08-04: Revised text and adapted text to match current app versions. Added double overlaps, reconnecting and corner opening, as well as script and plug-in tips.
Update 2018-08-19: More precise description of Tidy up Paths in Superfluous Points and Wrong Node Types. More clarification and new screenshot for the cupped serif example. Cleaned up wording for describing inflections.