Denseman on the Rattis

Formerly known as the Widmann Blog

enITtypography

TECkit

Mixing three alphabetsAfter the Mac arrived last week, one of the first programs I installed was TeXShop.

That caused me to play around with XeTeX, which – although it’s also available for Linux – I had never really got around to playing around with.

One interesting feature I noticed immediately was the maps: When loading a font one can specify an input mapping like this: \setmainfont[Mapping=tex-text]{Gentium} and this will cause -- to be mapped to – etc.

I wanted to play around with this, but there didn’t seem to be an information on these maps included.

However, a bit of googling told me that it’s a SIL invention. On Linux/Unix, just download the source code and compile it, and on Windows and Mac, you can download precompiled programs.

Once that’s in place, you can start having fun!

As an example, create a map file with the following contents and call it firsttest.map:

LHSName	"FirstTest"
RHSName	"UNICODE"

pass(Unicode)

;Greek
U+0061    <>   U+03B1    ; a
U+0062    <>   U+03B2    ; b
U+0064    <>   U+03B4    ; d
U+0065    <>   U+03B5    ; e
U+0074    <>   U+03C4    ; t
U+0069    <>   U+03B9    ; i
;Cyrillic
U+0063    <>   U+0446    ; c
U+006C    <>   U+043B    ; l
U+006D    <>   U+043C    ; m
U+0067    <>   U+0433    ; g

Now compile it with teckit_compile firsttest.map, and you can now load it in XeTeX like this: \setmainfont[Mapping=firsttest]{Gentium}.

After doing this, anything typeset with the main font will come out in an interesting mixture of Latin, Greek and Cyrillic (see the illustration above).

This is of course a fairly silly example, but it can be really useful if you’re not comfortable typing another language directly, or if there is no keyboard layout available and you don’t want to define one yourself.

Leave a Reply

Your email address will not be published. Required fields are marked *