[XeTeX] Checking for existence of font feature
Michael Lynch
michael.s.lynch at gmail.com
Thu Aug 19 18:42:26 CEST 2010
On 18/08/2010 06:10, Will Robertson wrote:
> On 2010-08-12 16:16:54 +0930, Khaled Hosny <khaledhosny at eglug.org> said:
>
>>> Ah, thank you. Are these features (relatively) new? Rather
>>> embarrassing not to have spotted them, but anyway…
>>
>> All were introduced in version 2, I think.
>
> Yep, very new.
>
>>> I've got a problem using these commands. Using XeTeX v0.9995.1
>>> texlive svn 15079 on MiKTeX 2.8, fontspec 2010/08/01, none of these
>>> “lower-level” fontspec features I've tried work.
>>>
>>> I've copied the appropriate example from the manual:
>>>
>>> \fontspec_if_feature:nTF {smcp} {True} {False}.
>
>> Since those command use expl3 syntax, you will need \ExplSyntaxOn before
>> using them.
>
> Right; something like this:
>
> \ExplSyntaxOn
> % note that spaces are completely ignored in here!
> \newcommand \testcaps [2] {
> \fontspec_if_feature:nTF {smcp} {#1}{#2}
> }
> \ExplSyntaxOff
> ...
> \fontspec{Times New Roman}
> \testcaps{Caps}{No Caps}
>
> Hope this helps,
> Will
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
Hi Will,
Thanks for that – does just what's needed now. I tried something similar
myself but it didn't quite work.
I put the \ExplSyntaxOn \~Off inside the definition of the command
originally, which doesn't work, but when it's outside like you've put it
does. I always thought that when commands were used in documents, they
were effectively expanded in place (in which case the \ExplSyntax bits
wouldn't appear), but obviously it's not that simple. Is there a simple
explanation for this behaviour?
Thanks again,
Mike
More information about the XeTeX
mailing list