[XeTeX] Anomalies in using feature-enabled OT fonts

Khaled Hosny khaledhosny at eglug.org
Sat Nov 20 13:42:14 CET 2010


On Sat, Nov 20, 2010 at 06:15:11PM +0900, Takayuki YATO (ZR) wrote:
> 2. \fontcharwd / \fontcharht / \fontchardp
> 
>   It seems that when \fontcharwd etc. are used with feature-enabled
>   fonts XeTeX seems to report the metric value in the original font
>   (before the feature is applied). This behavior is against the
>   specification of these commands.
> 
> % plain XeTeX
> \def\measure#1{%
>   #1 % print the character
>   \immediate\write16{% output to terminal
>     <#1>:
>     wd=\the\fontcharwd\font`#1\space\space/
>     ht=\the\fontcharht\font`#1\space\space/
>     dp=\the\fontchardp\font`#1}}
> \font\tgpNorm="TeX Gyre Pagella"       % default
> \font\tgpSmcp="TeX Gyre Pagella:+smcp" % small-caps
> % There two lines should not report the same measurement....
> \tgpNorm\measure{a}\measure{f}\measure{g}
> \tgpSmcp\measure{a}\measure{f}\measure{g}
> \bye
> 
>   Compiling this source writes to terminal:
> 
> <a>: wd=5.0pt / ht=4.69pt / dp=0.0pt
> <f>: wd=3.33pt / ht=7.0pt / dp=0.0pt
> <g>: wd=5.56pt / ht=4.69pt / dp=2.83pt
> <a>: wd=5.0pt / ht=4.69pt / dp=0.0pt
> <f>: wd=3.33pt / ht=7.0pt / dp=0.0pt
> <g>: wd=5.56pt / ht=4.69pt / dp=2.83pt
> 
>   Here the values appearing on last three lines are totally
>   inappropriate as for small-caps glyphs, whereas the typeset
>   result shows actually small-caps glyphs.

But `a will always resolve too 97, so in all cases you are asking for
the metrics of the glyph at 97 slot of the font; the meaning of `a is
font independent (will, I don't know the exact terms, some TeX guru
would explain better).

> 3. \XeTeXcharglyph
> 
>   The same issue as described in 2 applies to \XeTeXcharglyph.
>   Because the command is specific to XeTeX, this behavior could
>   be declared to be right. Buy anyway it would be nice if there
>   is a way to get the right value for feature-enabled fonts.
> 
> % plain XeTeX
> \def\report#1{%
>   \char#1\ 
>   \immediate\write16{\the\XeTeXcharglyph#1}}
> \font\ixmNorm="IPAexMincho:script=latn"       % default
> \font\ixmSups="IPAexMincho:script=latn;+sups" % superscript
> % C should be equal to B, not A.
> \ixmNorm \report{"32}% A  (U+0032:DIGIT TWO)
> \ixmNorm \report{"B2}% B  (U+00B2:SUPERSCRIPT TWO)
> \ixmSups \report{"32}% C
> \bye
> 
>   Compiling this source writes to terminal:
> 
> 21
> 139
> 21

The same as the issue above, you are asking for the metrics of glyph at
slot "32 (50) which is the same regardless of the font feature applied.

IMO the only reliable way to check for a specific un-encoded glyph is
either by glyph id or glyph name, but both are very unportable.

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


More information about the XeTeX mailing list