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

Ulrike Fischer news2 at nililand.de
Fri Feb 15 10:12:43 CET 2008


Am Fri, 15 Feb 2008 10:02:46 +1030 schrieb Will Robertson:

> On 14/02/2008, at 8:40 PM, Ulrike Fischer wrote:
> 
>> So what is the best way to add/change font features of the default
>> lmodern fonts?
> 
> Unfortunately you can't :(
> (You'll have to load the fonts explicitly in fontspec if you want more  
> features. Luckily the most recent versions play nicely with automatic  
> optical sizing..)
> 
> fontspec changes the NFSS font encoding to EU1, and the Latin Modern  
> fonts are loaded by eu1lmr.fd (etc.). This font loading mechanism is  
> completely separate to how the usual \fontspec-type commands work.  
> (More due to the history of fontspec than any technical impossibility.)
> 
> Now, mapping=tex-text *should* be applied by default, but I left it  
> out by mistake in an older version of the "euenc" package. 

I checked that I have the newest fontspec but didn't realize that euenc
could be important too. 
I update the lm + euenc and now mapping is enabled by default. But I
don't know if it is a good idea to enable it also for the ttfamily.  

> Things get more complicated now because the LM fonts have just been
> updated and all of the font filenames changed. 

That's the prize if one use actual file names in the fd-files ;-). I
guess virtual fonts or some map-system is not an option if you want to
use the open type fonts. But why don't you use at least command names?
This would enable you to hold the list of font names in one place and
you even could install a simple system to enable/disable mapping for
families:

\documentclass{scrreprt}
\usepackage{fontspec}
\usepackage{xunicode,xltxtra}
\def\lmmonomapping{:mapping=tex-text}
%\def\lmmonomapping{}
\def\lmmonox{"[lmmono10-regular]\lmmonomapping"}
\def\lmmonoiix{"[lmmono8-regular]\lmmonomapping"}
\DeclareFontFamily{EU1}{lmtt}{}
\DeclareFontShape{EU1}{lmtt}{m}{n}
     {<-8.5>   \lmmonoiix     <8.5-9.5> "[lmmono9-regular]"
      <9.5-11>  \lmmonox   <11->     "[lmmono12-regular]"
      }{}

\begin{document}
\ttfamily 
 -- --- \tiny abc--d
\end{document}


Btw: in eu1lmtt.fd there is one reference to a normal tex font:

\DeclareFontShape{EU1}{lmtt}{m}{it}
{<-> ec-lmtti10}{}



-- 
Ulrike Fischer 



More information about the XeTeX mailing list