[XeTeX] some odds-and-ends questions

Jonathan Kew jonathan_kew at sil.org
Wed Jan 19 10:30:34 CET 2005


Hi Will,

Some comments below:

On 19 Jan 2005, at 5:18 am, Will Robertson wrote:

> Hello!
>
> Regarding colour selection, I'm a little unsure of the link between  
> using specials (which can do cmyk and all sorts) and using the font  
> definition, e.g.:
>    \font\tenrm="Cochin:color=CC000099"
> (for transparent red).
>
> Am I right in saying that the former method is how it's done in  
> 'normal' TeX (and what the color package uses), and the latter method  
> comes from Mac OS X and avoids any troubles like the color package can  
> get into?

Color as part of the font definition seems a natural and useful  
approach, to me, but I realize it doesn't integrate as easily with  
existing packages.

The specials, if used, will override the color "inherent" in the font.  
The "x:textcolor" special with no color value will revert to the  
inherent font color.

Although the "color" special accepts colors specified as CMYK (or HSB,  
etc), they are currently all converted to RGB by the driver, and that's  
what goes to the PDF. This may change in future.

"Font color" can be more robust than "special color" if you're doing  
bidirectional text or other "tricky" things, where it may be difficult  
to tell exactly where the specials will end up relative to the  
rearranged text. With the specials, what gets colored will depend on  
the order things end up after the e-TeX output routine has reversed R-L  
text runs, whereas with font color specifications the color is inherent  
in the glyphs themselves.

> Next, I think my definition of the XeTeX logo is a little funny. I've  
> noticed in some cases it seems to have extra space preceding it. This  
> is what I had:
>
> \def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
>   \special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}}
> \def\XeTeX{\leavevmode
>   \setbox0=\hbox{X\lower.5ex\hbox{\kern-.15em\reflect{E}}\kern-.1667em  
> \TeX}%
>   \dp0=0pt\ht0=0pt\box0}
>
> Since I'm using LaTeX anyway, I edited it some to use \raisebox  
> instead of the primitive macros to set the height/depth to zero, and  
> the problem goes away:
>
> \def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
>   \special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}}
> \def\XeTeX{\raisebox{0pt}[0pt][0pt]{X\lower.5ex\hbox{\kern- 
> .15em\reflect{E}}\kern-.1667em \TeX}}

Yes, I've done a similar thing in a document recently, to prevent the  
logo disturbing the leading. Otherwise, if your font size is close to  
the baselineskip, it's likely that with the raised and lowered boxes  
(and XeTeX's version of their height and depth, based on overall font  
metrics rather than true glyph sizes), you'll get lineskip kicking in.


> Finally, I recall that XeTeX has no real knowledge of the height and  
> depth of a glyph. For example, \settoheight\xheight{...} of any  
> character in a font will give an incorrect number. Also, 1ex  
> (\fontdimen5) seems to be equal to 3.9998pt no matter which font is  
> chosen (in a 10pt document).

Right. Currently, XeTeX just stuffs some rather arbitrary values into  
the \fontdimens based on the ascent and descent of the font as reported  
by ATSUI, and the width of the space character.

> It occurs to me that users would probably like to be able to choose  
> fonts without having to worry about x-height difficulties (I, at  
> least, would always like the fonts in my document to have the same  
> x-heights). My package could do this easily, if I only were able to  
> find out how high the characters are. Any comments on whether this  
> would be appropriate?
>
> I'm sorry to burden you down with more and more feature requests,  
> Jonathan, but would you like to consider adding this to the list as  
> well? I'm less interested in the height of each character, but it  
> would be fantastic if you could hack in some support for a correct  
> value of \fontdimen5 if possible (at a pinch, simply by measuring the  
> height of an x, since I cannot).

It's very reasonable to want this sort of thing, and I hope to make  
some progress towards it. But what would we do about setting  
\fontdimen5 if the font doesn't even have an 'x'? Imagine a  
Devanagari-only font, for instance.

> As always, I'd prefer if you took your time so I can get some real  
> work done :)

No comment! :P

JK



More information about the XeTeX mailing list