Invoking the OT right to left alternates feature

The OT spec says:

When an OpenType text layout engine applies the Unicode bidi algorithm and gets to the point where mirroring needs to be performed . . . The engine applies the ‘rtla’ feature to the entire RTL run.

I'm working on a font that supports the Old Italic range of Unicode.  These characters are strongly LTR, but are sometimes used for RTL text.  The usual recommendation is to insert a right to left override, terminated by a pop directional format.  Assuming that the application respects these bidi controls (not all do, but that's another discussion), is the presence of the RLO enough to get the layout engine to apply the rtla feature?  One would hope so, but . . . .   If adding a RLO doesn't work, is there any way to get this feature applied without users doing it manually?  Thanks!


  • John HudsonJohn Hudson Posts: 2,869
    This is a question in which I am also interested. Bascially, I think we're going to need to do a lot of testing in different environments, to see whether the RLO works as intended. I had some initial correspondence with shaping engine folk at Microsoft about this, and in theory it should work. I've just started work on a Greek font that will aim to support boustrophedon layout, but am still some way from the test phase.
  • I had a few minutes this morning so I added some mirrored Old Italic glyphs and constructed the rtla feature.  First I put it only under Old Italic/default, which did not work.  So I added it under Default script/default, but that wasn't successful either.

    Testing was on Win7 using Notepad and Word 2016, both of which do respect the RLO and PDF control characters.  LibreOffice Writer just ignores the bidi controls, unfortunately, but did allow me to apply the rtla feature manually.  It did work, so the substitution seems to be constructed properly.
  • Khaled HosnyKhaled Hosny Posts: 289
    I just did a quick test using mirrored Latin characters and “rtla” feature and it got activated for text enclosed in RLO/PDF in Firefox, Chrome and LibreOffice (on Linux, but it should work on other platforms):

  • Khaled, thank you for taking time to test.  I'm not surprised that it worked in web browsers.  I just tried for the third time using LO Writer on Win 7.  It fails not only for Old Italic but also for Latin script (screen shot shows only the former, but I did try the latter).  Wish we could get this to work on Windows since LO is otherwise such a good test for font development.  In a day or two I will be able to try this font with LO on Mac and will report back.

  • David PerryDavid Perry Posts: 23
    edited July 2017
    I got access to a Mac this afternoon, running OS 10.11.6 (El Capitan).

    TextEdit and Nisus Writer both work correctly, respecting the RLO and automatically applyiing rtla.  I suspect that other Mac apps that use the text services provided by OS X, rather than doing their own thing, will work too.  Scribus 1.5.3 also is good.

    As on Windows, Word 2016 implements the RLO but does not apply rtla, and LO Writer 5.3.3 does neither but will let me apply rtla manually.

    Mellel and InDesign CC 2015 don't work at all.
  • John HudsonJohn Hudson Posts: 2,869
    David, can you check whether there is any difference in support on Windows if you use <rtlm> instead of <rtla>?
  • David PerryDavid Perry Posts: 23
    edited July 2017

    I’ll be happy to test; give me a day to update my experimental font.

    Meanwhile, I’d appreciate it if someone could clarify when rtlm is appropriate vs rtla. According to this page (see item 2 at the very bottom), rtlm seems intended to cover characters with the mirrored property (pairs of brackets and such, I believe) that were added after Unicode 5.1, while rtla is for other characters. That's why I originally started testing with rtla.  But the actual descriptions of the features here are not so clear. I’ve reread this stuff a couple of times and am still unsure what is most appropriate for the Old Italic letters.  Nor am I clear about why two separate features needed to added in the first place.

  • See the information in the last section on this page for details:

  • John HudsonJohn Hudson Posts: 2,869
    Peter, I think there is some confusion — at least in my own mind — regarding the word 'mirrored'.

    There are characters that should be flipped horizontally when text direction changes, which can be interpreted as individually mirrored. And then there are characters that belong to pairs that should be swapped when text direction changes, e.g. opening and closing parentheses, which can be interpreted as mirroring each other. I think this is where font makers get a bit confused as to whether to use <rtlm> or <rtla>, because we're not sure what meaning of 'mirrored' is implied. Should <rtlm> be used only for glyphs with mirroring pairs, or also for individually mirrored (horizontally flipped) glyphs? Or, more precisely, should <rtlm> be used only for characters that have Unicode mirroring properties, but that are not in the OMPL list, and <rtla> should be used for all others (e.g. my Greek boustrophedon variants)?
  • I apologize; I pasted the wrong URL, since the first link in my previous post was supposed to point to the page that Peter provided.  That was where I got the idea that rtla was better for Old Italic.  Just want to be sure that I am using the most appropriate feature (which, of course, may not work . . . )
  • Thank you, John — I was also thinking about the ambiguity of the term 'mirroring.' But I did not express it as clearly as you did. 
  • Update: Testing with <rtlm> produces the same results as previously posted with <rtla> on Windows 7.

    Additionally, I tested using XeLaTeX, which (not surprisingly) behaved just fine, applying <rtlm> automatically after a RLO.  I assume plain XeTeX will work as well and that Xe(La)TeX will give the same results on Mac or Linux -- it always has in my experience.
  • Khaled HosnyKhaled Hosny Posts: 289
    You might want to try LibreOffice 5.4 pre-release, as there was a bug caused by overzealous optimization that prevented running the BiDi algorithm in some cases where it is needed. I suspect your issue to be the same. It would also explain why it does not happen for me as I run LibreOffice on an RTL locale which was not affected by this bug.
  • Good news: LO now respects the RLO on Windows 7.  I was using my Old Italic font to enter text, but then LO switched to a different font after I inserted the RLO (RLO is included in my font).  Reapplying my font caused the characters to be flipped horizontally, so <rtlm> is automatically applied if the font has it.  I'll send you a PM with details about the font change issue since they are probably off topic for this thread.

    The bug you mentioned is interesting for those of us who work with historic scripts -- an historic RTL script used for a language that now is written LRT.  No wonder the software got confused.  I don't know of any parallel case.

Sign In or Register to comment.