I have a question similar to “Writing text with character variations”: I would like to create a casual hand-written-style font, that reproduces the natural variety between occurrences of the same glyph that one find in handwritten text. Contextual alternatives are good, but from what I understand they are mostly appropriate for letters linking together than for a script where all letters are separated by whitespace.

One of the answers to the above-linked question says (emphasis is mine):

While you'd normally have only a few letters with a contextual alternate, it's theoretically possible to have several forms per letter. But I don't believe you can really randomise their appearance, only cycle through them (so, if you had three forms of 'a', they'd be used in sequence and start repeating in 'the black cat sat on the mat')

Well, it doesn’t seem to be true, because I found some mentions of an OpenType feature called randomize, which can apparently do that. For example, on this TeX package webpage:

Knuth’s original fonts generated different shapes at random. This isn't actually possible in an OpenType font; rather, the font contains several variants of each glyph, and uses the OpenType randomize function to select a variant for each invocation.

So: is there a mechanism for random selection of glyph variants in OpenType, and how does it work? A link to adequate online documentation or quote from the spec would be invaluable. Also: do you think this goal makes sense, i.e. it would improve the quality of the typeset text much to include multiple randomly-select glyph variants?

  • In a recent discussion on the Opentype mailinglist it seemed as only TeX supports the rand feature (and maybe some web browsers). Commented Oct 30, 2012 at 9:27
  • @MartinSchröder do you have a link to this discussion? it would make a good answer
    – F'x
    Commented Oct 30, 2012 at 9:39
  • The list is here, the archive is here. As you can see, it's pretty closed. :-( Commented Oct 30, 2012 at 10:10
  • How it works, in simple terms, is math. If there are ten variants of a glyph, a function generates a random number between one and ten and renders the corresponding variant. In programmatic terms, you'd have to look at this "Randomize" script's code.
    – Moscarda
    Commented May 28, 2016 at 17:41
  • @Moscarda - I'm pretty sure that you, in simple terms, were wrong.😉 The name is misleading but there is no randomness actually involved in rand. Substitution is cyclic, sort of. For example, the rotation re-starts after every LF. It's a shame really; OpenType had so much potential but it became so convoluted, requiring [workarounds to do anything cool, that it's not exactly catching on like wildfire.
    – ashleedawg
    Commented Nov 20, 2021 at 6:36

2 Answers 2


I believe what you're describing is the contextual alternates feature of opentype. ( http://msdn.microsoft.com/en-us/library/ms745109.aspx )

Nick Shinn has a really interesting article on many of the features available using contextual alternates, and how he used it in five fonts he designed. Duffy Script in particular was used in the way you're describing. ( http://ilovetypography.com/2011/04/01/engaging-contextuality/ )

Looking more deeply, I was able to find this post describing how to rotate through your glyphs on subsequent uses (which will generally appear random): http://forums.adobe.com/message/1785905#1785905

That dives right into the middle. I can look further if you would like something that has a bit more information to get you started or if I misunderstood your initial request.


I haven't played with the randomize function but I have gotten some good results with extensive use of ligatures.

Most the variation in handwriting is related to context: this follows that, that follows this, this is the end of the word, etc. OpenType ligatures can accommodate for a lot of variation if you're willing to plan it out well.

There is also the legendary Beowolf font (archived copy) by LettError. That kind of programming is not for the average type developer.

** UPDATE **

Still no answer? I thought some smart programmer would have solved this for you by now. Well, let me add a little more info to the pool.

The only true randomization experiments I'm aware of (like Beowolf mentioned above) have been done with PostScript. If you are willing to step away from OpenType, Luc Devroye did a paper (PDF) that delves into the programming of a PostScript Type 3 solution in this problem. He also has a list of things related to the issue of randomized fonts for reference.

As with all things type, there was a discussion on this topic on Typophile some time back. In that thread 8 years ago, Thomas Phinney made this statement that I believe still holds true (the OpenType spec hasn't changed much that I'm aware of):

Sure. Assuming you want it to work in some existing applications, you have an unexciting choice insofar as each approach is very limited in how/where it works:

  • OpenType (contextual, WYSIWYG, currently only supported by Adobe's apps, any output device, easiest to code but that's not saying a lot, use FontLab or maybe DTL FontMaster to make it)

  • AAT (contextual, WYSIWYG, Mac only, currently only supported by a handful of apps, any output device, hard to code contextual stuff, use Apple's command-line tools to compile the features into a pre-existing font)

  • Type 1 (true random, non-WYSIWYG, will work in many apps but not most recent Adobe apps, will only work with PostScript output devices, you'd probably have to be a programmer to code it)

  • Yes, ligatures allow for variation, but that isn't the same as randomization… Thanks for the related link to Beowolf, I wasn't aware of that font. It's cool!
    – F'x
    Commented Oct 29, 2012 at 18:55
  • If you really want to capture the feeling of handwriting it seems like you'd need to first identify ligature options from which a random selection can be made. The combination of the two would be a beautiful feat of type design. Take a look at Sudtipos' work: Adios Script, Affair, and especially Business Penmanship come to mind --> sudtipos.com/fonts/99 Commented Oct 29, 2012 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.