Creating a pixel font is easy if you know how it’s done. You probably have seen the video-tutorial about pixel fonts we made some time ago. But there’s more to it.
Start a New Font
First, open Glyphs (duh!) and select File > New (Cmd-N), to create a new font document. Now, before you start building your letters, go to File > Font Info (Cmd-I) and name your font something striking, we’ll call ours ‘Pixelfont’, because we’re so creative. Then, select Other Settings, where you’ll find the options for Grid Spacing. The Grid Spacing value defines how coordinates get rounded. The default value is 1. For pixel fonts, we want all tools and all modifications to always snap to the grid, so we set higher values. This ensures that ‘pixels’ in your font are automatically on the correct position. Let’s set our Grid Spacing to 50:
Why a grid step of 50? In a nutshell, we choose 50 because it divides 1000 comfortably, and it gives a pixel perfect rendering at certain sizes.
Calculating type screen sizes: Screen size is measured in PPM, pixels per em. If one em contains 1000 units, which is the default UPM (units per em) value in PostScript-based fonts, then (1000÷50=) 20 grid steps, or pixels, fit into one em. In other words, one font pixel will be exactly one screen pixel at 20 PPM. For a screen resolution of 72 ppi (pixels per inch), (20 PPM ÷ 72 ppi × 72 points in an inch =) 20 points. This is the default resolution assumed for Macs and Adobe apps. On Windows, we calculate with 96 ppi, so we reach 20 PPM at (20÷96×72=) 15 points.
Drawing a Pixel
In Font View, click on the plus button on the bottom left to add a new glyph. Double click on the name (newGlyph) and rename it to
Double click the glyph area to open the glyph in a new Edit tab. You’ll see a grid according to your grid settings. Select the Rectangle tool (F) from the tool bar and draw a rectangle exactly as wide and high as one grid square is. You will notice that the path automatically snaps to the grid. Draw the square at the origin point, i.e., where the baseline crosses the left sidebearing.
Right-click anywhere on the canvas to open the context menu. Un-check the Export option. We don’t want to export our
pixel, because it can’t be typed anyway and it would just waste bandwidth in our final font.
That’s basically all the paths you need for a pixel font. Yay!
Building the Glyphs
To start with your alphabet, open a glyph you like very much by double clicking on it in Font view. I’ll start with the
f, because I like fluffy bunnies. Go to Glyph > Add Component (Shift-Cmd-C), select
pixel from the dialog menu, and press Select.
pixel component and press Cmd-C to copy it. Now, press Cmd-V to paste it and move it with your arrow keys or your mouse. Repeat this step until you are satisfied with your Glyph. Alternatively, you can also drag the component while pressing the Option key to duplicate it. And you can do all this with multiple
pixel components at once, so you’ll be even quicker. You can also drag your mouse to select multiple components, but don’t forget to press the Option key while doing so, because a regular rectangular selection only selects paths.
Well, this is our
Now, have fun building your glyphs!
The default glyph width is 600 units. That does not look so nice:
To start with the spacing, you can make sure all your glyphs have the same left and right sidebearings. First select all glyphs (Cmd-A). Then, in Font view, enter the values in the bottom left window. The values for your left and right sidebearing should be multiples of your grid spacing, in our case, we simply set them to 50.
Now, it is easy to make individual changes. If you want to know more about spacing, read our tutorial on Spacing.
Looks much better now, don’t you think?
Of course, you can play around a little with your
pixel. For instance, you don’t have to make a square:
To do that, you can either change the shape of your
pixel or add a new glyph called
pixel.circle, for example. You’ll notice that, when drawing a circle, it will be build to something like this:
This is because the Subdivision subdivides the grid step, so snapping happens on the grid subdivisions, not directly on the grid. If you set this value to 25, for example, your circles will look like this:
Starting with version 2.3, offcurve points will not be rounded to the grid anymore. So, in this case, a subdivision value of 2 would suffice.
Set the Subdivision value to something that makes sense for your pixel design. For full flexibility, set it to the same value as your Grid Spacing.
So, you have two (or more) pixel variants, but how to use them? Go to your Font Info (Cmd-I) and select the Instances tab. Add two new instances by clicking the plus button twice. The instances will be called Regular by default, but you can rename them in the Style Name field. We named ours
circle, because we want to have one instance with square pixels and one with circle-shaped pixels. Make sure you have two pixel-glyphs in your font, e.g.
pixel.circle. Now, add a custom parameter in the instance you want to have an alternative pixel, by clicking the plus button next to Custom Parameter. In the Property field, write
Rename Glyphs, or choose it from the dropdown menu after clicking the arrows. If you double click the Value field, a dialog will open. Write the glyph you want to replace, in our case we want the
pixel.circle glyph to replace the
pixel glyph, so we type:
When creating multiple instances with different pixel shapes, you can use them as a layer font. In this example we superimposed a square pixel instance, a circle pixel instance and a triangle pixel instance:
If you have more complex pixels, you have to make sure that hinting is turned off. So, when you export your file (Cmd-E), uncheck the Autohint option. Why? Read all about what hinting can do, and what not, in our tutorial about PostScript Autohinting.
Post-Processing with Filters
If you want to experiment a little with your font, you can try some of the built-in filters. Again, check your Subdivision value, or some filters might give you an unsatisfying result. For example, if you apply the filter Round Corners to your pixel square, you’ll get this:
You can either apply the filter directly with OK, or, what I recommend, add it as a custom parameter. To do the latter, do not press OK in the filter dialog, but instead click on the gear wheel in the left bottom corner and select Copy Custom Parameter. Then, press Cancel, and open the Font Info (Cmd-I), go to the Instances tab, click on the plus button in the left bottom corner, and add a new instance. Change the style name (I call mine
Rounded) and click anywhere inside the Custom Parameter field to activate it for pasting. Now, simply press Cmd-V to paste the parameter we just copied in the filter dialog. Ta-dah!
It’s a good idea to set the grid spacing with a custom parameter, too. Click the plus button to add a new parameter. For Property, simply write
Grid Spacing after double clicking the Property field, or choose it from the dropdown menu after clicking on the arrows. Next, double click the Value field and write
1 for a grid spacing of 1.
With custom parameters, you can apply filters on different instances at export time, and thus don’t have to destroy the original pixel path. In other words, you can non-destructively build a pixel complete font family!
In this example, we used the filter Roughen. The pixel outline gets chopped up and the nodes are randomly scattered:
Again, copy the custom parameter code by clicking on the gear wheel and choosing Copy Custom Parameter. Go to your Font Info (Cmd-I) and paste the code with Cmd-V, or add a new Instance and paste it there.
Here we used the filter Offset Curve without the Make Stroke option:
Click on the gear wheel and copy the custom parameter code. Go to the Font Info (Cmd-I) and paste the code with Cmd-V, or add a new Instance and paste it there.
Of course, you can apply multiple filters on one instance. In our example, we applied the filters Round Corner, Offset Curve and Remove Overlap:
Look closely: The order of the filters is very important. Glyphs will execute them from first to last. In our case, we first apply Offset Curve to expand the outline by 3 units, so the pixels overlap a little bit. Then we apply Remove Overlap in order to, you may have guessed it, remove the overlap and unite the pixels into one path. Then again, Offset Curve with -3 units brings the outline back to its original dimension. After that, we apply Round Corners to make our font smooth. The positive value (+20) in the first Round Corner parameter takes care of the outer corners, and the negative value (-20) in the second Round Corner parameter rounds the inner corners. Although, the negative value can only be added as a custom parameter manually. If you copy the custom parameter via the filter dialog, you'll only get the positive value.
But, why all the fuss? Easy. If we hadn’t used multiple filters and had just used Round Corners straight away, we would have received a very different result:
In the next example, we use Offset Curve to expand the outline by 3 units again, apply Remove Overlap to unite the pixels and apply Offset Curve with -3 units to move the outline back to where it was, just like in the previous example. But this time, we use also the Roughen filter:
In the following example, we wanted our pixel font to have a contour only. To achieve that, we use Offset Curve +3 units again, apply Remove Overlap and apply Offset Curve with -3 units, just like in the previous examples. Then we add one more Offset Curve filter, but this time with the Make Stroke option activated.
So, have fun with playing around, but keep the order of the filters in mind!
Want to try more filters than the default ones in Glyphs? Take a look at your Plugin Manager, which you can access via Window > Plugin Manager. It has a handy search function, which will help you find the following filters. (The links provided below are just for reference, you may need them if for some reason the Plugin Manager does not work.)
Mekkablue’s Shadow filter is designed to turn your glyphs into shadowed versions of themselves. Take a look:
Another fun filter is mekkablue’s filter Cut and Shake. It exercises cuts across the glyphs, and then both moves and rotates the resulting parts by random amounts, for which the user can specify maximums. In our case, we again used Offset Curve to expand the outline by 3 units, applied Remove Overlap and applied Offset Curve with -3 units to move the outline, before using the Cut and Shake filter:
Plug-ins for Pixel Fonts
Toshi Omagari, famous among pixel font nerds for his book Arcade Game Typography, published an alternative tool for making pixel fonts, called Pixel Pen Tool. It is more convenient in the sense that it creates the
_pixel glyph by itself, and that it will take care of many of the Font Info settings right away, such as UPM, the grid, and the vertical metrics:
Like many other plug-ins for Glyphs, you can get it for free via Window > Plugin Manager.
In the Plugin Manager, you will also find mekkablue’s Pixelate filter. It turns outline glyphs into pixel glyphs by inserting pixel components, resetting widths and moving outlines to the background.
Scripts for Pixel Fonts
There are a few handy scripts for Glyphs that help you with your pixel fonts. In mekkablue’s GitHub repository you'll find a folder dedicated to pixel fonts. For more info and installation instructions take a look at the readme.
Update 2016-09-05: Added Plugin Manager.
Update 2020-02-17: Added Plug-ins for Pixel Fonts.