[XeTeX] XeTeX, fontspec, OTF, and fontdimens

Khaled Hosny khaledhosny at eglug.org
Sun Feb 20 17:01:18 CET 2011


On Fri, Feb 18, 2011 at 10:11:41PM -0600, mskala at ansuz.sooke.bc.ca 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tex
Type: text/x-tex
Size: 407 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20110220/0d3d5842/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 3962 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20110220/0d3d5842/attachment.pdf>


More information about the XeTeX mailing list