[XeTeX] fontspec: mapping=tex-text for the lmodern fonts

Ulrike Fischer news2 at nililand.de
Thu Feb 14 11:10:56 CET 2008


Hallo,

if one wants to use the standard TeX-input -- and --- for endash and
emdash, one can use \defaultfontfeatures{Mapping=tex-text}. This works
fine with all fonts set after the command but has not effect for the
default lmodern fonts set by fontspec (fontspec 2007/09/16 v1.16):

\documentclass{scrreprt}
\usepackage{fontspec}
\usepackage{xunicode,xltxtra}
\defaultfontfeatures{Mapping=tex-text}
%\setmainfont{[lmroman10-regular]}
%\setsansfont{[lmsans10-regular]}
%\setmonofont{[lmtypewriter10-regular]}
%\setmainfont{Times New Roman}


\title{TestTitle}
\begin{document}
Test
 -- --- \sffamily Test --  \ttfamily -- 

\rmfamily\addfontfeatures{Mapping=tex-text} 
--
\end{document}

Resetting the mapping with \addfontfeatures doesn't work too:
    \addfontfeature(s) ignored;
    it cannot be used with a font that wasn't selected by fontspec.

If I uncomment the \setmainfont{[lmroman ...]} line than both
(\defaultfontfeature and \addfontfeatures) work as expected. But I do
find it a bit of a pain to have to figure out which exact font I should
reload (and I don't know if this will mess up the choice of the
different optical sizes). 

So what is the best way to add/change font features of the default
lmodern fonts?

-- 
Ulrike Fischer 



More information about the XeTeX mailing list