[XeTeX] Checking for existence of font feature

Michael Lynch michael.s.lynch at gmail.com
Wed Aug 11 22:39:07 CEST 2010

On 11/08/2010 20:54, Michael Lynch wrote:
> Hello all,
> I'm trying to test for the existence of an OpenType font feature before
> it's used in a document.
> I want a command that will transparently emulate an acceptable
> alternative in the event that the feature doesn't exist, whilst logging
> the problem in the log file. Since the command is part of a package I'm
> creating, I think this is preferable to it failing outright.
> One of the features I'd like to test for is small caps. I'm not
> optimistic, as in a plain XeTeX document,
> \font\a="Times New Roman:+smcp" at 12pt
> doesn't register as causing any problems, even though this call doesn't
> produce anything different to
> \font\a="Times New Roman" at 12pt
> Have I missed something? opentype-info.tex iterates through all the
> features, so there might be some way to check each one as it goes past,
> but this does seem pretty laborious. I don't really have the experience
> of TeX to know how to do something with that either though.
> Thanks,
> Mike

One thing I'd forgotten is that with XeLaTeX, fontspec warns when 
features aren't available. Looking at the package, it seems that 
\fontspec_check_ot_feat is responsible, but this package is about as 
complicated as any I've looked at and I'm not quite sure how it should 
be used.

Will, or someone else suitably knowledgeable, can you explain how this 
could be used for this?


More information about the XeTeX mailing list