OpenType substitution: many to many (replace sequence by another sequence)

Wei Huang
Wei Huang Posts: 98
edited March 2015 in Type Design Software
How do I write an opentype rule like the following:
f f is replaced with f.alt1 f.alt2
I'm not using ligatures as I was thinking of using these glyphs for other similar substitutions. The following does not work:
sub f' f' by f.alt1 f.alt2;

Thanks in advance

Comments

  • lookup firstSub {
    	sub f' f by f.alt1;
    } firstSub;
    
    lookup secondSub {
    	sub f.alt1 f' by f.alt2;
    } secondSub;
  • You can replace one by one, many by one or one by many. If you want to replace many by many, you need to do a series of contextual lookups, exchanging one glyph at a time, as Paul shows.
  • Dave Crossland
    Dave Crossland Posts: 1,429
    edited March 2015
    You probably want a higher level representation of the many to many substitution and have a program spool it out into the series of lookups Adam describes. 

    https://github.com/davelab6/dancingshoes is one such high level representation, by Yanone. Glyphs 2 (in beta, available to users who register for a license directly not via appstore) seems to has a similar high level representation, since it auto-generates the feature code for eg Arabic, Thai and Devanagari fonts, based on the glyphs available