Opentype subtitution many by many (different number)

Hi!
It is a Opentype question which is not related to Glyphs app. Do you know if it is possible to substitute for example two glyphs by three glyphs?
I have managed to change one by multiple or multiple by multiple as long as are equal numbers (for example three by three).
Best regards,

Two possible ways:

  1. Two separate substitution lookups: first a ligature, a b to a_b, then a one-to-many lookup, a_b to a b c.
  2. A chaining contextual lookup, in which you call a lookup with one-to-many substitutions like sub x y' lookup ONE2MANY; and the lookup ONE2MANY is defined in the prefix and contains subs like sub y by y z;.

Thanks! it’s not ideal but I will manage with the first option.

I can’t get this lookup to work:
image
sub A B C D by A B C E;

Always error message:
Make OTF error
Error: “Invalid ligature rule replacement” in Feature ccmp in line: 17

OpenType doesn’t allow this direct. There are ways to implement this but it requires several contextual substitutions.
something like:

sub A' B C D by a;
sub a B' C D by b;
sub a b C' D by c;
sub a b c D' by d;

I didn’t try this and it might have some other side effects.

Thanks, could you please be more clear?

I guess you mean to break it down to 4 steps. What is the " ’ " for?

It indicates which character in the text stream will be replaced.

This is a contextual substitution. Read this please, it is explained here: https://glyphsapp.com/tutorials/features-part-2-contextual-substitutions

This was a great tip. Thanks.

I wish you all good health and better news…

1 Like

This looks like the simplest way:

sub A B C D’ by E;

Do you see any issues with doing it like this?

sub A’ B C D E by a b c d e;
sub a b c d e B’ C’ D’ E’ by zeroWidthNoBreakSpace;

I’m searching for efficiencies in a large number of substitutions like this. This method seems to work well in testing.

That looks good.

1 Like

Thank you all - this works perfect!