Handwriting font

Again in need of some help :slight_smile:
I am currently working on a handwriting font (letters are connected to each other) which has couple of different versions of each letter, depending on the location of the connection to the previous and the following letter. Now, how do I do that the correct “version” of the letter will appear when typing? I named the letters (example: a.hl - h standing for the high point connection, and l standing for the low point connection).
Can anyone explain/help me solve this? Do I do this with contextual ligatures by hand or is there any other way?
Thanks so much for your help.


Look in the tutorials section for tutorials about OpenType features. Look for contextual and positional features.

1 Like

It’s me again. Trying to figure out if there is possible to make a loop with the “lookups”?
My code is:

Of course because of the order of the lookups the font always starts with the INITIAL_L lookup. SO I was wondering how could I make the font engine to loop between the two lookups? So one would get choosen each time you start to type.
Or am I going in totally the wrong direction?

thanks for your help,

The way you want it, I am afraid it is impossible (unless I am misunderstanding it somehow, because I am not quite sure what exactly you are aiming at with the code).

But what you could do is split the letters into groups so that every word will behave differently, i.e. what the user types becomes the randomisation. There is an example in the Advanced Contextual Alternates tutorial.

I assume you are doing something similar already, but I cannot tell what these groups are.

Sorry for not explaining it properly. As stated in the first post I am trying to do a handwriting font that would be as close to the original handwriting.
I have classes of letters (.ll001, .ll002, .ll003, .lh001, .lh002, .lh003,…) first letter stand for the stroke that comes into the letter (lowercase letters) and second letter stands for the stroke that comes “out” of the letter (“h” stands for high, “l” stands for low and “n” stands for no connection). Every class with the same attributes (hh,ll, nn, ln, lh,…) has three versions (001, 002, 003). Which means I have 27 classes of the letters.
What I am trying to do now is to make everything go along together, but since I am no expert whatsoever in Opentype features I am confused and lost now :smiley:

Did I do better at explaining it this time? :slight_smile:
Thank you so much for your help.


The more I read about it on all corners of the internet I think what I want to achieve is hardly possible…
Anyone has any ideas? :slight_smile:

I am still not quite sure how I can help you. You can exchange glyphs based on their context, but you know that already. Perhaps you want to read through Tal’s OpenType cookbook to get a grip of the various techniques.

In any event, you need to think in steps which you can cage into lookups.

And maybe you want to rethink your system, because telling from what you write, it looks like there sometimes are more than one possibility to connect the same letters. Is that right?

Thanks for the advice. I read through OpenType cookbook a couple of times now :slight_smile:
Yeah, that’s right. There is more than one possibility for the connection…
I wanted to create a font that would choose the next letter base on the letter before it… and at the same time cycle through 3 different alternates of this letter.

One way to do that would be to first do all the connections and then, in a second step switch in the variants. That would be much easier to debug.

You mean to make opentype features for all the connections?
I made that but, the problem is how to switch between the high and low connections… I think I got myself in a way bigger problem than I can handle. I thought there must be a way to make opentype choose between two of the lookups that have the same importance… Probably I am talking in a way you don’t even know what I mean :slight_smile: i am sorry about that.
And thank you for all your patience & help.

I mean you first go through all combination that need height adjustments.

sub b [a b c]' by [a.mid b.mid c.mid];
sub r [a b c]' by [a.high b.high c.high];

you need to keep those rules in the right order or put the alternate shapes in the context, too.

In OpenType you can do decisions. Only rules that are applied one after the other.

Thank you so much for all your help!

If we look at the example above… I have different letters depending if there is a letter on the beginning of the word, end, middle or isolated. In the middle my letters cycle between 1st, 2nd or 3rd alternate of the letter. But my problem is to make them cycle with the isolated, initial and final letters. Is there way to make this cycle as well?
Does anybody have an idea how to make them cycle?

One way is to:

  • put the cycles in calt,
  • put calt after the positional features,
  • repeat the positional features in lookups inside calt,
  • add the cycle code in separate lookups at the end of calt,
  • and include the positional forms in the cycling classes.

The basic idea of what is described in the tutorial remains the same.

1 Like

Thank you so much,
I’ll try this & let’ see if I manage to make it right :slight_smile:

@mekkablue & @GeorgSeifert

Thank you so much for all your help :slight_smile:
It’s working now :slight_smile:

Thank you soo much!

1 Like

I guess I should buy you a couple of beers after this one. :slight_smile:
Well, everything is working now in glyphs preview. But when I exported it (.otf of course), the calt feature and the dlig features are working (Adobe Ilustrator) but the fina, isol and init are not :frowning:

Can anyone explain what am I doing wrong?

They don’t work automatically, and I believe, are not supported in AI. But you can put them into calt as well. Take a look at the positional feature tutorial.

Yes, I see they don’t.
The problem is then I am back to the beginning because my problem was solved by the use of positional features. I made my features like you proposed above, but am in need of this working automatically…

“One way is to:

put the cycles in calt,
put calt after the positional features,
repeat the positional features in lookups inside calt,
add the cycle code in separate lookups at the end of calt,
and include the positional forms in the cycling classes.”

any ideas? :slight_smile:

Hahaha stupid me :))
Figured it out :slight_smile:

1 Like

Does the explanation above also work for glyphs with marks? I’m working on a handwritten font myself where I want do substitute certain glyphs to make it look random. Besides that, some glyphs (e.g. é, à, ü, etc.) also need to be taken in account. If I change for instance e.001 with e.002, how do I get the marks to work as well?