[XeTeX] Overriding directionality and mirrored shapes

David J. Perry hospes.primus at verizon.net
Sun Sep 17 21:26:04 CEST 2017

The OpenType spec says that when a layout engine encounters a situation 
where mirrored glyphs are required, it should automatically apply the 
<rtla> or <rtlm> features (assuming they exist in the font). LibreOffice 
and TextEdit / Nisus Writer (latter Mac only) do this. See the "Simple 
RLO Test" screen shot.  (BTW: I attached the screen shots.  Does this 
list allow images in the body of a message?)

XeLaTeX does not. It correctly places the characters RTL after inserting 
a right to left override (RLO, U+202E), but the shapes are not mirrored. 
See the minimal example below and the screen shot taken from the output 
PDF. The same font was used to generate both of the screen shots. (If 
you wish to try this for yourself, you will need a font that includes 
both the Old Italic block of Unicode and the appropriate OT features. I 
will share the one I’m making if anybody is really interested.)

Also, inserting a space character or a command such as \hspace breaks 
the effect of the RLO. I’m not completely surprised by this, given how 
TeX operates with runs of text, but I wish it wouldn’t.

Xe(La)TeX has always been my go-to software for testing OT features that 
other software can’t deal with. I’ve been able to get weird things like 
localized features for ancient languages to work; no problem in XeTeX, 
you declare the script and the language and the features work. So I’m 
disappointed that it doesn’t flip the characters. Am I missing something 

Also, before anyone asks: I am familiar with the bidi package. It’s 
common for scholars to insert short RTL texts, one or a few words, in a 
document that is otherwise LTR. In such a situation there is no need for 
the advanced facilities that bidi provides, such as getting whole 
paragraphs to work RTL and so forth. So I hoped I wouldn’t have to use 
it in such situations. (I assume it would automatically mirror the 
characters; yes?)

MINIMAL EXAMPLE (Note: unless the font you are using to view this has 
the Old Italic characters, it will look wrong.)

% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
\setmainfont{Times New Roman}


We are going to test the Old Italic range of Unicode.

\fontspec{Italica Vetus} %use any font that contains the Old Italic 
characters and the <rtla> feature.



%this breaks the run

Now back to left to right text.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Simple RLO test.png
Type: image/png
Size: 10503 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20170917/49ebc670/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Minimal example scnshot.png
Type: image/png
Size: 29149 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20170917/49ebc670/attachment-0003.png>

More information about the XeTeX mailing list