Use FontForge to fix fonts

Parent Previous Next

Use FontForge to fix fonts


When generating a Raster SDF asset, the raster generator is able to handle lots of the common font errors and will create good images.

However, the geometry generator (SDF, MSDF, MSDFA) is designed to be fast (as it will also be used for dynamic SDF generation), and can't handle fonts with errors (even when the font looks fine).

Common errors could be:  (http://fontforge.github.io/problems.html)


To generate MSDF assets with those fonts, you will need to use a software that fixes the errors.

A good, easy and FREE software is the FontForge (https://fontforge.github.io/)


Fixing the errors


Here are the steps that could be used to fix the errors


First, download and install FontForge (http://fontforge.github.io/en-US/downloads/)

To download it, just enter your email to subscribe to their announcement list (I have never received any email from them, and I have been using FontForge for quite some time).

Or, get the latest unofficial build from here: https://sourceforge.net/projects/fontforgebuilds/



Then, run FontForge and load a font.


Select all Characters by using Menu\Edit\Select\Select All   or pressing Ctrl+A


Remove overlapping

One common issue is that some elements of the font could self-intersect or overlap each other.

This can be fixed by using the Menu\Element\Overlap\Remove Overlap    or Ctrl+Shift+O


Simply the Characters

There is a number of issues that are fixed by simplifying the curves.

This can be done easily by using Menu\Element\Simplify\Simplify   or  Ctrl+Shift+M

or for more options: Menu\Element\Simplify\Simplify More...  or  Alt+Ctrl+Shift+M


Another useful simplification is to merge near points by either selecting those points or running:

Menu\Element\Round\Clusters


Its also useful to apply a cleanup after that: Menu\Elements\Simplify\Cleanup Glypth


Correct Direction

The TrueType guidelines, require that fonts use clockwise orientation. But some fonts don't respect that, which make the raster generator skip the wrong spline.

This can be fixed with Menu\Element\Correct Direction     or Ctrl+Shift+D

Then use the menu Menu\Elements\Validation\Find Problems...    or Ctrl+E


Fix Other Problems


Finally, there are a few other issues that are worth checking/fixing.

Do Menu\Element\Validation\Find Problems...   or Ctrl+E

That will bring a dialog with all the problems that could be found and fixed

Click the Set All button and then OK to start finding


That will iterate through all character and show the issues, with option to either select the next issue or FIX the problem.

Notice that some of the things detected are NOT problems, but suggestions. (e.g. "Path near horizontal" could be a font detail that its by-design), So, don't click FIX on everything.


Save the new font

After all font issues are fixed, you should generate a new ttf or otf file:

Menu\File\Generate Fonts   or Ctrl+Shift+G

Then select TrueType to create a ttf file

and click Generate



Created with the Personal Edition of HelpNDoc: Easily create iPhone documentation