# [XeTeX] Aggravating font deficiency, and a workaround

Ron Aaron ron at ronware.org
Tue Jul 27 20:03:55 CEST 2010

```On Tuesday 27 July 2010 20:41:46 talazem at fastmail.fm wrote:
> Hi Ron,
>
> Could you give a brief commentary, of what to replace and where, assuming we want to replace 'x' with 'y'?

Certainly!

The first part:

\catcode`X=\active

makes the letter "X" (in my case it was Unicode FB1D) "active"; in other words, just like a macro.

The next part:

\defX{...}

assigns an action to the now-active character "X".  When XeTeX sees that character in the input, it will call the macro you have written.

The inside of the macro:

\ifnum\XeTeXcharglyph"FB1D>0
\char"FB1D
\else
\char"05D9\char"05BC
\fi

tests to see if "X" is a valid glyph in the current font.  Substitute "FB1D for whatever the Unicode value of your specific character is.  I removed all spaces within my actual macro, because I was having problems with stray spaces being inserted.

If the glyph exists, then the character is simply output.  Otherwise, in my specific case, two other characters are output which should generate the same glyph, more or less.

If you need to, you can do overstriking or whatever else is necessary to generate the glyph if your font has nothing appropriate.

Best regards,
Ron

--
Sending me something private?
Use my GPG public key: AD29415D

```