Positional Alternate Pairs / Contextual Substitutions

We are working on a graffiti / silly bubble font made up of outlines and need to somehow work on some contextual / positional alternate pairs for all letter combinations — the way the letters link up each time will be different to give the full graffiti style treatment.

Am fairly new to this level of technical engineering but have tried the following:

— Ligatures; naturally this won’t work as they only suit pairs and not full words
— Contextual subs: gets close but again seems to only suit pairs unless we generate thousands of .alt options (?)
— Positional alternates: again feels close but need to have different options for when letter A is next to B and when letter A is next to C etc.

It’s easy enough to generate the 676 uppercase combinations we would need (Latin, uppercase 26x26 combinations), but seemingly a bit of a headache to apply these combinations within words and not just pairs.


The answer depends on how the glyphs connect to each other. Can you share screenshots from a few samples of your glyphs?

Maybe this is all you need:

Some very rough sketches we did to test this out:

The below illustrates how taking a sample for just a few letters shows how we would need a range of alternates to connect. We need to give the impression of overlap. Essentially we need to write some kind of substitution that will substitute select letters depending on which glyph has come before.

You could cut each glyph vertically so that you can do different versions for left and right connections. That can save you a lot alternates and is more flexible. You have to find a point on each outline where each variation is the same. That is mostly the top/bottom extreme point.

In that case you need an alternate for each other preceding letter. At worst it is 26 alternates. You can use the technique I described above to save some letters.

There was a thread about this same question a few months ago: Color font with overlapping letters

How would you go about setting an alternate for each preceding letter?

We are happy to draw 26 alternates for each character to achieve the most organic look — do we then need to have these as .cut glyphs? And how do we actually write this feature code. Would it be through contextual or positional alternates? Or neither?

Have had a look at the TypeDraw article a few times but not sure if anything is quite the same solution we are after…

You would name your glyphs like so:

  • a (for the glyph a at the start of a word or in isolation)
  • a.a (version of the glyph a for when it follows the glyph a)
  • a.b (version of the glyph a for when it follows the glyph b)
  • a.c (version of the glyph a for when it follows the glyph c)

And the feature code would be as follows:

@normal = [a b c …];
@a = [a a.a a.b a.c …];
@b = [b b.a b.b b.c …];
@c = [c c.a c.b c.c …];

sub @a @normal' by [a.a b.a c.a …];
sub @b @normal' by [a.b b.b c.b …];
sub @c @normal' by [a.c b.c c.c …];

Note that the number of glyph names in @normal need to be the same as in the groups after the by keyword:

@normal = [a b c]; # count = 3
sub @a @normal' by [a.a b.a c.a]; # count = 3, OK
sub @a @normal' by [a.a b.a]; # count = 2, not OK
sub @a @normal' by [a.a b.a c.a d.a]; # count = 4, not OK

Nice one — gonna give this a go now. Will let you know how we get on with the results.

This works perfect for each of the pairs. The issue we now run into is with the spacing.

I can kern each of the pairs accordingly but then we run into issues when making longer words.

For instance in the below example when writing ABBA, the kerned A/B.A pair looks correct, but then there is no kerning set for B.A/B.B.

The B.B kerning is set and so is A.B set but the word ABBA is then actually made up of A/B.A/B.B/A.B.

We could generate kerning pairs for all pair combinations (although clearly not the right solution) but then we will run into the same issue when any word is longer than 4 letters.

Do you think there is anyway to resolve this?

You don’t need to use kerning in this case. For example, B.A will always follow A, therefore, instead of defining a kerning pair for A and B.A, you can reduce the left sidebearing of B.A to perfectly fit the B.A shape into the A shape.

Working well now. Next hurdle is to think about how we might be able to have alternates for each of these letters and how this might work with the pairing.

For A and B for example would it be as simple as creating an A.alt and B.alt then an A.alt.B.alt glyph? Or how would you suggest going about this?