Best way to do this substitution

Discuss FontCreator here, please do not post support requests, feature requests, or bug reports!
Post Reply
Siavash
Posts: 4
Joined: Tue Jul 19, 2016 4:41 pm

Best way to do this substitution

Post by Siavash »

Hi,

I have designed fonts before. Persian fonts. But I had never changed too much the OpenType features except the ligatures and intial, medial,... and diacritics and stuff like that.

But now I'm designing a Persian font with detached separated glyphs (like a Latin one).

And I have decided to do a {salt}. But it is a little complicated and I only do these things with the Open Type Designer, so maybe it is my lack of scripting capabilities.

It goes like this:

Substitute Kaf (only inital and medial) with a glyph I added myself to the Persian standard glyphs named _longKaf if all the next glyphs after Kaf are some glyphs gathered in a Class for example @NotDotAbove. Also do all of these just when users set the text to {salt}.

So I want to know which kind of substitution works better here and how? I did single sub, it worked but does the sub all the time.

Any help? :!: :?:
Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 9873
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Best way to do this substitution

Post by Bhikkhu Pesala »

I think what you need is a contextual substitution (calt)
My FontsReviews: MainTypeFont CreatorHelpFC15 + MT12.0 @ Win 10 64-bit build 19045.2486
Siavash
Posts: 4
Joined: Tue Jul 19, 2016 4:41 pm

Re: Best way to do this substitution

Post by Siavash »

Thanks.

I did that too, but I can't make that to ignore some glyphs. It would apply the substitution at all times.
Should I use ChainingContext?
Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 9873
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: Best way to do this substitution

Post by Bhikkhu Pesala »

I have only ever used a chaining context for Ordinals.
Ordinals Feature.png
Ordinals Feature.png (33.21 KiB) Viewed 5660 times
I think what you need is a Reverse Chaining Context
My FontsReviews: MainTypeFont CreatorHelpFC15 + MT12.0 @ Win 10 64-bit build 19045.2486
Siavash
Posts: 4
Joined: Tue Jul 19, 2016 4:41 pm

Re: Best way to do this substitution

Post by Siavash »

Could you please tell me how to replace 2 glyphs with 1 new glyph but only when:

1- Certain Class is in front of the 2 glyphs.
2- Text is set on a salt or calt.

And also do this with reverse chaining context?

I really don't know! :(
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Best way to do this substitution

Post by Erwin Denissen »

Siavash wrote:Could you please tell me how to replace 2 glyphs with 1 new glyph but only when:

1- Certain Class is in front of the 2 glyphs.
2- Text is set on a salt or calt.
Here is some OpenType layout feature code that will replace "12" with "3" if it is typed after a capital letter:

Code: Select all

script latn {
  feature ContextualAlternates1;
  feature StylisticAlternates1;
}

class @Uppercase [A B C D E F G H I J K L M N O P Q R S T U V W X Y Z];

feature ContextualAlternates1 calt {
  lookup ChainingContext1;
}

feature StylisticAlternates1 salt {
  lookup ChainingContext1;
}

lookup ChainingContext1 {
  context (@Uppercase) one two;
  sub 0 Ligature1;
}

lookup Ligature1 {
  sub one two -> three;
}
Siavash wrote:And also do this with reverse chaining context?

I really don't know! :(
The above sample should provide enough information for you to get started.
Erwin Denissen
High-Logic
Proven Font Technology
Post Reply