[XeTeX] Differences between XeTeX on Mac and Windows

Jonathan Kew jfkthame at googlemail.com
Fri May 15 01:07:21 CEST 2009


On 14 May 2009, at 20:41, Yannis Haralambous wrote:

> Hi, I'm new to this list so maybe my message is rubbish

Not rubbish... I'm sure many users are unaware of the details of  
what's going on here!


> I was doing a tutorial on LaTeX, and now I systematically do a demo  
> of xelatex, to show how nice it is for Arabic, Chinese, Greek, etc.
>
> My demo on the Mac used the following code:
>
> \documentclass{article}
> \font\y="DecoType Naskh" at 24pt
> \begin{document}
> \yبِسْمِ اللّهِ الرَّحْمنِ الرَّحِيمِ
>
> The result was perfect. The version of XeTeX was 3.141592-0.996.
>
> Then one of the students downloaded XeTeX contained in latest  
> MikTeX, tried exactly the same code, and it didn't worked. He hat to  
> add
> "script=arab" to the font name (he used a Windows font called  
> "Traditional Arabic"), and \beginR...\endR commands to obtain the  
> same result as I did.
>
> Is that normal?

Yes, that makes sense. There are issues involved here:

(1) AAT/ATSUI versus OpenType layout: The Mac version will  
automatically use ATSUI to handle fonts if they contain AAT tables, as  
the Apple-distributed version of DecoType Naskh does. This implements  
shaping with no script-specific behavior; everything is transparently  
handled by the font itself. On non-Mac platforms, or on the Mac if  
OpenType but not AAT tables are found in the font, or if the /ICU  
modifier is added to the font name, then an OpenType layout path is  
used. But this requires you to specify which "script shaping engine"  
to use (a font may support multiple scripts, and xetex does not know  
at the time of instantiating the font what characters you might ask it  
to typeset). Hence the need for the "script=arab" setting as part of  
the font definition.

(2) Right-to-left layout: You will automatically get R-L  
directionality within each word due to the properties of the Unicode  
characters. However, you also need to tell xetex the line layout  
direction to use, with the e-TeX \beginR...\endR commands. In the case  
of your minimal Mac test, you could get away without this because with  
AAT fonts, xetex attempts to merge runs of words and spaces in order  
to apply ATSUI justification to entire lines, and this allowed the  
bidi algorithm to apply across the entire sequence of words. But it  
would have failed if you had font changes, non-default spaces, or  
other stuff within the line. In general, you should assume that the e- 
TeX direction controls are always needed, otherwise you will get  
unpleasant surprises.

If you want to create samples that work the same across all platforms,  
use OpenType (rather than AAT) fonts, as xetex uses the same, platform- 
independent font layout system for these in all cases. The  
"exceptional" situation arises is when you use AAT fonts on the Mac;  
that technology is simply not supported elsewhere. However, if you  
want to create samples using standard Mac system fonts, they will  
generally be AAT-based.

(BTW, I'd highly recommend using the fontspec package in xelatex,  
rather than direct \font declarations, even for small examples.)

HTH,

JK




More information about the XeTeX mailing list