
I made a font based on my handwriting - app4soft
https://sachachua.com/blog/2020/06/pythonfontforgeorg-i-made-a-font-based-on-my-handwriting/
======
tombert
Heh, if I were to make a font based on my handwriting, it would almost work as
some level of encryption on my blog; there’s certainly no way anyone would be
able to read it.

~~~
hateful
When I was in elementary school (in the 80s) I used to fail handwriting over
and over. My teacher told me "When you get older, if you want to work in an
office, you're going to have to have to write a lot of reports, and for that
you'll need good handwriting." to which I replied "No, I'm going to work on
computers."

If I made a font based on my handwriting, it could be considered a type of
one-way encryption.

~~~
anotherevan
I learned to touch type in 1986 on a manual typewriter in secondary school. I
knew I was going to work with computers and figured touch typing would be a
worthwhile skill. I was the only male in the class and copped shit from my
peers for taking the subject as everyone else perceived it as a class for
women looking to go into secretarial work. To this day I still think it is the
best thing I learned at school.

~~~
flashgordon
I remember doing this as a new immigrant in Australia (92). We were too poor
to get a computer and I didn't know how to use one either. So my parents got
me taking a train to the nearest station closest to a public library so I
could book out their typewriter (yep) for two hours every sat morning to
practise touch typing!!

------
kleiba
An interesting part is that the author was going for a literate programming
[1] approach using Emacs org-mode [2]. The resulting file is here:

[https://raw.githubusercontent.com/sachac/sachac-
hand/master/...](https://raw.githubusercontent.com/sachac/sachac-
hand/master/README.org)

The point (and the difference to just thoroughly commenting your code) is that
you have one source file that equally serves as the basis for generating the
actual program as well as its documentation. The link above shows the raw
file, github renders it nicely if you go to the main page of the repository.

