[XeTeX] Bug in fontspec's \newfontfamily?

Will Robertson wspr81 at gmail.com
Sun May 24 12:50:03 CEST 2009


On 2009-05-24 17:35:01 +0930, Peter Dyballa 
<Peter_Dyballa at Web.DE> said:

> 
> Am 24.05.2009 um 07:54 schrieb Will Robertson:
> 
>> Not sure what you mean here?
> 
> The simple fact that a new font descriptor from a not infinite set  
> gets used up by \newfontface or \newfontfamily.

Which font descriptor are you referring to, exactly? Repetitive uses of 
\fontspec or \newfontface or \newfontfamily should never really cause a 
problem.

[snip]

> No, it's you! You are allocating some anonymous font descriptor. And  
> later you are again allocating an anonymous font descriptor. Both (or  
> more) times the same font is used, but there is no means to determine  
> in the programme exactly that it's the same font (at least it would  
> cost some measurable amount of time). Every time therefore a new font  
> descriptor (ID card) is issued. And because of this (large) amount of  
> font descriptors the output driver has no other choice than to embed  a 
> font for each font descriptor used. And by chance (really?) it  could 
> happen that it's x times the same font ...

I think this is basically incorrect. fontspec will only create new font 
families if different combinations of features are selected.

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\fontspec{TeX Gyre Pagella}
\csname f at family\endcsname\par
\fontspec[Numbers=OldStyle]{TeX Gyre Pagella}
\csname f at family\endcsname\par
\fontspec{TeX Gyre Pagella}
\csname f at family\endcsname
\end{document}

The *only* reason that \newfontfamily, etc., are recommended is to (a) 
improve the coding style of the user, and (b) improve the efficiency of 
the argument parsing code (probably negligibly).

Will




More information about the XeTeX mailing list