Contextual glyph insertion


I’m quite new to glyphs and typography.
I want to design a font where every lowercase letter is connected with a bar (much like in hindi fonts), but the bar can be at a higher and a lower position.

Instead of creating up to 9 contextual variations for every letter I wanted to solve this by inserting a “connector glyph” between every two letters.

I was experimenting with syntax like:
sub a b’ by a con_up_right;
sub [a b]’ [a b] by con_up_left [a b];

but I don’t get replacing a glyph with two glyphs to work.

Any ideas as how to solve this?


Can you post some sample pics? I’m not sure I understand what you mean by ‘bar’ and ‘at a higher and a lower position’. higher/lower position towards the left side (previous glyph) or the right side (next glyph) or both?

Generally, you cannot ‘insert’ glyphs. You can only substitute a sequence with another. You may want to read an introduction to contextual substitutions.

Re first example: sub a b’ by a con_up_right; replaces the b (since it’s the marked glyph name), and the sequence a b will be turned into a a con_up_right. Is that what you want?

Re second example: If you replace a class like [a b], the replacement must be a class of the same size.

This is not true. It is possible to have one-to-many substitutions. But this is not very well supported. I do not think Indesign (at least v5.5) has implemented it for latin fonts.

And you can’t have contextual one-to-many substitution. can do something like this:

sub a by a connector;
sub a connector’ b by con_up_right;

Just checked again. It does indeed work in Indesign CS5.5 and CS6. You need to enable the World Ready Composer in CS5.5 (there is a script to do that. Have a look at this page by Thomas Phinney.

Here are two sample pictures:
(I only started the font yesterday, it’s not so beautiful right now.)

Perhaps I’m on the wrong path.
I know how to do contextual alternatives, but that’d involve creating 3 alternatives for every letter (bar on left side, bar on right side, bar on both sided) and that number would square if I also connect some letters on the bottom line ( “es” for example).

One-to-many substitutions do work in glyphs, but only in noncontextual cases

sub a by a xx; #works
sub a’ b by a xx; #Error: “Unsupported contextual GSUB replacement sequence”

Also I had a typo in the first post:
sub a b’ by a con_up_right;
should be:
sub a b’ by a con_up_right;

Could there be another different way to accomplish the same?

Did you not read my message? I explained it.

As the one-to-many substitution can’t have a context, you need to split it in two different row.

How to do that depends what you want to do.

First add a underscore after each glyph:

sub a by a underscore;
sub b by b underscore;
sub c by c underscore;

and so forth.

Then do stuff like for all combinations. You can use classes for it:

sub a underscore’ b by conUpRight;

Then you need some end strokes to replace all underscores that are left over (because it is followed by an none letter or at the end of the line).

sub [a b c … x y z] underscore’ by endstroke;

This should add a connection between all letters.

And don’t use underscores in glyph names unless it is a ligature. So use something like conUpRight instead of con_up_right.

Yeah, I thought about two substitutions as well, actually three, since you need to remove the connector again at the end of a word. The substitutions probably need to be in different lookups, i.e. different features or different lookup XXX {…} XXX; blocks.

But one thing you do not need to do in a contextual substitution is repeat the context, i.e. after the keyword ‘by’, you only need to write the letter(s) that replace(s) the letter(s) marked with a straight quote, e.g.
sub a b’ c by b.alt; # no need to repeat a and b

PS: instead of ‘generally’, I guess I should have said ‘technically’.