Discussion:
[XeTeX] Overriding directionality and mirrored shapes
David J. Perry
2017-09-17 19:26:04 UTC
Permalink
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
obvious?

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
\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont{Times New Roman}

\begin{document}

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.

\medskip
\space{.7in}𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐

+RLO\hspace{.25in}\char"202E𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐

+RLO\hspace{.25in}\char"202E𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇\hspace{.25in}𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐
%this breaks the run

\medskip
Now back to left to right text.

\end{document}
Javier Bezos
2017-09-22 14:33:45 UTC
Permalink
David,
(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 reall
interested.)
I'm currently working on the bidi support for babel, so having
your font could be very useful (for scripts other than Arabic
or Hebrew). Could you send it to me?

(As to your question, I'd like to help, but I don't know
how to fix it, sorry).

Best,
Javier



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
Jonathan Kew
2017-09-22 15:37:10 UTC
Permalink
Post by David J. Perry
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.)
Does it work if you explicitly apply the rtla and/or rtlm features (e.g.
using fontspec's RawFeature option)?

JK


--------------------------------------------------
Subscriptions, Archive, and List information,

Loading...