Swash/Small caps problem

Nick Cooke's picture

I have created c2sc, smcp and swsh features which all work as they should. However, when applying the smcp together with the swsh, the two ligatures for n_g.swsh and h_y.swsh appear instead of N, G, H and Y small caps. How can I have the two features together and somehow override the ligatures?

Here's the code:
feature swsh {
sub @swsh1 by @swsh2;
sub N i by N_i.swsh;
sub h y by h_y.swsh;
sub n g by n_g.swsh;
sub n y by n_y.swsh;
sub r h by r_h.swsh;
sub r i by r_i.swsh;
sub r j by r_j.swsh;
sub r k by r_k.swsh;
sub r t by r_t.swsh;
sub r.swsh' @fligs by r;
sub @swsh3 by @swsh4;
} swsh;

I've been messing about with it for so long I can't think straight.

Any help gratefully received.

Nick Cooke's picture

What happened to edit?

1. (top) C/l/c
2. Small Caps
3. c2sc, swsh
4. c2sc, swsh, smcp

gluk's picture

Maybe change the order of features help? 'smcp' before 'swsh'...

Nick Cooke's picture

I've tried that, but the swash ligs always remain.

gluk's picture

Interesting, I try to test code below, and it work corect.
When I change the order, it work like in Your example.


lookup smcp {
lookupflag 0;
sub \n by \n.smcp;
} smcp;

lookup swshLiga {
lookupflag 0;
sub \n \g by \n_g.swsh;
} swshLiga;

lookup swshSub {
lookupflag 0;
sub \n by \n.swsh;
} swshSub;

feature smcp {
script DFLT;
language dflt;
lookup smcp;
script latn;
language dflt;
lookup smcp;
} smcp;

feature swsh {
script DFLT;
language dflt;
lookup swshLiga;
lookup swshSub;
script latn;
language dflt;
lookup swshLiga;
lookup swshSub;
} swsh;

Nick Cooke's picture

Thanks Gluk, but I've no idea what this means. I copied and pasted it into smcp and that didn't work, so I tried it in swsh and that didn't either. I'm more of a designer than a programmer, so my coding is at a very rudimentary level and I don't know what goes where.

malcolm's picture

Hi Nick

Having a guess at what is happen here, it could be that the 'swsh' feature may be happening before 'smcp' and/or 'c2sc'. You probably want all the standard replacements to happen first - then have the swash ligatures lookups act on what's there after.
Also if changing text with swash ligs into small caps, you may need to decompose the swash ligs back to standard glyphs in a separate lookup before applying smcp lookups.

agisaak's picture

Maybe post the full code rather than just the code for 'swsh'?

André

Syndicate content Syndicate content