[XeTeX] If font under fontspec

Khaled Hosny khaledhosny at eglug.org
Tue Sep 21 11:41:36 CEST 2010


On Tue, Sep 21, 2010 at 12:28:08PM +0930, Will Robertson wrote:
> On 2010-09-21 09:39:51 +0930, Gareth Hughes <garzohugo at gmail.com>
> said:
> 
> >Peter Dyballa wrote:
> >>
> >>Am 20.09.2010 um 20:44 schrieb Gareth Hughes:
> >>
> >>>I'm asking for a more useful implementation that checks whether a
> >>>certain font is in use now
> >>
> >>
> >>Wouldn't it be sufficient to check what \{rm,sf,tt}default are set to?
> >
> >Perhaps, but a more general, fontspec solution is needed because the
> >fonts I want to work with are Syriac fonts. Also, I need to activate
> >kerning corrections only when that font is in use, i.e. it would be no
> >good to see if the font is being used in a document and then apply the
> >kerning corrections for all fonts in the document.
> 
> It sort of depends how you want to write the code for the test.
> Here's a proof of concept that might do what you need:
> 
> \documentclass{article}
> \usepackage{fontspec}
> 
> \makeatletter
> \newcommand\IsFont[4][]{%
>  \begingroup
>    \let\current at family\f at family
>    \fontspec[#1]{#2}

But this requires that the user always have the checked font, otherwise
fontspec will be loading a non-exiting font and will result in the
regular missing font errors.

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


More information about the XeTeX mailing list