Cross-script OpenType feature?

I've been wondering if it is possible to define a substitution rule for a letterpair consisting of two letters from different scripts, say, Latin and Greek? From what I tried, it seems impossible, I created some classes containing glyphs from mixed scripts and I defined lookups for them which I included in features for both scripts, and it didn't work.
I don't like the idea of scripts and language systems in OpenType scripting, I've always thought it was only limiting the designer. The only useful purpose of this system seems to be the localization feature. Am I wrong?

Comments

  • Kent Lew
    Kent Lew Posts: 937
    I should think it would work fine if the rule is registered under DFLT dflt.
  • No, you can't mix scripts, as such text will be split up in separate segments.

    OpenType layout engines should work the same, but don't. For example a kern pair which includes a space character will work in Word, but fails in Firefox.
  • Bahman Eslami
    Bahman Eslami Posts: 73
    edited December 2016
    This matter becomes more complex when the direction of the script changes. So it becomes very hard to process the shaping on both scripts in a same segment. Take the following sequence of Unicode string:

    Latin فارسی

    This sequence is stored in the memory in this order:

    L
    a
    t
    i
    n
     
    ف‍
    ا
    ر
    س
    ی

    You see how the order is different from what you see in the top sequence. Because the order of the string in memory is in the order which was typed by the user. In the final display the first word is written left to right and second word is written right to left. Before applying the OpenType features every segment of scripts will be separated to avoid problems with directions. I'm not sure why this would happen with scripts with same direction though. This behavior could defer in different shaping engines.
  • Agree with John. I will be surprised if you find (m)any layout engines that do not break the text run depending on writing system (script), regardless of how the features are set up in the font.
  • Khaled Hosny
    Khaled Hosny Posts: 289
    edited December 2016
    For example a kern pair which includes a space character will work in Word, but fails in Firefox.

    Firefox is able to handle OpenType features across space for a few years now (though fonts having such features will not benefit from shaped work caching in Firefox and Chrome which might negatively affect text rendering speed, especially for large amounts of text).

  • @Khaled, you are right as it now seems to work.

    It is still good to be aware the layout engines don't produce 100% identical output, so better test specific features within web browsers, word processors, and type design software.