Subtables. Rules. Working with "chained context substitution"

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Post Reply
Torsten Ulv
Posts: 14
Joined: Wed Jul 07, 2021 3:39 pm

Subtables. Rules. Working with "chained context substitution"

Post by Torsten Ulv »

I'm training to work with an opentype designer.
The form used is "chained context substitution". Various conditions apply. Each condition is created in one rule. The rules are arranged in four subtables. The same effect is obtained by creating four rules in one subtable. Why is this happening? The glyph substitution effect is obtained, but I can not understand the intended purpose of the subtables, rules.
subtable and rules.PNG
subtable and rules.PNG (6.21 KiB) Viewed 1522 times
How to interact with multiple items in any of the columns?
question1.PNG
question1.PNG (16.44 KiB) Viewed 1522 times
How to apply conditions in the "includes" tab?
question.PNG
question.PNG (17.5 KiB) Viewed 1522 times
includes.PNG
includes.PNG (14.32 KiB) Viewed 1522 times
What does this option mean?
sequenceindex.PNG
sequenceindex.PNG (15.53 KiB) Viewed 1522 times
I don't speak English. To understand the above, a monosyllabic text is written. Sorry.
Erwin Denissen
Moderator
Moderator
Posts: 11158
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Subtables. Rules. Working with "chained context substitution"

Post by Erwin Denissen »

Torsten Ulv wrote: Sat Apr 09, 2022 3:18 pm I'm training to work with an opentype designer.
The form used is "chained context substitution". Various conditions apply. Each condition is created in one rule. The rules are arranged in four subtables. The same effect is obtained by creating four rules in one subtable. Why is this happening? The glyph substitution effect is obtained, but I can not understand the intended purpose of the subtables, rules.
subtable and rules.
They are basically the same, but the way they are stored inside the font binary is different.
Torsten Ulv wrote: Sat Apr 09, 2022 3:18 pm How to apply conditions in the "includes" tab?
That is something very special which related to class0. It is hardly used.

With both chained context positioning and chained context substitution you can also make use of a special class known as class0. This class contains all glyphs except the ones used within the context. For example, if a font contains only these characters: a b c d e, then if Input uses a and d, class0 contains b c and e. The classes within the Includes section will all be treated as being not part of class0. If your rules do not make use of class0, then you can leave the Includes fields empty.
Erwin Denissen
High-Logic
Proven Font Technology
Torsten Ulv
Posts: 14
Joined: Wed Jul 07, 2021 3:39 pm

Re: Subtables. Rules. Working with "chained context substitution"

Post by Torsten Ulv »

That is something very special which related to class0. It is hardly used.
However, I'm interested in trying it out.
Created a simple design and nothing more. In the Lookups added a single substitution of glyphs. Glyphs grouped into three classes.
Class.PNG
Class.PNG (55.07 KiB) Viewed 1464 times
Where:
@0 - digits
@A - all uppercase
@a - all lowercase
Rules.PNG
Rules.PNG (22.21 KiB) Viewed 1464 times
If you change the Input field in the Includes section by inserting classes one by one, then the effect of excluding glyphs from a particular class is obtained. It looks like this:
Includes1.PNG
Includes1.PNG (51.46 KiB) Viewed 1464 times
Include_A.PNG
Include_A.PNG (52.86 KiB) Viewed 1464 times
Includes_a.PNG
Includes_a.PNG (50.9 KiB) Viewed 1464 times
Includes_Aa.PNG
Includes_Aa.PNG (52.32 KiB) Viewed 1464 times
I can't figure out how the Backtrack and Lookahead fields in the Includes section will work. Please, tell me.
Erwin Denissen
Moderator
Moderator
Posts: 11158
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Subtables. Rules. Working with "chained context substitution"

Post by Erwin Denissen »

Try this feature code. It is important to know it is not fea code but our own OTLFD syntax, as fea does not support this advanced stuff.

Also note, the "include input @three;" is not actually used in this example and can be left out.

You can test it in Word and in Edge, but somehow Firefox seems to have an issue with it. It might be a harfbuzz bug.

Code: Select all

script DFLT {
  feature RequiredLigatures;
}

class @one [one];
class @three [three];
class @two_three [two three];
class @digits [zero-nine];

feature RequiredLigatures rlig {
  lookup ChainingContextClass0;
}

lookup ChainingContextClass0 {
  include backtrack @one;
  include input @three;
  context (@class0 @two_three) @digits;
  sub 0 digittonumber;
}

lookup digittonumber {
  sub zero -> numbersign;
  sub one -> numbersign;
  sub two -> numbersign;
  sub three -> numbersign;
}
sampleclass0a.png
sampleclass0a.png (114.72 KiB) Viewed 1449 times
sampleclass0b.png
sampleclass0b.png (103.46 KiB) Viewed 1449 times
sampleclass0c.png
sampleclass0c.png (131.79 KiB) Viewed 1449 times
Erwin Denissen
High-Logic
Proven Font Technology
Post Reply