[XeTeX] Spaces are lost in font names

Will Robertson wspr81 at gmail.com
Sun Jun 24 13:34:32 CEST 2007


Hi Sivan,

Nice to see you here :)
Your 2000 TUGboat paper was a great inspiration for me when I first  
started getting into rich fonts in Mac OS X and XeTeX.

On 24/06/2007, at 20:26 , Sivan Toledo wrote:

> It seems that spaces are truncated in font names. I don't have a  
> problem with things like "Arial".
>
> Any help will be appreciated.

You're right, you need to explicitly mark up the spaces:

\documentclass{article}
\begin{document}
\DeclareFontFamily{U}{test}{}
\DeclareFontShape{U}{test}{m}{n}{<-> "Times\space New\space Roman" }{}
\fontencoding{U}\fontfamily{test}\selectfont test?
\end{document}

Frustrating, I know. You can get around the problem by passing the  
font name through a wrapper macro first, "freezing" the catcodes.  
Even this will work:

\newcommand\MyFontShape[6]{\DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6}}
\MyFontShape{U}{test}{m}{n}{<->"Times New Roman"}{}

> (why I am trying to use \DeclareFontShape with a weird encoding  
> rather rely on fontspec:

There is a new feature coming up in XeTeX 0.997 (or 0.998?) that is  
designed to solve the problem you're having here. You can get it  
through the SVN version of XeTeX. Here's an example (I haven't used  
it at all yet):

\XeTeXinterchartokenstate = 1
\XeTeXcharclass `\a 7
\XeTeXcharclass `\A 8
\XeTeXinterchartoks 7 8 = {\itshape}
\XeTeXinterchartoks 8 7 = {\upshape}
aAa

This will typeset "A" in italic. I'm assuming (perhaps  
optimistically) that someone will create a bit of a LaTeX package to  
provide a user-friendly wrapper for this. I'd love to myself but I'm  
already overextended.

Hope this helps,
Will




More information about the XeTeX mailing list