Classname/Shortname for a sequence of glyphs

Saurabh SharmaSaurabh Sharma Posts: 23
edited April 11 in Font Technology
I would like to ask if there is any way to declare a class name (or more appropriately, a short name) for an exact sequence of glyphs?

For example, I want to do the following substitution:

lookup example {
   sub a b c d e f m' by g;
} example;

I would be using the same sequence {a b c d e f} many times in different lookups. In order to keep it short and avoid redundancy, is it possible to declare a class name for the sequence as:

my_sequence = {a b c d e f };

and then, the lookup as:

lookup example {
   sub my_sequence m' by g;
} example;

So whenever this exact sequence occurs, the "m" followed by it will be replaced by a "g".

I am also interested in combining two sequences like the following:

sequence1 = {a b c d e f };
sequence2 = {g h i j k l m };
sequence3 = {sequence1 sequence2 };

Using Glyph classes doesn't solve the purpose here as it matches individual items against a rule, and not the entire sequence. Please advise if anyone knows of a workaround or a feature for this scenario.

Comments

  • No, this is not possible.
  • Thank you for confirming @Erwin Denissen . I almost came to that conclusion when I couldn't find a reference on Microsoft's OpenType overview and some other online resources. May be this is not in the specification due to a very limited use-case.
  • Erwin DenissenErwin Denissen Posts: 249
    edited April 11
    I do not know what you want to accomplish, but this example uses two lookups. In fact this is how it also ends up in the font binary, even if you use a single contextual lookup in fea.

    languagesystem latn dflt;

    @mnop = [m-p];
    @ghij = [g-j];

    lookup SingleSubstitution1 {
        sub @mnop by @ghij;
    } SingleSubstitution1;

    feature rlig {
        sub a b c d e f @mnop' lookup SingleSubstitution1;
    } rlig;

    Here is how it works in FontCreator:




  • Thanks again, Erwin. My use case is with a Devanagari font project in which I am trying to combine some custom shapes (horizontal bars) to form a single entity. I will try with a glyph range with decimal digits in a contiguous run. May be that works. I am not sure if a glyph range will do individual item substitution or an entire range substitution, but worth giving a try.
Sign In or Register to comment.