[XeTeX] fontspec_if_current_script or \fontspec_if_script functions of fontspec
Will Robertson
wspr81 at gmail.com
Sun Sep 18 08:44:13 CEST 2011
On 2011-09-17 18:44:48 +0930, VAFA KHALIGHI
<vafaklg at gmail.com> said:
> Why this always returns "non-RTL script"?
>
> \newif\if at Latin
> \fontspec_if_current_script:nTF {arab} {\@Latinfalse} {\@Latintrue}
I wondered if the documentation for this feature needed work, but it
seems okay if a little terse: "Test whether the currently loaded font
is using the specified raw OpenType script tag #1."
This is, you have to execute the conditional after you've selected the font:
\documentclass{article}
\usepackage{fontspec}
\ExplSyntaxOn
\def\test{
\fontspec_if_current_script:nF {arab} {non-}
RTL~ script
}
\ExplSyntaxOff
\newfontfamily\rlfont[Script=Arabic]{XB Zar}
\newfontfamily\lrfont[Path,Script=Latin]{lmroman12-regular}
\begin{document}
{\rlfont\test}
{\lrfont\test}
\end{document}
Hope this helps,
Will
More information about the XeTeX
mailing list