[XeTeX] anti-xunicode ;-)

Ross Moore ross at ics.mq.edu.au
Fri Jul 21 01:12:51 CEST 2006


Hello François,

On 21/07/2006, at 8:49 AM, Firmicus wrote:

> 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):


> 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... ;-)

If you are only interested in the final appearance, then yes,
it's an OK thing to do.

> (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?

There is no incompatibility.
Just change the font-encoding away from the default of 'U',
whenever you encounter one of your active characters.

xunicode is setup so that accenting macros, such as \d ,
only provide the UTF8 code when the encoding is 'U'.
So if you switch to a different encoding, then you can
hook-in to a different way to compose glyphs for the
result that you wish to achieve.
This avoids falling into an infinite loop.

e.g. this is the easy part:
\catcode `ḍ = \active
\DeclareRobustCommand{ḍ}{%
   \ifnum\XeTeXcharglyph"1E0D > 0\char"1E0D\relax
   \else{\fontencoding{UX}\d d}\fi}%

You also need a declaration for how \d  works
with the 'UX' encoding.
If this is the same as for T1 or T3 then you could
just use those instead.

The macro programming required is not too tricky,
but does require making heavy use of the
\csname ... \endcsname  construction, and \expandafter .


>
> Thanks
> François
>

Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------




More information about the XeTeX mailing list