Context Chain Substitution

Before asking a question on FontCreator look here for possible solutions and tutorials. Please do not post support requests here.
Post Reply
Lesley Prince
Posts: 39
Joined: Wed Mar 30, 2005 4:49 pm
Location: Nottingham, UK
Contact:

Context Chain Substitution

Post by Lesley Prince »

Hello
I am having trouble with Chained Context Substitution. What I want to achieve is to substitute a normal 's' for the 'long s' as used in C17 and C18 writing. So far I have managed to use ligature substitution, but the long s requires some sensitivity to context. I have set up a substitution table as an alternate and I have managed to get into the context dialogue but what I can't do, or don't know how to do, is specify the context, i.e. that when 's' is flanked by other letters, it becomes the long s. How do I specify that all (lower case) letters are included in the flanking criteria? I have read the tutorials and other posts, but I am none the wiser.

Yours in anticipation,
Puzzled of Nottingham

Les Prince :roll:
Dr. Lesley Prince

_____________________

Everything that ever has meant anything has just as truly meant something else (Charles Fort)
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Context Chain Substitution

Post by Erwin Denissen »

I hope this OpenType feature code helps:

Code: Select all

script latn {
  feature ContextualAlternates;
}

class @letters [a-z A-Z];

feature ContextualAlternates calt {
  lookup ChainingContext1;
}

lookup ChainingContext1 {
  context (@letters) s;
  sub 0 SingleSubstitution1;
  context s (@letters);
  sub 0 SingleSubstitution1;
}

lookup SingleSubstitution1 {
  sub s -> longs;
}
Erwin Denissen
High-Logic
Proven Font Technology
Lesley Prince
Posts: 39
Joined: Wed Mar 30, 2005 4:49 pm
Location: Nottingham, UK
Contact:

Re: Context Chain Substitution

Post by Lesley Prince »

Thank you, Erwin
That is very helpful. I will try it out when I get back to 'The Beast' upstairs.
Best wishes
Les
Dr. Lesley Prince

_____________________

Everything that ever has meant anything has just as truly meant something else (Charles Fort)
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Context Chain Substitution

Post by Erwin Denissen »

Perfect. I look forward to your results.

Since the latest updates of FontCreator also support fea feature code, you can also use this.

Code: Select all

languagesystem latn dflt;

@letters = [a-z A-Z];

lookup SingleSubstitution1 {
    sub s by longs;
} SingleSubstitution1;

feature calt { # Contextual Alternates
    sub @letters s' lookup SingleSubstitution1;
    sub s' lookup SingleSubstitution1 @letters;
} calt;
Both will result in the exact same OpenType layout features, but FEA is a more common syntax, so it might help other people who are looking for a similar solution.
Erwin Denissen
High-Logic
Proven Font Technology
Post Reply