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: 9
Joined: Wed Mar 27, 2019 5:45 pm

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

Post by Veolaz » 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.

Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 8338
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 » Wed Mar 27, 2019 9:28 pm

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 CreatorHelpFC12 Pro + MT9.0 @ Win10 1903 build 18362.295

Erwin Denissen
Moderator
Moderator
Posts: 8256
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 » Wed Mar 27, 2019 9:50 pm

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 381 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: 9
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 » Thu Mar 28, 2019 12:54 am

Oh thanks a lot! (๑•̀ㅂ•́)و✧

Veolaz
Posts: 9
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 » Thu Mar 28, 2019 1:27 am

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

Veolaz
Posts: 9
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 » Wed May 29, 2019 2:22 am

Erwin Denissen wrote:
Wed Mar 27, 2019 9:50 pm
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

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;
}
but when I was testing font it didn't changed...

Post Reply