[XeTeX] fontspec and hyperref

Jonathan Kew jfkthame at googlemail.com
Thu Sep 24 01:30:44 CEST 2009


On 23 Sep 2009, at 23:05, Michiel Kamermans wrote:

> Hi,
>
> I'm running into a problem using fontspec in combination with  
> hyperref, with the attached file.
>
> Using xetex 3.1415926-2.2-0.999.7 (MiKTeX 2.7), fontspec 2008/08/09  
> v1.18 and hyperref 2008/12/26 v6.78n I get the following error:
>
> >> Package hyperref Warning: Token not allowed in a PDF string  
> (PDFDocEncoding):
> >> (hyperref)                removing `\fontspec' on input line  
> 68/84/86/89.
>
> and then XeTeX goes into unrecoverable error mode because a low  
> level font definition does not exist...
>
> >>Running makemf...
> >>makemf: The KOZUKA MINCHO PRO R source file could not be found.

Looks like your font name has had \uppercase{} applied to it, and now  
fontspec can't find the font.

I think this will be fixed if you declare the fonts ahead of time,  
with something like

   \newfontfamily\mincho{Kozuka Mincho Pro R}
   \newfontfamily\palatino{Palatino Linotype}

and then just use \mincho and \palatino rather than \fontspec{.....}  
commands throughout your text. This is also more efficient, as it  
saves fontspec and xetex from repeating all the font lookup process  
every time you switch.

(It might be worth looking into the polyglossia package to manage  
language/script switching, but even without that, I think this should  
help.)

JK



More information about the XeTeX mailing list