[XeTeX] Detect, whether a font contains a certain character
Heiko Oberdiek
heiko.oberdiek at googlemail.com
Mon Nov 28 09:06:12 CET 2011
On Mon, Nov 28, 2011 at 07:19:48AM +0000, Jonathan Kew wrote:
> On 28 Nov 2011, at 06:59, Heiko Oberdiek wrote:
>
> > On Mon, Nov 28, 2011 at 03:07:07PM +1030, Andrew Moschou wrote:
> >
> >> 2011/11/28 Zdenek Wagner <zdenek.wagner at gmail.com>
> >>
> >>> Put it into an \hbox and measure its width (\wd). If the width is
> >>> zero, the glyph does not exist.
> >>>
> >>
> >> If the required glyph doesn't exist, wouldn't this measure the ".notdef"
> >> glyph?
> >
> > No,
>
> Yes, it would (and .notdef may of course have non-zero width).
\catcode`\{=1
\catcode`\}=2
\catcode`\^=7
\showboxdepth=10000
\showboxbreadth=10000
\tracingonline=1
\font\rm=cmr10\relax
\rm
\setbox0=\hbox{\kern1pt^^^^018e}
\showbox0
\csname @@end\endcsname\end
And where is the inserted ".notdef" glyph?
> > the problem is rather that a existing glyph can have width zero
> > (not likely in your case) and that there is a warning in the .log file.
> > See my examples.
>
> Assuming the OP is interested in "native" truetype/opentype fonts, not .tfm-based fonts, \XeTeXcharglyph is the simple answer.
In case of \ifnum\XeTeXfonttype>0 there is a better test.
Or what do you suggest for a general test of glyph existence?
Yours sincerely
Heiko Oberdiek
More information about the XeTeX
mailing list