{"id":5507,"date":"2010-05-09T20:28:08","date_gmt":"2010-05-10T00:28:08","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=5507"},"modified":"2017-01-25T11:08:43","modified_gmt":"2017-01-25T16:08:43","slug":"creating-a-truetype-font-from-your-handwriting-with-your-scanner-your-printer-and-fontforge","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2010\/05\/09\/creating-a-truetype-font-from-your-handwriting-with-your-scanner-your-printer-and-fontforge\/","title":{"rendered":"creating a TrueType font from your handwriting with your scanner, your printer, and FontForge"},"content":{"rendered":"<p style=\"padding-left: 30px;\"><span style=\"color: #ff0000;\"><strong>Hey, this post is super old!<\/strong><\/span><br \/>\nThat 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 <a href=\"http:\/\/brew.sh\/\">Homebrew<\/a>: you may have some success on Mac (untested by me) if you <tt>brew install netpbm fontforge potrace<\/tt>. There&#8217;s also some font cleanup I&#8217;d recommend, like resolving overlaps, adding extrema, and rounding points to integer. One day I may update this post, but for now, I&#8217;m leaving it as is.<\/p>\n<p>This looks more than a bit like my handwriting<\/p>\n<p><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand-sample.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-5508\" title=\"CrapHand.ttf sample\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand-sample-320x77.png\" alt=\"\" width=\"320\" height=\"77\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand-sample-320x77.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand-sample-160x38.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand-sample-1024x247.png 1024w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand-sample.png 1068w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<p>because it <em>is<\/em> my handwriting! Sure, the spacing of the punctuation needs major work, and I could have fiddled with the baseline alignment, but it&#8217;s legible, which is more than can usually be said of my own chicken-scratch.<\/p>\n<p>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&#8217;t know.<\/p>\n<p>Software you will need:<\/p>\n<ul>\n<li>a working <a href=\"http:\/\/www.perl.org\/\">Perl<\/a> interpreter<\/li>\n<li><a href=\"http:\/\/netpbm.sourceforge.net\/\">NetPBM<\/a>, the free graphics converter toolkit<\/li>\n<li><a href=\"http:\/\/fontforge.sourceforge.net\/\">FontForge<\/a>, the amazing free font editor. (Yes, I said <em>amazing<\/em>. I didn&#8217;t say <em>easy to use<\/em> &#8230;)<\/li>\n<li><a href=\"http:\/\/autotrace.sourceforge.net\/\">autotrace<\/a> or <a href=\"http:\/\/potrace.sourceforge.net\/\">potrace<\/a> so that FontForge can convert the scanned bitmaps to vectors<\/li>\n<li>some kind of bitmap editor.<\/li>\n<\/ul>\n<p>You will need to download<\/p>\n<ul>\n<li><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/fonttrace.pl.txt\">fonttrace.pl<\/a> &#8211; splits up a (very particular) bitmap grid into character cells<\/li>\n<li><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/chargrid.pdf\">chargrid.pdf<\/a> &#8211; the font grid template for printing<\/li>\n<\/ul>\n<p>Procedure:<\/p>\n<ol>\n<li>Print at least the first page of chargrid.pdf. The second page is guidelines that you can place under the page. This doesn&#8217;t work very well if you use thick paper.<\/li>\n<li>Draw your characters in the boxes. Keep well within the lines; there&#8217;s nothing clever about how fonttrace.pl splits the page up.<\/li>\n<li>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.<\/li>\n<li>Crop\/rotate\/skew the page so the very corners of the character grid table are at the edges of the image, like this:<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5511\" title=\"corner of scanned page\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand2a-corner.png\" alt=\"\" width=\"242\" height=\"267\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand2a-corner.png 242w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand2a-corner-145x160.png 145w\" sizes=\"auto, (max-width: 242px) 100vw, 242px\" \/> 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.<\/li>\n<li>Save the image as a Portable Bitmap (PBM). It <em>has<\/em> 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.<\/li>\n<li>Run fonttrace.pl like this:<br \/>\n<code>fonttrace.pl infile.pbm | sh<\/code><br \/>\nIf you miss out the call to the shell, it will just print out the commands it would have run to create the character tiles.<\/li>\n<li>This should result in a bunch of files called uniNNNN.png in the current folder, like these:\n<figure id=\"attachment_5512\" aria-describedby=\"caption-attachment-5512\" style=\"width: 219px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5512 \" title=\"uni0057\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0057.png\" alt=\"W\" width=\"219\" height=\"185\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0057.png 219w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0057-160x135.png 160w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><figcaption id=\"caption-attachment-5512\" class=\"wp-caption-text\">uni0057.png<\/figcaption><\/figure>\n<figure id=\"attachment_5513\" aria-describedby=\"caption-attachment-5513\" style=\"width: 219px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5513\" title=\"uni0069\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0069.png\" alt=\"i\" width=\"219\" height=\"185\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0069.png 219w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0069-160x135.png 160w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><figcaption id=\"caption-attachment-5513\" class=\"wp-caption-text\">uni0069.png<\/figcaption><\/figure>\n<figure id=\"attachment_5515\" aria-describedby=\"caption-attachment-5515\" style=\"width: 219px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5515\" title=\"uni0073\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0073.png\" alt=\"s\" width=\"219\" height=\"185\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0073.png 219w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0073-160x135.png 160w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><figcaption id=\"caption-attachment-5515\" class=\"wp-caption-text\">uni0073.png<\/figcaption><\/figure>\n<figure id=\"attachment_5514\" aria-describedby=\"caption-attachment-5514\" style=\"width: 219px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5514\" title=\"uni0070\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0070.png\" alt=\"p\" width=\"219\" height=\"185\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0070.png 219w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0070-160x135.png 160w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><figcaption id=\"caption-attachment-5514\" class=\"wp-caption-text\">uni0070.png<\/figcaption><\/figure>\n<p><figure id=\"attachment_5516\" aria-describedby=\"caption-attachment-5516\" style=\"width: 219px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5516\" title=\"uni0079\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0079.png\" alt=\"y\" width=\"219\" height=\"185\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0079.png 219w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/uni0079-160x135.png 160w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><figcaption id=\"caption-attachment-5516\" class=\"wp-caption-text\">uni0079.png<\/figcaption><\/figure><\/li>\n<li>Fire up FontForge. You&#8217;ll want to create a <span style=\"text-decoration: underline;\">N<\/span>ew font. Now File\u00e2\u2020\u2019Import&#8230;, and use <em>Image Template<\/em> as the format. Point it at the first of the image tiles (uni0020.png), and <span style=\"text-decoration: underline;\">I<\/span>mport.<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5517 aligncenter\" title=\"FontForge Import Image Template\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/Screen-shot-2010-05-09-at-20.05.58-.png\" alt=\"\" width=\"427\" height=\"363\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/Screen-shot-2010-05-09-at-20.05.58-.png 427w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/Screen-shot-2010-05-09-at-20.05.58--160x136.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/Screen-shot-2010-05-09-at-20.05.58--320x272.png 320w\" sizes=\"auto, (max-width: 427px) 100vw, 427px\" \/><\/li>\n<li>Select Edit\u00e2\u2020\u2019Select\u00e2\u2020\u2019All, then Element\u00e2\u2020\u2019Autotrace. You&#8217;ll see your characters appear in the main window.<\/li>\n<li>And that&#8217;s &#8211; almost &#8211; it. You&#8217;ll need to fiddle with (auto)spacing, set up some kerning tables, set the font name (in Element\u00e2\u2020\u2019Font Info &#8230; &#8211; and you&#8217;ll probably want to set the em scale to 1024, as TrueType fonts like powers of two), then File\u00e2\u2020\u2019Generate Fonts. Fontforge will throw you a bunch of warnings and suggestions, and I&#8217;d recommend reading the help to find out what they mean.<\/li>\n<\/ol>\n<p>There are a couple of limitations to the process:<\/p>\n<ul>\n<li>Most of the above process could be written into a FontForge script to make things easier<\/li>\n<li>Only ASCII characters are supported, to keep the number of scanned pages simple. Sorry. I&#8217;d really like to support more. You&#8217;re free to build on this.<\/li>\n<\/ul>\n<p>Lastly, a couple of extra files:<\/p>\n<ul>\n<li><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/CrapHand2.pbm_.gz\">CrapHand2.pbm<\/a> &#8211; a sample array drawn by me, gzipped for your inconvenience (and no, I don&#8217;t know why WordPress is changing the file extension to &#8216;pbm_&#8217; either).<\/li>\n<li><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2010\/05\/chargrid.ods\">chargrid.ods<\/a> &#8211; the OpenOffice spreadsheet used to make chargrid.pdf<\/li>\n<\/ul>\n<p>Have fun! Write nicely!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s also some font [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[1130,1374,2146,510,1476,809,187,807,2148],"class_list":["post-5507","post","type-post","status-publish","format-standard","hentry","category-computers-suck","tag-ascii","tag-font","tag-fontforge","tag-free","tag-handwriting","tag-netpbm","tag-perl","tag-scan","tag-truetype"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-1qP","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/5507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=5507"}],"version-history":[{"count":8,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/5507\/revisions"}],"predecessor-version":[{"id":13709,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/5507\/revisions\/13709"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=5507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=5507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=5507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}