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!

whoa, I won something!

My strategy of dropping off my business card at every trade show booth that promises quality swag paid off. I just received an MP3 player from Genivar – thanks, folks!

It’s a weird little unit. Looks almost identical to a nano, but is your plain-vanilla USB mass storage device – something that Apple could learn from, but they’re in the business of selling players tied to iTunes. It also has a standard USB connector for days transfer and charging – Apple and iRiver please note.

It seems it’s an S1 type player, so can play videos in its own weird format. It also has a voice recorder, which again records in its own special format (likely some hacked version of GSM).

It will be fun playing with it.

Update: Looks like it’s an ATJ-2135 Actions Semiconductor player of some kind. It can record in ADPCM wav (which sox can convert), or its own weird ACT format (which can be converted using this Windows-only program).

largo

I just installed IBM® Lotus® Symphonyâ„¢. I don’t have the pokiest PC on the block, but in order to make it run at any speed at all, you’d need to have a bit of grunt in your PC. My VIA SP13000 box takes a couple of minutes just to bring up the main window.

To be fair, OpenOffice isn’t the fastest starter either; none of them have large bits of themselves running in the Windows system code, unlike MS OfficeThey both work, and are free – and Symphony looks a deal prettier than OpenOffice. As there’s no Mac version of Symphony yet, I’m unlikely to switch just yet.

my neighbourhood, according to CanVec

my neighbourhood, according to CanVec and QGIS

Canada has recently released most of its geodata for free – Go Canada! I was particularly interested in CanVec, the large vector topographical set. I downloaded the set for Toronto and environs, and slapped it into QGIS. With nearly all the layers on, my neighbourhood looks like the above.

I didn’t find any labels, or much in the way of documentation for this huge data set. It would be a shame if good metadata weren’t available, for it adds real utility to the map data.

fauxlomo

Portpatrick, with the Gimp faux lomo effect
Portpatrick, taken with a Fujifilm MX-1200 pretending to be a lomo

For probably no better reason beyond babbittry, I’ve always half-wanted a lomo. Half-wanted, that is, because of my previous experience with “Russian” photo gear (I’ve had a Lomo TLR, a Fed rangefinder, and a Pentacon six) and its legendary quality control. I’m also so done with film.
A while back, Donncha wrote about a  GIMP Lomo Plugin. While it looked handy, the link to the code is now dead. You can find what I think is the same one here: http://flelay.free.fr/pool/lomo2.scm (or a local copy here if that link dies: lomo2.scm). Just pop it in your .gimp-2.2/scripts/ directory, and it’ll appear as a filter. The original author‘s comment on Donncha’s blog contains good settings: Vignetting softness=1, Contrast=30, Saturation=30, Double Vignetting=TRUE.

I knew there was a reason I retrieved my old 1.3 megapixel Fujifilm MX-1200 from my parents’ house. And that reason is fauxlomo!

the great lost opportunity

I’ve always thought that Adobe missed a great opportunity when they didn’t make their basic PDF writer freely available for Windows. Other OSs now have transparent print-to-PDF options. If you’re lucky, a corporate PC might have MS Office Document Image Writer installed, but a 300dpi monochrome TIFF can’t compare to a PDF.

Still, one can always install PDFCreator (if you have admin rights to the PC, of course). It’s a shame they decide to bundle a marginally dodgy toolbar/spyware package with it, but you don’t get that if you use the MSI installer package.

no, it just isn’t

Finding a source of “Unlimited free energy” would be the most unimaginably heinous crime possible against humanity. For it would inevitably turn the planet into a cinder. Hastening an isoentropic heat death. If you find a free energy source, you damn well better find a new free energy sink as well. Even then, the relative flux rates will still nail you.

 — Don Lancaster, How to Bash Pseudoscience.

free food from Dexit

Though I still hate Dexit, I have found a place to use the remaining balance — the Pizza Pizza at the corner of Vic Park and Sheppard. Yes, their pizza is still like damp cardboard, but they have passable salads.

They still need to work on the reliability of their terminals, and training staff. The other day they said my debit was authorised, when clearly nothing had come off the tag. They wouldn’t take the cash I offered (their screen showed a green thing), so yay Dexit, free food!

the end of poverty in your coffee cup?

I’m not sure what to make of EWB‘s current campaign, which features a future newspaper headline G8 Leaders Declare End of Extreme Poverty. It links to playyourpart.ca, which seems to say that we can end world poverty just by buying fair-trade goods?

I know there’s a lot wrong with the coffee industry (Free Trade Coffee: You Grind The Beans, We Grind The Peasants! Enjoy the smooth trickle-down flavour, etc) but it’s a simplistic argument. What can the extremely poor sell to us?

I don’t know what to think.