How does random choice of alternate characters work in OpenType fonts?

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?


I believe what you’re describing is the contextual alternates feature of opentype. ( )

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. ( )

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):

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.

Source : Link , Question Author : F’x , Answer Author : Anne

Leave a Comment