Reversed chaining context help needed

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Post Reply
Soleille
Posts: 18
Joined: Sat Jul 29, 2017 6:15 pm

Reversed chaining context help needed

Post by Soleille »

Hello ! :)

I finally managed to understand how to use Chaining Context and it's working. I use it so that when I type a letter belonging to a class(v, w, b, for example) I have specific letters which are used instead of the "normal" ones.

Now, I need to replace a specific letter in a word (when it's being written), when I type the next lower case letter.

I told myself I should use Reversed chaining context. I tried but it doesn't work.

Here is what I wrote :

Code: Select all

script latn {
  feature ContextualAlternates;
}

class @lowercase [a-z];
class @lettertochange [q s];     ----> these are the letters I need to chane at the end of a word (birds for instance).
class @lettertouse [q.eow s.eow];     ----> these are the letters which should replace the letters q and s

feature ContextualAlternates calt {
  lookup ReverseChainingContextLetterEow;
}

lookup ReverseChainingContextLetterEow {
  reverse context (@lettertochange)(@lowercase);
  sub ReverseSubstitutionLetterEow;
}

lookup ReverseSubstitutionLetterEow {
  sub @lettertochange -> @lettertouse;   ----> Is supposed to replace the letter to change (s or q) by the letter to use (q.eow s.eow)
}
Can you tell me why it doesn't work ?

Can you give me an example of a working code for Reversed chaining context ?

Thank you ! :)
Soleille
Posts: 18
Joined: Sat Jul 29, 2017 6:15 pm

Re: Reversed chaining context help needed

Post by Soleille »

Here is an image showing what I want to do :
Image

Please, tell me if I chose the wrong solution.

Thank you. :)
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Reversed chaining context help needed

Post by Erwin Denissen »

Reverse Chaining contextual single substitution is specifically meant for Arabic script writing styles. Unfortunately terminal forms (fina) can't be used either as that is also meant for Arabic scripts.

But fortunately there is an elegant way to achieve what you want. This code, based on OpenType feature code from this post should do the trick:

Code: Select all

script latn {
  feature ContextualAlternates;
}

class @lowercase [a-z];
class @lowercasefina [a.fina-z.fina];
class @lowercase_all [A-Z a-z a.fina-z.fina];

feature ContextualAlternates calt {
  lookup ChainingContextFina;
}

lookup ChainingContextFina {
  context (@lowercase_all) @lowercase;
  sub 0 SingleSubstitutionFina;
}

lookup SingleSubstitutionFina {
  sub @lowercase -> @lowercasefina;
}
Erwin Denissen
High-Logic
Proven Font Technology
Soleille
Posts: 18
Joined: Sat Jul 29, 2017 6:15 pm

Re: Reversed chaining context help needed

Post by Soleille »

Thank you. I will try to use this code and understand how it works to use it axactly as I need. :)
Soleille
Posts: 18
Joined: Sat Jul 29, 2017 6:15 pm

Re: Reversed chaining context help needed

Post by Soleille »

It works fine. Thanks a lot. :)
Post Reply