On Fri, Feb 18, 2011 at 10:11:41PM -0600, [email protected] wrote: > 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}
I lost track of what the original issue is, so I tried testing your example with a little modification (removing default font feature and using different font), and all monspaced fonts I tried are giving me, guess what, monospaced results. Now I'm more confused. Regards, Khaled -- Khaled Hosny Egyptian
\documentclass{article}
\usepackage{fontspec}
%setmainfont{lmmono12-regular.otf}
%setmainfont{FreeMono.otf}
\setmainfont{texgyrecursor-regular.otf}
%setmainfont{cmuntt.otf}
%setmainfont{DroidSansMono.ttf}
\begin{document}
\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}
test.pdf
Description: Adobe PDF document
-------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
