[XeTeX] \XeTeXglyphbounds question

Jonathan Kew jfkthame at googlemail.com
Fri Feb 4 14:27:38 CET 2011


On 4 Feb 2011, at 05:41, Adam Twardoch (List) wrote:

> (Plain XeTeX, not XeLaTeX).
> 
> Imagine I use a font which uses contextual alternates such as:
> 
> 
> \font\samplefont = "Zapfino Extra LT Pro:+calt" at 72bp
> 
> \samplefont
> 
> \def \sampletext{finality}
> \XeTeXuseglyphmetrics=1
> 
> \setbox1 \hbox{\sampletext \/}
> 
> 
> So now, XeTeX has produced a box which has a series of glyph IDs. The
> left edge of the box is at the origin point of the "f" glyph. I want to
> add extra padding on the left through the use of
> 
> \XeTeXglyphbounds1
> 
> 
> I could use:
> \XeTeXcharglyph`f
> 
> but this only gives me the glyph ID of the *default* glyph for the "f"
> character. Yet since the font uses contextual alternates, I may end up
> having any alternate "f" there, depending on the contents of \sampletext
> 
> So: how do I find out which glyph ID is the first (or 2nd, or last, for
> that matter) in my box?

Unfortunately, I don't think there's currently any way to do that. (Well, no way within xetex, that is -- you could of course ship the box to the output file, then post-process that with a tool of some kind to determine the glyph ID, and then re-run the job using that information as input. But that's a terribly cumbersome way to get to where you're trying to go!)

It might be nice to have a command that could "look inside" boxes like that and tell you the glyph IDs.... but then you'll probably find yourself wanting their positions, too.... and then what if the contents of the box are more complex than just a series of glyphs? Figuring out a usable TeX-level interface to this could become awfully complex.......

JK




More information about the XeTeX mailing list