Multiple SALTs for one CALT base glyph?

Topy's picture

I've made a calt to add swashed alternatives to beginning and end of every word. I think it's ok, but I'm planning also stylistic alternatives to these swashes and it's here where it gets complicated. I get "Duplicate target glyph for single substitution" error when compiling. This is what i have now:

Classes:
All_glyphs (All glyphs, including swashes. 986 total)
Normal_Caps_Start (Starting glyphs to be replaced. 170 total)
Normal_Caps_End (Ending glyphs to be replaced. 133 total)
Swash_Caps_Start (Starting glyph swashes. 170 total)
Swash_Caps_End (Ending glyph swashes. 133 total)

Code:
feature calt {
lookup start_swashes {
ignore sub @All_glyphs @Normal_Caps_Start';
sub @Normal_Caps_Start' by @Swash_Caps_Start;
} start_swashes;
lookup end_swashes {
ignore sub @All_glyphs @Normal_Caps_End';
sub @Normal_Caps_End' by @Swash_Caps_End;
} end_swashes;
} calt;

I've put calt feature after salt feature.

The problem must be in the way i made the classes. For example letter A has A1 and A2 alternatives. In Swash_Caps_Start this means: [A1, A2, B...], and in Normal_Caps_Start class its [A, A, B...]. This way the substitute classes have the same amount of pairs, but there are two A's in the other class. How is this done correctly?

Probably there is some really simple solution for this, but now i just can't figure it out. I've searched for this, but Google doesn't anymore give the results from Typophile it has used to.

agisaak's picture

The problem must be in the way i made the classes. For example letter A has A1 and A2 alternatives. In Swash_Caps_Start this means: [A1, A2, B...], and in Normal_Caps_Start class its [A, A, B...]. This way the substitute classes have the same amount of pairs, but there are two A's in the other class. How is this done correctly?

This means that in effect you have you are trying to replace {A, A, B ... } with {A1, A2, B ... }, and the software cannot determine whether A should be substituted by A1 or A2. If you have a rule of the form sub @A by @B, it's perfectly OK to have the same glyph listed multiple times in class B, but generally not in class A.

What you need to do is map {A, B, ... } to {A1, B1, ...} and then substitute A1 by A2 in some lookup which occurs later in your features.

Also, on an unrelated note I suspect that there is an error in your 'calt' code. I think that where you write:

ignore sub @All_glyphs @Normal_Caps_End';

you actually want the following (assuming you're trying to get the substitution to occur only at the end of a word, i.e. where no glyph follows the target glyph).

ignore sub @Normal_Caps_End' @All_glyphs;

André

Topy's picture

Thanks André, sounds reasonable. Do you mean that A to A1 substitution happens in the calt feature and the A1 to A2 substitution would then be in salt, which would be positioned later in the feature order?

agisaak's picture

If I understand you correctly, A1 and A2 are both swash versions intended for initial use, correct?

If so, then yes, you'd perform the A->A1 substitution in 'calt', and the A1->A2 substitution in 'salt', which would be done after your 'calt' feature.

Also, I'd recommend duplicating your 'salt' feature in 'ss01' since InDesign implements stylistic sets but not 'salt', whereas Illustrator implements 'salt' but not stylistic sets.

Finally, don't name your glyphs A1, A2, etc. Use a suffix; for example A.1, A.2. Otherwise, you'll run into compatibility problems with (e.g.) Acrobat Distiller.

André

Topy's picture

It all works now, phew. I was just referring the A1 and A2 names to simplify my post, but a good point there. Thanks Andre, you've been a great help!

Syndicate content Syndicate content