[XeTeX] Fontspec: Switching off a feature
Ross Moore
ross at ics.mq.edu.au
Mon Mar 1 00:48:28 CET 2010
On 01/03/2010, at 8:51 AM, Florian Grammel wrote:
> I'd need to switch off one specific fontspec-feature in some
> specific places, without touching the other ones and also leaving
> italicisation etc intact.
> Having pairs like Historical and NoHistorical, I thought this would
> be straightforward:
>
>
> \documentclass[12pt]{article}
>
> \usepackage{fontspec}
> \setromanfont{Junicode}
>
>
>
> \begin{document}
>
> oo
> \addfontfeature{Ligatures=Historical}
> oo
> {\addfontfeature{Ligatures=NoHistorical} oo}
> oo
>
> \end{document}
>
> Could anybody give me a hint what I'm doing wrong?
Avoid putting implementation commands within the body
of your document. These belong in the preamble, where
you define macros to make use of different features.
e.g.
>>> \documentclass[12pt]{article}
>>>
>>> \usepackage{fontspec}
>>> \setromanfont{Junicode}
>>>
>>> \newfontfamily{\nohist}[Ligatures=NoHistorical]{Junicode}
>>> \newfontfamily{\hist}[Ligatures=Historical]{Junicode}% this is
>>> the default ???
>>>
>>> \DeclareRobustCommand{\texthist}[1]{{\hist#1}}
>>> \DeclareRobustCommand{\textnohist}[1]{{\nohist#1}}
>>>
>>> \begin{document}
>>>
>>>
>>> oo {\hist oo} oo
>>> oo \texthist{oo} oo
>>>
>>> \hist % best not to do this kind of global change
>>> oo {\nohist oo} oo
>>> oo \textnohist{oo} oo
>>>
>>> \end{document}
Note that the \texthist and \textnohist versions are generally
preferable, since they are robust for writing content into .toc
or .lof of .lot files, for section-headings and captions.
>
>
>
> The feature, that I actually need to use, is Style=Historic, which
> doesn't seem to have "NoHistoric" counterpart at all... But I
> guess, I could always add
>
> \zf at define@feature at option{Style}{NoHistoric} {} {} {-hist}
>
> to fontspec.sty, couldn't I?
There shouldn't be a need for this.
Unless it is added to the general distribution, then it may
get lost when next you update.
>
>
>
> Thanks in advance!
> Florian.
>
> ____________________________________________
>
> Florian Grammel
>
> Gentofte, Denmark
Hope this helps,
Ross
------------------------------------------------------------------------
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