How to substitute a character depending on the one or two after it?

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Post Reply
Veolaz
Posts: 15
Joined: Wed Mar 27, 2019 5:45 pm

How to substitute a character depending on the one or two after it?

Post by Veolaz »

My Version is 11.5 and please help!
For example,
a b -> c b;
a b c -> d b c.
Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 9873
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: How to substitute a character depending on the one or two after it?

Post by Bhikkhu Pesala »

Moved to support

It is hard to understand why you need this. Please explain.

Perhaps the Randomize Feature will be of interest to you?
My FontsReviews: MainTypeFont CreatorHelpFC15 + MT12.0 @ Win 10 64-bit build 19045.2486
Erwin Denissen
Moderator
Moderator
Posts: 11108
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: How to substitute a character depending on the one or two after it?

Post by Erwin Denissen »

Veolaz wrote: Wed Mar 27, 2019 5:50 pm My Version is 11.5 and please help!
For example,
a b -> c b;
a b c -> d b c.
You need a chained context substitution and single substitution lookups as shown here:
abc-to-dbc.png
abc-to-dbc.png (41.77 KiB) Viewed 2795 times
A basic script that you can import looks like:

Code: Select all

script latn {
  feature ContextualAlternates1;
}

feature ContextualAlternates1 calt {
  lookup ChainingContext1;
}

lookup ChainingContext1 {
  context a (b c);
  sub 0 SingleSubstitution1;
  context a (b);
  sub 0 SingleSubstitution2;
}

lookup SingleSubstitution1 {
  sub a -> d;
}

lookup SingleSubstitution2 {
  sub a -> c;
}
Erwin Denissen
High-Logic
Proven Font Technology
Veolaz
Posts: 15
Joined: Wed Mar 27, 2019 5:45 pm

Re: How to substitute a character depending on the one or two after it?

Post by Veolaz »

Oh thanks a lot! (๑•̀ㅂ•́)و✧
Veolaz
Posts: 15
Joined: Wed Mar 27, 2019 5:45 pm

Re: How to substitute a character depending on the one or two after it?

Post by Veolaz »

And what should I do if I want to do like this:
a <any characters> b c -> a <any characters> d c
Post Reply