[XeTeX] TeX--XeT and OpenType fonts

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Mar 1 14:37:01 CET 2017


On 01/03/2017 12:14, Jonathan Kew wrote:
> On 01/03/2017 11:59, Joseph Wright wrote:
>> Hello all,
>>
>> With example
>>
>>     \font\OTtenrm="[lmroman10-regular.otf]/OT"
>>     \OTtenrm
>>     \TeXXeTstate=1
>>     \beginR
>>     abc
>>     \endR
>>     \bye
>>
>> the output is LTR with TL'16. Is this a known issue?
> 
> Yes, this is expected behavior. The TeX--XeT direction controls (\beginR
> etc) control the ordering of words within a line, etc. (slightly more
> accurately, the direction in which nodes in an hlist progress), but do
> not override the inherent directionality of Unicode characters, so "abc"
> is still a sequence of three strong-LTR letters and they stay in their
> left-to-right order.
> 
> (However, if you try
> 
>   \beginR
>   abc def
>   \endR
> 
> I'd expect you to get output that reads "def abc" because the two words
> are ordered RTL, even though each of them remains LTR internally.)
> 
> This is why it is possible -- for better or worse -- to do something like
> 
>     ...english text {\arabfont العربي} more english
> 
> in a xetex document and have the isolated Arabic word appear with
> correct (internal) RTL directionality, without having to explicitly
> surround it with \beginR...\endR (although for a multi-word Arabic
> phrase that would be necessary); the RTL-ness of the characters controls
> their behavior within the word, despite the TeX direction remaining LTR.
> 
> Currently, there isn't an option to make the TeX-level direction
> override the Unicode character directionality (comparable to the CSS
> property "unicode-bidi:bidi-override;"). Perhaps that would occasionally
> be useful, though people haven't exactly been clamouring for it AFAIK.
> 
> JK

Thanks: all clear.

My guess is for the rare 'override' case one would probably do something
at the macro level in any case (kerning is all wrong to start with).

Joseph



More information about the XeTeX mailing list