[XeTeX] Fontspec: Switching off a feature

Ross Moore ross at ics.mq.edu.au
Wed Mar 3 03:34:07 CET 2010

Hi Will, and others,

On 03/03/2010, at 12:09 PM, Will Robertson wrote:

> On 2010-03-02 02:18:02 +1030, Jonathan Kew  
> <jfkthame at googlemail.com> said:
>> Ok, that makes sense. The "-" settings are used to turn off  
>> features that would be applied by default (such as liga, kern,  
>> etc), but they will not turn off features that are being  
>> explicitly turned on in the \font declaration itself.
>> So the way to implement this would be at the fontspec macro level,  
>> with a \removefontfeatures macro analogous to \addfontfeatures. I  
>> don't know how hard that would be to write, though.
> I've been troubled by this for some time but haven't had the time  
> to implement a \removefontfeatures macro.
> It seems fairly uncommon to need it, however, and I encourage  
> everyone to pre-define their fonts in the preamble, so in practise  
> the lack of this feature hasn't kept me up at night.

I agree with this advice ...

> An analogous problem is that certain OpenType features should  
> deactivate other ones, so something like
> \addfontfeature{Numbers=Lining}

   ... especially since some features are not fully orthogonal to  

This means that changing font features "on-the-fly" within the body
of your document can lead to unwanted hard-to-detect effects;
especially when you copy some parts of your body content to other
places, where different fonts or font features many be in effect.

I would say that you always want a single macro for each
         font + combination of attributes
that you are going to use anywhere within the document.
Define this macro in the header, and use it within the body.

When you then copy source from one document into another,
you may be faced with some undefined macros, forcing you to look
into the original document's header to see what was required.
Alternatively, when reading the PDF output, you may notice some
unintended font changes, and trace these to the macro definitions.

In either case you will be forced to reassess the applicability of
those macros in the new setting, and may even give different
expansions to some of them.

If you rely on macros that simply add (or remove) attributes that
may not exist within the current font, then any bad effects become
much harder to detect --- as there'll be no warning message,
and perhaps no visual cue to there being a problem at all.

> should implicitly remove any +onum (etc.) features in the font  
> declaration. That one requires some thought about how that  
> information should be represented internally... one day :)
> Will

Just my thoughts.



Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114

More information about the XeTeX mailing list