[XeTeX] \XeTeX ?

Jonathan Kew jonathan_kew at sil.org
Fri May 5 13:09:32 CEST 2006


On 5 May 2006, at 10:01 am, Wlodek Bzyl wrote:

>     Is there a way to check the character existence
>     from within XeTeX?

You can use \XeTeXcharglyph"018E to get the glyph ID of character U 
+018E in the current font; if the character isn't supported, this  
will return 0.

So you could use something along the lines of

\def\XeTeX{\leavevmode
   \setbox0=\hbox{X\lower.5ex
   \hbox{\kern-.15em
     \ifnum\XeTeXcharglyph"018E>0
       \char"018E
     \else\ifdim\fontdimen1\font=0pt
       \reflectbox{E}%
     \else % rotation is about the origin, so we need to adjust  
positioning
       \XeTeXuseglyphmetrics=1
       \setbox0=\hbox{E}\dimen0=\ht0 \advance\dimen0 by \dp0
       \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
     \fi\fi
   }\kern-.1667em \TeX}%
   \dp0=0pt \ht0=0pt \box0 }

which uses "018E if available, otherwise it uses \reflectbox for  
unslanted fonts, and \rotatebox for slanted.

JK



More information about the XeTeX mailing list