[XeTeX] XeTeX, fontspec, OTF, and fontdimens
mskala at ansuz.sooke.bc.ca
mskala at ansuz.sooke.bc.ca
Sat Feb 19 05:11:41 CET 2011
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/}
\begin{document}
% works with ttfamily, doesn't work with loading the OTF
% \ttfamily
\setmainfont{TsukurimashouKaku}
\noindent
x x x\\
xxxxx\\
x x x\\
xxxxx
Interword space: \the\fontdimen2\font.
\Large
\noindent
x x x\\
xxxxx\\
x x x\\
xxxxx
Interword space: \the\fontdimen2\font.
\end{document}
--
Matthew Skala
mskala at ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/
More information about the XeTeX
mailing list