[XeTeX] Fontspec: Switching off a feature

Khaled Hosny khaledhosny at eglug.org
Mon Mar 1 07:43:33 CET 2010


On Mon, Mar 01, 2010 at 10:48:28AM +1100, Ross Moore wrote:
> >>>\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.

Since \addfontfeature is there for the exact functionality he wants, one
need not to define different fonts, so I'd suggest:

\DeclareRobustCommand{\texthist}[1]{{\addfontfeature{Ligatures=Historical}#1}}
\DeclareRobustCommand{\textnohist}[1]{{\addfontfeature{Ligatures=NoHistorical}#1}}

And now this would work regardless of the current font.

Regards,
 Khaled

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


More information about the XeTeX mailing list