[XeTeX] XeTeX, fontspec, OTF, and fontdimens

Ulrike Fischer news3 at nililand.de
Sat Feb 19 17:27:24 CET 2011


Am Fri, 18 Feb 2011 22:11:41 -0600 (CST) schrieb
mskala at ansuz.sooke.bc.ca:

> I'm having trouble with monospace OTF fonts.  If I load a monospace OTF
> font with fontspec, it works fine at the default size, but when I change
> the size with LaTeX class-provided commands such as \Large, the spaces
> between words end up the wrong size.  I did some digging and found
> the problem seems to be that the \fontdimen values do not change when the
> font size changes.  So if I start with 12-point type, and if I'm lucky
> enough to get reasonable-sized word spaces at that size, then when I
> switch to 18-point type, the spaces remain the size that would have been
> correct for 12-point.
> 
> The same does not happen for Latin Modern; it seems to be specific to OTF.
> 
> Code demonstrating the problem (you will need a monospace OTF font; I can
> provide one off-list if anyone wants to try it):
> 
> \documentclass{article}
> 
> \usepackage{fontspec}
> 
> \defaultfontfeatures{%
>   WordSpace={1,0,0},PunctuationSpace={3},Mapping=tex-text,Path=otf/}

As far as I can see the problem has nothing to do with monospace
fonts (I get the result with e.g. Arial or Latin Modern Roman). The
problem is the "WordSpace={1,0,0}": It sets the fontdimen when the
font is loaded - and switching to another font size doesn't reload a
font and so doesn't change the fontdimen. It works as expected if
you reload the font by e.g. choosing a bit different feature:

\Huge
\fontspec[WordSpace={1.1,0,0}]{Latin Modern Roman}
...

I would say WordSpace shouldn't be used in  \defaultfontfeatures.

-- 
Ulrike Fischer 



More information about the XeTeX mailing list