[XeTeX] anti-xunicode ;-)

Firmicus firmicus at ankabut.net
Fri Jul 21 00:49:13 CEST 2006


Hello again,

I am rapidly getting addicted to XeTeX :-) ...

I want to continue using UTF-8 input encoding even when certain glyphs 
(basically characters with diacritics from the LATIN-EXTENDED-ADDITIONAL 
block, which I need to transliterate Oriental languages) are not present 
in the font used to typeset the document. To do so I make those UTF-8 
characters \active and define a macro that checks whether the glyph is 
available in the font, in which case it retrieves it, else it calls 
another macro to compose the diacritics as in traditional LaTeX. So yes, 
this is indeed the reverse idea of the xunicode package. I wrote a 
little package of no great sophistication for my own use, which I called 
xdiacomp (for DIAcritic COMPosition). Here are a few extracts to provide 
the general idea (cf attachment for the full version):

[...]
% various definitions of accents and diacritics
\gdef\textsubbreve#1{\hmode at bgroup\o at lign{\relax#1\crcr\hidewidth
 \vbox to.2ex{\hbox{\ifnum\fontdimen1\font=0 %
 \kern-0.0em\else\kern-0.40em\fi\ifnum\XeTeXcharglyph"02D8 > 
0\char"02D8\relax%
 \else\fontencoding{T1}\selectfont\char8\fi}\vss}\hidewidth}}
%this used to be set with $\lhook$, but the tipa glyph is better i think:
\newcommand{\ain}{\raisebox{.8ex}{\fontencoding{T3}\fontfamily{ptm}\selectfont\char21}}
[...]
% now we redefine the catcodes
\catcode `ḍ = \active
\catcode `ḫ = \active
[...]
%and we associate those with the following macros:
\def ḍ{\ifnum\XeTeXcharglyph"1E0D > 0\char"1E0D\relax\else{\d d}\fi}%
\def ḫ{\ifnum\XeTeXcharglyph"1E2B > 0\char"1E2B\relax\else{\textsubbreve 
h}\fi}%
\def ʿ{\ifnum\XeTeXcharglyph"02BF > 0\char"02BF\relax\else{\ain}\fi}%
[...]

Now come my questions:

(1) Is this a sound way to solve the problem I face? If yes, would it 
make sense to extend my package to cover a range of characters with 
diacritics that many OT fonts are likely to lack, but which are easily 
composable by TeX macros? Note that if a glyph is actually present in 
the current font, it will be used instead of the TeX composition. What I 
propose may in some way be a little bit sinful (from a pure 
Unicode/OpenType perspective), but at least it tries to minimize those 
little sins... ;-)

(2) My package (xdiacomp.sty) is incompatible with xunidode.sty, which 
is quite logical since it represents its absolute antipode. Yet there 
might be situations where a user would need to use both packages. For 
instance since I type ṭ (t with dot below) very often and have defined a 
keyboard shortcut for it (RIGHTALT-t), this character is always input 
directly as UTF-8 in my LaTeX files. But for seldom-used characters I 
might prefer to type, say, \textrangle or \textrightarrow rather than 
spend time to input them as UTF-8 by whatever means... I tried with 
\UndeclareUTFcharacter ... but it does not seem to work. Can someone 
help on this? Does it actually make any sense to attempt making the two 
packages compatible?

Thanks
François


PS: To follow-up on a recent message of mine, I have now pretty much 
succeeded in implementing a fully-featured ArabTeX-like user interface 
for XeTeX by means of TECkit font mappings. More on this very soon!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/xetex/attachments/20060721/1969c649/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdiacomp.sty
Type: text/x-tex
Size: 3976 bytes
Desc: not available
Url : http://tug.org/pipermail/xetex/attachments/20060721/1969c649/attachment-0001.bin 


More information about the XeTeX mailing list