[XeTeX] How to use EC font encoding in XeTeX?

Taco Hoekwater taco at elvenkind.com
Sat Jun 10 11:14:35 CEST 2006

Jonathan Kew wrote:
> This cannot be solved at the TeX macro level, unless we were to build  
> format files with patterns loaded multiple times under different  
> \language codes, and then use these different codes according to the  
> font encoding chosen at runtime.

This is exactly what ConTeXt does (it has done so for quite a while now)
and in practice this works quite well. Pattern memory is virtually
unlimited and the 256 language codes TeX offers is more than enough
to load the patterns for each language two or three times if that is 
required by typical usage. A true solution it is not, but as a
workaround it is very reliable.

> It would be possible to extend TeX so as to support some kind of  
> mapping between the "character" codes in the text to be hyphenated  
> and the pattern codes; perhaps a new table \unicode, similar to  
> \lccode, could map font-encoded characters (in the text) to Unicode  
> values (in the hyphenation tables) on the fly. This could then be  
> changed at runtime to match the current font encoding. This would  
> need support from LaTeX/ConTeXt packages as well as an extension in  
> the program itself, though; I'm not sure it's the most worthwhile way  
> to invest effort.

I am working on precisely such an extension to the program. Instead
of the current line_break/hyphenation routines, it will do this:

   @<Insert all potential hyphenation points@>;
   @<Map characters to glyphs@>;
   @<Insert ligatures@>;
   @<Find optimal breakpoints@>;

The amount of required change is not small, but as a side-bonus it
greatly simplifies the structure of the linebreak handling code.
If you can wait a few months until my code is finished it could
be ported to XeTeX without too much trouble.

Cheers, Taco

More information about the XeTeX mailing list