Marks, IgnoreMarks, ignore sub

What is the interaction between IgnoreMarks lookupflag and the content of the lookup?
If I wrote a lookup like:

lookupflag IgnoreMarks RightToLeft;
sub beh-ar.init’ @marksabove by beh-ar.init.alt;

is the whole lookup is ignored because it puts some marks in the contextual substitution?

or the same question about ignore sub statement,
If I wrote…

lookupflag IgnoreMarks RightToLeft;
ignore sub beh-ar.init’ @marksabove;
sub beh-ar.init’ beh-ar.medi by beh-ar.init.alt;

is the ignore sub completely ignored because it contains marks? and the substitution is applied without any restriction?

Surely if that’s the case there no point writing these lookups and the versatility of these lookupflag and statement is reduced substantially :tired_face:

Yes. The point of the IgnoreMarks flag is that you can still do contextual substitutions and ligature substitutions etc. no matter which marks are on top of the glyphs.

Here, the ignore statement makes no sense in combination with this sub statement.

What do you want to do? You want beh-ar.init.alt whenever it is followed by marks?
Why not sub beh-ar.init' @marksabove by beh-ar.init.alt;?

There is an extended version of the ‘IgnoreMarks’ keyword. It is called ‘UseMarkFilteringSet’ https://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html#4.d

1 Like

Thanks you mekkablue and Georg,
So in practical terms the lookup should look something like this?

lookupflag RightToLeft UseMarkFilteringSet<@markswithoutmarksabove>;
sub beh-ar.init’ @marksabove by beh-ar.init.alt;

and

lookupflag RightToLeft UseMarkFilteringSet<@marksabove>;
sub beh-ar.init’ beh-ar.medi by beh-ar.init.alt;

As you know IgnoreMarks is crucial for Arabic script. But it happens that you want to create a particular formation in the context of a particular mark or set of marks, or to abort the creation of a particular formation in the context of a particular marks.
This is what I’m trying to do.
For a formation of two base glyphs [a large majority of the cases] this is feasible although it requires a lot of additional classes. But for a formation of three or more base glyphs, where the same marks may be present between the other base glyphs and should be ignored this is problematic.

Is it carved in stone that for IgnoreMarks the lookup should only contain base glyphs and no marks?

No:

lookupflag RightToLeft UseMarkFilteringSet @marksabove;
sub beh-ar.init’ @marksabove by beh-ar.init.alt;

The UseMarkFilteringSet implies a IgnoreMarks. All glyphs in the class you add behind UseMarkFilteringSet are not considered marks any more.

2 Likes

Wow that’s great!
This definitely resolves the two base glyphs context.
Now what happens with a three or more base glyphs context? suppose this:

lookupflag RightToLeft UseMarkFilteringSet @marksabove;
sub beh-ar.init’ @marksabove beh-ar.medi beh-ar.fina by beh-ar.init.alt;

What if a markabove is between beh-ar.medi and beh-ar.fina? Will the implied IgnoreMarks ignore it and let the contextual substitution proceed? If it does let it proceed, then all my problems are resolved.

Nevermind I found a workaround. Not very convenient but it does the job. I simply add another lookup which includes the filtered set:

lookupflag RightToLeft UseMarkFilteringSet @marksabove;
sub beh-ar.init’ @marksabove beh-ar.medi beh-ar.fina by beh-ar.init.alt;
sub beh-ar.init’ @marksabove beh-ar.medi @markabove beh-ar.fina by beh-ar.init.alt;

That is not a workaround. That is how it is done.

1 Like

Yes but very inconvenient nonetheless. I gave a simple example here for the sake of argument but in practice I have to quadruple or more every single line of lookups in some cases. A font designer should focus on what should not be ignored not all eventual possibilities that should be ignored :sweat:

There are much bigger problems with OpenType than this. Needing to repeat a few lines is ‘OK’.

It’s not much bother to me. I’m thinking at the same time how to explain to others how the font is made this way. And this is getting increasingly difficult!
BTW how these extra lookups increase the overall volume of the font? is it significant?

That are not extra lookups but extra substitutions. You can measure that yourself. Export the font, write down the exact size in bytes and then remove that one extra line and export again. Then compare the difference. I expect it to be 10 to 20 bytes difference.

Thank you Georg for all your help. Yes actually it’s not significant compared to total substitutions in the font. So far so good.