[XeTeX] \XeTeXuseglyphmetrics (was Re: Re: [OS X TeX] gtamacfonts ligatures: PDF searchability)

Jonathan Kew jonathan_kew at sil.org
Wed May 17 20:25:56 CEST 2006


On 17 May 2006, at 5:36 pm, Bruno Voisin wrote:

> Having built version 0.991 recently, I was feeling adventurous  
> today and decided to give the newly added glyph metrics setting a  
> try. Searching through earlier messages I found the name  
> \XeTeXuseglyphmetrics in the quoted message, and the syntax  
> \XeTeXuseglyphmetrics=1 in the attachement xetex-sample2e.tex from  
> a more recent message "Rép : [XeTeX] Correct LaTeX-logo – how?"  
> from 7 May.
>
> Thus I tried putting \XeTeXuseglyphmetrics=1 in a XeLaTeX document,  
> before \begin{document}. Without it, here's what I get for example:
>
> <Image 2.png>
>
> <Image 8.png>
>
> And then with it:
>
> <Image 5.png>
>
> <Image 9.png>
>
> In the first case, the parentheses (entered through \left( and  
> \right)) are given a more appropriate size;

Nice.

> in the second case, the extra interline spacing added by the  
> presence of a superscript is made very very slightly smaller, but  
> not much.

Yes, very subtle!

> The fonts are a mixture of Hoefler Text for text and Lucida for maths.
>
> By contrast here's what I'm getting with Lucida only in pdfLaTeX:
>
> <Image 7.png>
>
> <Image 10.png>
>
> In this case, the superscript does not create any extra interline  
> space, and that's what I was hoping to reproduce in XeLaTeX.

There's a very significant difference between the Hoefler Text and  
Lucida that you're using here. In Lucida, the descender of the  
lowercase "p" is short enough that the lines can stay at their  
standard \baselineskip positions even with the superscript present;  
the Hoefler "p" is deeper. So XeTeX is (correctly) seeing that the  
bounding boxes of the lines would touch, and introducing \lineskip  
between them.

If you set \lineskip to 0pt (default is 1.0pt, I believe), then in a  
case where lines "touch", they'll be set with no extra space; to  
allow them to even "overlap" slightly, you'd have to set  
\lineskiplimit slightly negative.

So XeLaTeX is right, here, and your problem is that Hoefler Text  
glyphs are taller/deeper than Lucida, for a given point size;  
therefore, there's less scope for moving them up or down before line  
spacing starts to vary, with default LaTeX settings.

> Hence the question: what's the exact syntax of  
> \XeTeXuseglyphmetrics? Is it boolean, with only two values 0 for  
> false and 1 for true? Or is it like pdfTeX's \protcode, having  
> several values 0, 1 and 2 corresponding to the "intensity" with  
> which the correction is applied?

It is an integer parameter, so you could set it to any integer value  
(like TeX's \pausing, \tracingonline, etc), but there are only two  
states, "off" (if \XeTeXuseglyphmetrics <= 0) and "on" (if  
\XeTeXuseglyphmetrics > 0). So just go with 0 and 1.

> I did not notice any significant performance hit when using  
> \XeTeXuseglyphmetrics, by the way.

Good; I did some caching of metrics per font & glyph, so that the  
impact should be slight in normal use, unless your document uses an  
unusually varied collection of fonts and glyphs. In testing, I can  
measure a slow-down, but it's not much compared to other things (like  
the slowness of xdv2pdf!).

A question: should \XeTeXuseglyphmetrics=1 be set in xetex.fmt and  
xelatex.fmt as a default, do you think? If I add that to the standard  
format files, it will cause layout changes in existing documents  
where people have been (knowingly or unknowningly) setting "solid"  
text based on the old XeTeX font-wide metrics; the change might come  
as a surprise, and not always a welcome one. It could, of course, be  
corrected by adding \XeTeXuseglyphmetrics=0 to such documents, or by  
explicitly setting the line spacing desired rather than relying on  
that implicit in the font.

The alternative, of course, is to leave the feature off by default,  
and tell people to turn it on in their documents when they want it.  
Any thoughts?

JK



More information about the XeTeX mailing list