[XeTeX] On cross-language font selection

Jjgod Jiang gzjjgod at gmail.com
Wed Feb 14 05:48:22 CET 2007

Hi all,

Since the TeXLive integration has been done now, I think we may got
more time on improvements to XeTeX itself. So, I would like to propose
a new way to do cross-language font selection. As we have been talk
some time ago [1], currently, if we want to mix different languages in
XeTeX and try to use different fonts for them is just a pain, for

<some Chinese text> <some English text> <some Chinese text>
<some English text> ... <some Chinese text>

We have to change the font regularly, definitely not very convenient.

Basically we could have some solutions to it:

1) Use a preprocess script to insert font switching commands
automatically, that's what I've been doing, a preprocess script for
Chinese is in [2].

2) Try to use TeX macros to define different fonts for different
characters, it could hardly been done for Chinese, since it has tens
of thousands of characters.

3) Create a (native) virtual font scheme.

4) Something I'm going to talk about in this mail.

First of all, I think we could introduce a new concept call "font
selection scheme" into XeTeX, which, basically, is a list of rules:

0       - 128    : Latin Modern     % ASCII characters
0x4e00  - 0x9fbb : Adobe Song Std   % CJK Unified Ideographs
0x20000 - 0x2a6d6: Sun-ExtB         % CJK Unified Ideographs Extension B

(When we record those rules in memory, we can use Unicode as ranges,
but when specifying them, we may use symbolic ranges like "CJK Unified
Ideographs" or "Fullwidth Latin Characters")

Then we can introduce a new primitive to XeTeX, called \scheme, to define
rules like this:

\scheme\MixLMandSong{Latin: Latin Modern,
                     CJK Unified Ideographs: Adobe Song Std,
                     CJK Unified Ideographs Extension B: Sun-ExtB}

So that we could use \MixLMandSong command to switch to this selection
scheme or use another command to switch another, it should follow the
grouping theory of TeX, like:

\RulesTableOne blahblah.. {\RulesTableTwo blahblah..} blahblah..

Any comments?

[1]: http://tug.org/pipermail/xetex/2006-May/003428.html
[2]: http://code.google.com/p/xcp/

More information about the XeTeX mailing list