[XeTeX] Checking for existence of font feature
khaledhosny at eglug.org
Wed Aug 11 23:54:54 CEST 2010
On Wed, Aug 11, 2010 at 09:39:07PM +0100, Michael Lynch wrote:
> 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.
> 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?
Fontspec 2 has public API for checking font features, check fontspec
manual §18 Programing details.
Arabic localiser and member of Arabeyes.org team
Free font developer
More information about the XeTeX