[XeTeX] \ifFontExists
Arno Trautmann
Arno.Trautmann at gmx.de
Fri Jan 2 15:04:31 CET 2009
Will Robertson wrote:
> Arno Trautmann <Arno.Trautmann at ...> writes:
>
>> I need something that test if an font exists or not, like:
>>
>> \ifFontExists{myfont}{\fontspec{myfont}}{\fontspec{otherfont}}
>>
>> Is there an easy way to do this? I didn’t find anything in the fontspec
>> man or on the net.
>
> There's an example how to do this in the XeTeX sample documents called
> "testfontavailability" (find attached at end), which are linked from the
> "Downloads" section of the XeTeX website.
Thank you, that works!
Maybe one could add
\def\loadFontIfExists#1{
\testFontAvailability{#1}
\ifFontIsAvailable
\fontspec{#1}\relax
\else
\relax
\fi
}
so it is easy to use. Maybe I am too dumb, but it took me 30min to
figure out how to use this correctly…
> The reason I haven't provided a
> built-in way to do this in fontspec is that it's SLOW.
Isn’t ”slow“ better than ”not at all“?…
Or could you at least give a link in the fontspec manual? I think this
is a rather important function that should be easy to find.
Thanks for your help,
Arno
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://tug.org/pipermail/xetex/attachments/20090102/6ec390e4/attachment.bin
More information about the XeTeX
mailing list