Corner mitring python script for FontLab

I created a mitred corner algorithm for my build scripts to subtly mitre any extra sharp corners that are created when I remove overlaps. For more information on why it's a good idea to not flatten your glyphs until right before you export, see this post on using build scripts to author the final font files.

Click "Read More" for the script

How to use glyph math to create an optical bold

Glyph math is a concept used by Robofab where you take every point in a glyph and perform a mathmatical operation on each point. So if you were to multiply the glyph 'a' by 10, it would take each point, and multiply it by 10, essentially scaling the glyph 10 times. It becomes really interesting when you start doing operations on point compatible glyphs. So for example, if you were to take that same 'a' and add it to a bold version, then divide by two, you would have an average of the two glyphs (in this case a medium).

Another useful concept, though a little harder to grasp, is the idea of differences. If you subtract one glyph from another, you typically end up with some random looking squiggles. But when you apply those differences to a third glyph, things get interesting. Take for example the optical weights shown above. If you subtract the display 'a' from the caption 'a', then add those differences back on a bold display, you get a pretty good looking optical bold.

So how does it work? Let's look at just one control point to see what happens. In this case, let's look at the point on the underside of the arm of the lower case 'a'. If we take the difference of (subtract) point1 and point2 we get -20 units. If we then add these 20 units to the bold 'a', the point moves down 20 points, which is just where we want it for an caption size 'a'. Glyph math simply repeats this step for every point in the glyph.

The joy of build scripts

When writing software, there is a big difference between the human readable code, and the compiled machine readable code. The human readable code is easy to edit, while the machine readable code can only be read by complete psycos, and even there with lots of effort. In order to get from human to computer readable, there is a step called compiling.

I've found this to be a useful paradigm with type design as well. The source files are my FontLab files. There are a lot of things that need to happen between my easy to edit source files and the finished exported fonts. For one thing, I use interpolation for some of the weights. All of the interpolated weights must be created, then renamed with have the proper "Font Info" applied. Also, I often like to use separate contours and sometimes even components for different strokes (see fig. 1). For example, it's much easier to adjust the weight and correct italic distortions in the "A" if the crossbar isn't welded on to the frame. These all need to be decomposed with overlaps removed. When I started making fonts, it would take forever if I needed to make a tweak and re-export final files.

Interpolated Nudge

In my last post I mentioned a set of macros that I wrote this week to help in tweeking Doublewide. I thought I'd throw the code out there, just in case someone else finds it useful.

The idea is pretty simple. Wouldn't it be nice to move a node while keeping the tension in the curve? When tweeking, bolding and making fonts wider, I prefer to use the keyboard to 'nudge' the points around. It makes it easy to keep track of measurements, to make sure that the new stroke weight/character widths are consistent.

For example, if I have a light weight with a 70 unit stem weight, and I want to make the new stem weight 270, all I have to do is command+shift+right+arrow on each of the stems. Unfortunately, this flattens the curves, as the off curve control points stay in the same place.

The answer: Interpolated Nudge. The macros simply move the control points proportionally with the anchor points. If you move an anchor 10 units to the right, and the control point is 50 percent of the distance to the next anchor, the control point will move 5 units, preserving the tension in the curve. The algorithm is super simple, but it helps.

The next trick is to map the macros to keys. Fontlab allows macros to be assigned to 0-9+shift+option. I mapped NudgeLeft10 to 4, right to 6, up to 8 and down to 5. This way I can use the number pad like directional keys. I also mapped NudgeRight100 t0 3 and NudgeLeft100 to 1, so I can move big distances more quickly.

Of course my preference would be for nudge to be worked into Fontlab's interpolation tool, but in the mean time, this is a quick and easy way to make extended and bold versions of fonts.

To install:

  1. Download the attachment from this post. Copy the "InterpolatedNudge" folder into the FontLab Macros directory.
  2. Copy "" into the Macros/system/modules/ folder. (On a mac the macro directory is found at ~/Library/Application Support/Fontlab/Studio 5/Macros/).
  3. Press the "reload" button on the Fontlab macro toolbar. You should see InterpolatedNudge show up as a folder in the macro toolbar.
  4. To map the keys, select each macro (eg NudgeLeft10) and then use the "assign to keyboard" drop down menu on the right of the macro toolbar.

There's no such thing as cheating in type design: automated python anchors in Fontlab

As much as it would be great to meticulously arrange every little thing by hand, sometimes you just have to automate. Here's a FontLab script that I use a lot for adding anchors to the tops/bottoms of common letters. As soon as all the anchors are automatically inserted, you might want to move them around a little, depending on the font. Then simply select the diacritics you want to create, chose "Glyph > Create Glyphs" from the menu, and voila, instant diacritics.

Syndicate content