[1]
[https://en.wikipedia.org/wiki/Literate_programming](https://en.wikipedia.org/wiki/Literate_programming)

[2] [https://orgmode.org/](https://orgmode.org/)

~~~
renke1
I'v always liked the idea of literate programming, but I was always wondering
how it actually feels in practice. Do they usual editor/IDE features still
work like in a non-literate environment? – I assume it might work in Emacs,
but are there other editors that support this approach?

Thinking about it, is Jupyter Notebooks (and the like) a form of literate
programming?

Thinking even more about it, I think I actually used (or tried to) literate
programming in a course about Machine Learning using R and – if I remember
correctly – LaTeX to generate the actual application and a PDF.

~~~
d0mine
You could use [https://github.com/dzop/emacs-
jupyter](https://github.com/dzop/emacs-jupyter) to combine Org mode + Jupyter.

Here's an example emacs configuration:

    
    
      (use-package jupyter
        :after org
        :config
        (org-babel-do-load-languages 'org-babel-load-languages '((jupyter . t)))
        ;; default args for jupyter-python
        (setq org-babel-default-header-args:jupyter-python
              '((:results . "replace")
         (:async . "yes")
         (:session . "py")
         (:kernel . "python3"))))
    
    

After that, you could execute jupyter code block (Org Babel):

    
    
      #+begin_src jupyter-python
      1+1
      #+end_src
      
      #+RESULTS:
      : 2
    

You can use latex in org-mode, generate pictures, get nice git diff, export it
to pdf, etc.

~~~
amake
Just curious: That code could be run by just plain `#+begin_src python`. What
does using Jupyter gain you?

~~~
d0mine
Nothing inherent to Jupyter (it is not like Jupyter notebooks vs. Python
REPL), just some niceties: \- low latency (it feels more responsive) \-
interactive output (tqdm works) \- how Python objects are displayed by default

Essentially a good implementation of Python code blocks would reimplement half
of Jupyter anyway.

------
aasasd
Sounds doable, suspiciously so. When I get rich and have a lot of time, I'll
go through it just to figure out why ‘handwritten’ fonts don't ever include a
dozen alternate sets of the same characters so the shapes actually vary—like
when written by hand. Instead, I type out something like ‘na na na na na na na
na na na na na na na na na Batman’ and observe the same ‘n’ and the same ‘a’
over and over.

~~~
gregmac
Thus got me curious, and I just spent a few minutes learning about OTF
ligatures and alternatives, and apparently random is possible:
[https://graphicdesign.stackexchange.com/a/12818](https://graphicdesign.stackexchange.com/a/12818)

From what I've read, the technology exists to build a font that would be a
pretty convincing handwriting alternative. It would take a lot of effort, as
it would n involve several glyph alternatives for each character, several
variations of dozens of ligatures (joined glyphs) and randomness for
selection. You could even do variants like slightly different
spacing/sizing/positioning (no one writes perfectly straight).

Probably part of the issue is use case. Personal handwriting is kind of neat
for a headline or call-out on a blog or something, but I wouldn't necessarily
want to read a whole long post that way. I'm not really sure where else it
would be useful - students trying to cheat on a "handwriting required"
assignment, if that's even still a thing?

~~~
jhpriestley
If the goal is to produce a simulation of handwriting then a font (which is a
simulation of a case of metal blocks) seems like a bad starting point. Better
to simulate a pen moving along a curve and then vary curve parameters
(acceleration etc).

~~~
n3k5
> _a font (which is a simulation of a case of metal blocks)_

In metal typesetting, a font is exactly a collection of metal blocks (which
embody glyphs of a given design, size, and thickness). But on a computer, a
font is a piece of software that renders text in a given typeface — simulating
a pen moving along curves with varying parameters is entirely feasible. Not at
all a bad starting point.

~~~
sachac
One of the things I want to do is to use autotrace centerline to get a basic
stroke trace, and then manually tweak it so that drawing the glyphs makes
sense. Then I can use that for SVG animations (there are Javascript tutorials
for that), which I can use to help my kiddo learn how to write. (Whether I
should teach her to forge my handwriting so early might be another matter...
;) )

------
crazygringo
Oh man. I remember back in the 1990's, there was a company that you could fill
in a grid with all the letters in your handwriting (block letters only), mail
it to them, and for something like $50 they'd mail you back a floppy disk with
a TrueType font of your handwriting a few weeks later.

These days, it occurs to me that with some kind of deep learning, you could
probably take a couple dozen pages of someone's _cursive_ , and turn it into a
font with thousands of ligatures and variants that would be virtually entirely
convincing.

~~~
soylentcola
In the mid-2000's I got a Toshiba Portégé convertible laptop off eBay for a
few hundred bucks. It had an active digitizer built in and had some software
that let you do something similar. It wasn't fancy enough to include
alternates and it wasn't the best at connecting cursive, but if you mainly
used print/non-script letters like I do, it was a neat trick to be able to use
some semblance of my handwriting as a font in Windows.

~~~
aaronax
Probably this Windows XP Tablet PC Edition Power Toy:
[https://www.gottabemobile.com/8220my-font-tool8221-tablet-
pc...](https://www.gottabemobile.com/8220my-font-tool8221-tablet-pc-powertoy-
inkshow/)

~~~
soylentcola
Yep. That was it!

------
aquabeagle
There was a free website many years ago that I used, where you print out a
form with blocks on it and write each letter, then scan it and upload it and
it gets turned into a font. I can't seem to find it now (or maybe it went
paid).

Microsoft has an app that lets you do this with a Windows tablet:

[https://www.microsoft.com/en-us/p/microsoft-font-
maker/9n920...](https://www.microsoft.com/en-us/p/microsoft-font-
maker/9n9209f8s3vc?activetab=pivot:overviewtab)

~~~
aaronax
Yeah I was going to say...I did this in 2005. It was a Microsoft app that
either came with Windows XP Tablet Edition of was otherwise widely known to
enthusiast users of said operating system such as myself.

------
jvns
If you have an iPad and apple pencil, there's a really great app to do this
called iFontMaker: [https://2ttf.com/](https://2ttf.com/).

I used it to create a font from my handwriting that I've used extensively, and
creating the font took maybe 15 minutes.

~~~
lowdose
Imagine a world where it takes 15 minutes more to put it up on Google fonts.

~~~
parhamn
I’m seeing a world where Google Fonts has a ton of crappy fonts.

~~~
lowdose
Never seen a good youtube video?

------
renke1
That's awesome. I think it really adds a nice personal touch to own's blog. If
only my handwriting wasn't that bad and I had a blog…

~~~
app4soft
> _and I had a blog…_

Why not start one just right now?[0]

[0] [https://sachachua.com/blog/no-excuses-
blogging](https://sachachua.com/blog/no-excuses-blogging)

~~~
yesenadam
Warning: You will have to give your email (and possibly $) to read the linked
ebook.

There seems something more than a little sordid about linking to one's own
stuff on HN in that way.

~~~
sachac
The helpful poster wasn't me, but I should totally make the PDF link easier to
get to. No one should ever need to give me their email address for stuff. :)

~~~
app4soft
> _but I should totally make the PDF link easier to get to._

Great! Would be really useful.

------
srean
I would love to have a font made out of Dijkstra's handwriting, if for nothing
else but for the legacy -- of the man and his EWDs.

He used to have pencil hanging on a string in his office. It was labeled "word
processor".

Ironically enough, _Dijkstra 's algorithm_ is perhaps least of his
accomplishments.

EDIT: thanks FrenchyJiby, mkl. Wasn't aware

~~~
FrenchyJiby
Do you know of previous attempts to do so[1]? There's a TrueType font as per
your wishes[2]!

[1]:
[http://lucacardelli.name/indexArtifacts.html](http://lucacardelli.name/indexArtifacts.html)
[2]:
[http://lucacardelli.name/Artifacts/Fonts/Pc/dijkstra.ttf](http://lucacardelli.name/Artifacts/Fonts/Pc/dijkstra.ttf)

------
sn41
Sacha Chua's emacs videos on YouTube are a treat. Highly recommended for the
great interviews, of one emacs enthusiast talking to other emacs enthusiasts.

~~~
sachac
Thanks!

------
yeswecatan
My wedding anniversary is coming up and I want to frame our wedding vows as a
surprise. I'd really like to use our handwritten vows, but mine are in a
notebook across several pages. I was wondering if there was a way to scan
everything, extract the text, and put it all on one page. Here's to hoping
this guide will help.

~~~
loeg
You could just write it out again by hand.

~~~
Roritharr
If it weren't HN i'd consider this snark, but here it's entirely possible this
wasn't considered as the first option.

~~~
yeswecatan
Ha, it wasn't. It brings up an interesting point, though. Even though I'd scan
and manipulate the original vows, I still feel that's a bit more special than
simply re-writing them.

------
michaelmrose
This is tied to the absolute path of files in your home directory making it
difficult to rebuild with say differing kerning values. It would be nice if it
referred to relative paths. At least one path seems to be
/home/sacha.local/lib when I assume it ought to be referring to
/home/sacha/.local/lib

It would be neat if it referred to relative paths within the repo even nicer
if it if evaluating it installed needed python libraries locally so you could
clone it. Open it in emacs. Modify. Eval buffer.

Regarding kerning the only thing I think is really off is r followed by e
example Here its not as noticeable with a smallish font but becomes more
noticeable in a larger headline or title. I'm using it as the font for org
headlines.

~~~
sachac
Hah, it's not really reproducible at this point, but I was so excited that I
didn't want to wait until I got everything sorted out. I spent a little time
last night kerning even more (it's surprisingly fun), so if the kerning at
[http://pages.sachachua.com/sachac-
hand/files/test.html](http://pages.sachachua.com/sachac-hand/files/test.html)
looks better for you, you can get the new font files from Github. Gosh, thanks
for using the font right away!

The local lib stuff is so that you can get aglfn.txt into the right place for
the python library. I'll see if that can be given a path. If so, I can include
it in files/.

~~~
michaelmrose
Thanks for the interesting project and for making it available immediately to
play with.

------
paulnechifor
I've always wanted to do this, but it only really works if you have a typeset
handwriting style. Regular handwriting has too many "ligatures".

For example consider just "vo" vs "io". The end of "v" ends horizontally near
the top. "i" end at the bottom. So the line that starts "o" has to begin at
different positions.

Most fonts solve this by starting a discontinuous "o" always at the bottom.
But this looks ugly.

And that's jut two letter combinations...

~~~
sachac
I tend to use print because it's easier for me to speed-read my sketchnotes
that way, but I did come across a typography tutorial that explains how to do
cursive connectors through variants. Maybe someday, if the kiddo starts
learning cursive. :)

------
watersb
This was a cool thing to try when PostScript became more common, the release
of the Apple LaserWriter printer [0]. I made a Type 1 font kind of like my
handwriting. It's tedious but not super complicated. The real challenge is
making something that doesn't look awful - hinting and ligatures and stuff. I
might try it again.

[https://en.m.wikipedia.org/wiki/LaserWriter](https://en.m.wikipedia.org/wiki/LaserWriter)

------
jimkleiber
I stumbled on this site a few months back and made my own font as well:
[https://kidpofy.com/](https://kidpofy.com/)

It's supposed to be for archiving your kid's handwriting at different ages of
their life but who says that has to stop at adulthood! :-)

It gave me an error looking at the site on my phone but worked if I clicked
thru the error, not sure how safe that is but to each their own.

~~~
sachac
Yeah, A- was patient enough to contribute several samples of her tracing over
my handwriting template, so I can't wait to make AKiddoHand4.

~~~
sachac
Here's one of the samples:
[https://sketches.sachachua.com/filename/2020-05-28%20A-%20tr...](https://sketches.sachachua.com/filename/2020-05-28%20A-%20tracing.png)

------
rkagerer
I have an old Tablet PC that came with a program that did this. On a roadtrip
one day a friend was bored and she stylused in all the letters. Her printing
looks a bit like a child's and I've used that font a bunch of times now, on
everything from kids menus to thank-you letters from my dog. I probably ought
to pay her some royalties!

------
greggman3
There have been sites that do this for you for 15-20yrs?

A quick google finds these

[http://www.yourfonts.com/](http://www.yourfonts.com/)

[http://www.fontifier.com/](http://www.fontifier.com/)

~~~
sachac
Totally. I felt that generating and processing my own template with reference
fonts and a custom letter order was an excellent reason to learn more Python,
though!

------
fish45
I did this sophomore year because my French teacher wanted things handwritten.
I spent a lot of time making it fit on the lined paper and getting the color
just right but I'm sure she figured it out anyway.

------
YeGoblynQueenne
The post right above this one on hacker news at this time (16:20:16 UTC) is
titled "What did you do"?

(i.e. the title of the post above this post is a question answered by the
title of this post).

------
elcomet
Are there any fonts that have random variations for every letter (is it
something possible to do with curent font systems?)

That would be nice to create fonts that look more like real handwriting.

~~~
sachac
Contextual alternates and ligatures are on my todo list! :)
[https://ctan.org/tex-archive/fonts/punknova?lang=en](https://ctan.org/tex-
archive/fonts/punknova?lang=en) is an interesting model.

------
mono-bob
If I look at the resulting font in Safari on my iPhone it shows up as double
lines. Until I zoom in, then it suddenly looks fine. Does anyone have an idea
what is the cause of this?

~~~
sings
This is the browser trying to produce a bold version of the typeface when one
wasn’t loaded in.

~~~
sachac
Oh! I should totally make a bold version instead of relying on the browser.
Thanks to both of you for testing and troubleshooting! I'll do it later after
the kiddo goes to bed. I'm excited about looking into alternate glyphs too.

~~~
sachac
I made a bold version and changed my site to use it. Does that work for you?
I'm still in the middle of kerning it. Pretty fun with Org Mode. :D

~~~
mono-bob
Yes, looks beautiful ;)

------
omgwtfbyobbq
There's a 'Domestic Manners' font, apparently based on someone's handwriting,
that I've used on and off for a while.

------
amai
I want to see a math font for LaTeX based on handwriting.

------
billylo
Well done, Sacha!

~~~
sachac
Thanks!

