creating a TrueType font from your handwriting with your scanner, your printer, and FontForge

Hey, this post is super old!
That means that installation and run instructions may not work as well, or even at all. Most of the *Ports Apple software repositories have given way to Homebrew: you may have some success on Mac (untested by me) if you brew install netpbm fontforge potrace. There’s also some font cleanup I’d recommend, like resolving overlaps, adding extrema, and rounding points to integer. One day I may update this post, but for now, I’m leaving it as is.

This looks more than a bit like my handwriting

because it is my handwriting! Sure, the spacing of the punctuation needs major work, and I could have fiddled with the baseline alignment, but it’s legible, which is more than can usually be said of my own chicken-scratch.

This process is a little fiddly, but all the parts are free, and it uses free software. This all runs from the command line. I wrote and tested this on a Mac (with some packages installed from DarwinPorts), but it should run on Linux. It might need Cygwin under Windows; I don’t know.

Software you will need:

  • a working Perl interpreter
  • NetPBM, the free graphics converter toolkit
  • FontForge, the amazing free font editor. (Yes, I said amazing. I didn’t say easy to use …)
  • autotrace or potrace so that FontForge can convert the scanned bitmaps to vectors
  • some kind of bitmap editor.

You will need to download

  • fonttrace.pl – splits up a (very particular) bitmap grid into character cells
  • chargrid.pdf – the font grid template for printing

Procedure:

  1. Print at least the first page of chargrid.pdf. The second page is guidelines that you can place under the page. This doesn’t work very well if you use thick paper.
  2. Draw your characters in the boxes. Keep well within the lines; there’s nothing clever about how fonttrace.pl splits the page up.
  3. Scan the page, making sure the page is as straight as possible and the scanner glass is spotless. You want to scan in greyscale or black and white.
  4. Crop/rotate/skew the page so the very corners of the character grid table are at the edges of the image, like this: I find it helpful at this stage to clean off any specks/macules. I also scale and threshold the image so I get a very dark image at 300-600dpi.
  5. Save the image as a Portable Bitmap (PBM). It has to be 1-bit black and white. You might want to put a new font in a new folder, as the next stage creates lots of files, and might overwrite your old work.
  6. Run fonttrace.pl like this:
    fonttrace.pl infile.pbm | sh
    If you miss out the call to the shell, it will just print out the commands it would have run to create the character tiles.
  7. This should result in a bunch of files called uniNNNN.png in the current folder, like these:
    W
    uni0057.png
    i
    uni0069.png
    s
    uni0073.png
    p
    uni0070.png

    y
    uni0079.png
  8. Fire up FontForge. You’ll want to create a New font. Now File→Import…, and use Image Template as the format. Point it at the first of the image tiles (uni0020.png), and Import.
  9. Select Edit→Select→All, then Element→Autotrace. You’ll see your characters appear in the main window.
  10. And that’s – almost – it. You’ll need to fiddle with (auto)spacing, set up some kerning tables, set the font name (in Element→Font Info … – and you’ll probably want to set the em scale to 1024, as TrueType fonts like powers of two), then File→Generate Fonts. Fontforge will throw you a bunch of warnings and suggestions, and I’d recommend reading the help to find out what they mean.

There are a couple of limitations to the process:

  • Most of the above process could be written into a FontForge script to make things easier
  • Only ASCII characters are supported, to keep the number of scanned pages simple. Sorry. I’d really like to support more. You’re free to build on this.

Lastly, a couple of extra files:

  • CrapHand2.pbm – a sample array drawn by me, gzipped for your inconvenience (and no, I don’t know why WordPress is changing the file extension to ‘pbm_’ either).
  • chargrid.ods – the OpenOffice spreadsheet used to make chargrid.pdf

Have fun! Write nicely!

13 thoughts on “creating a TrueType font from your handwriting with your scanner, your printer, and FontForge”

  1. I’m really struggling to get FontForge to recognise potrace. I’ve got potrace in /usr/local/bin and as such it’s available from the command line but I’ll be damned if I can figure out why the autotrace option is greyed out in FontForge. I’ve imported the PNGs, they’re set as backgrounds, but I can’t find a thing online that tells me what earthly reason it has to disable autotrace.

  2. Try “File → Preferences → Apps → PreferPotrace: on”, if you haven’t already.

    autotrace, FontForge’s long term preferred tracer, has been dropped from most Linux distributions due to lack of maintenance. It’s a shame, as I’ve been using autotrace for nearly 20 years. potrace works fine as long as you only need two colours.

  3. Wow! That was a quick response!

    I hadn’t found that setting but even with it turned on FontForge doesn’t seem interested. I’m running the latest release of FontForge on MacOS rather than Linux.

    Does potrace require netpbm? I couldn’t find a binary of it for MacOS so ran the perl script on my Linux VPS instead.

  4. On Mac OS, I installed fontforge, potrace and netpbm all from Homebrew (hey, I said the blog post was old) and they all seemed to work. Running on Linux, potrace never seemed to be called – the tracing seemed to be done from fontforge itself.

  5. I eventually gave up on getting potrace and Fontforge to play nicely on macOS. I fired up a virtual machine running Ubuntu and followed the tutorial in that. I am now the proud owner of my own font. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *