Reversed chaining context help needed

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

Reversed chaining context help needed

Post by Soleille » Wed Aug 02, 2017 11:10 am

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: 16
Joined: Sat Jul 29, 2017 6:15 pm

Re: Reversed chaining context help needed

Post by Soleille » Wed Aug 02, 2017 12:19 pm

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: 7000
Joined: Fri Oct 04, 2002 12:41 am
Location: De Bilt, The Netherlands
Contact:

Re: Reversed chaining context help needed

Post by Erwin Denissen » Wed Aug 02, 2017 1:07 pm

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: 16
Joined: Sat Jul 29, 2017 6:15 pm

Re: Reversed chaining context help needed

Post by Soleille » Thu Aug 03, 2017 7:08 am

Thank you. I will try to use this code and understand how it works to use it axactly as I need. :)

Soleille
Posts: 16
Joined: Sat Jul 29, 2017 6:15 pm

Re: Reversed chaining context help needed

Post by Soleille » Thu Aug 03, 2017 7:10 pm

It works fine. Thanks a lot. :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests