# ConTeXt + XeTeX (TeXLive 2012) does not work for Indic scripts like Malayalam

This is a follow up question to What is the state of support for (Unicode) Indic scripts in Context?

I have been trying to get texexec/mkii to work with XeTeX engine, but the resulting rendering is incorrect - reordering of Malayalam characters do not happen.

Running the following minimal example through XeLaTeX (version 3.1415926-2.5-0.9998 TeXLive 2012) gives correct output:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Script=Malayalam]{Rachana}
\begin{document}
മലയാളം \TeX ഉപയോഗിച്ച് ടൈപ്പ്സെറ്റ് ചെയ്തത്
\end{document}


Correct rendering screenshot here:

The same with ConTeXt "texexec --xetex" (version ConTeXt ver: 2012.05.30 11:26 MKII fmt: 2013.1.1 int: english/english) results in incorrect rendering.

\usemodule[simplefonts]
\setmainfont[Rachana]
\starttext
മലയാളം \TeX ഉപയോഗിച്ച് ടൈപ്പ്സെറ്റ് ചെയ്തത്
\stoptext


Incorrect rendering screenshot:

What possibly am I missing? The font used is Rachana, which can be found from Savannah download page (version 5.0.1)

• – Claudio Fiandrino Jan 3 '13 at 16:22
• Simplefonts module only works for MkIV. For xetex, you need to define typescripts using traditional methods. – Aditya Jan 4 '13 at 3:43
• @Aditya: Could you explain a little more or give a pointer on how to do that for Indic scripts? AFAIU, typescripts are using the .tfm font format rather than otf/ttf. – Rajeesh Jan 4 '13 at 5:37
• Documentation here wiki.contextgarden.net/TypeScripts says that typescripts will not work with XeTeX. I followed the guide here wiki.contextgarden.net/Fonts_in_XeTeX using 'definetypeface' and 'setupbodyfont' but the rendering is incorrect. – Rajeesh Jan 4 '13 at 8:25
• Look at type-*.mkii files in the distribution for examples of typescripts. To get correct rendering of indic scripts, you need to set up appropriate font features(the mapping=... part in the Typescripts page on the wiki), but I do not know what these font mappings are. The easiest way to proceed is to look at an xetex example in plain tex; that should work out of the box with xetex as well. Otherwise, post to the context mailing list where someone familiar with using indic scripts with xetex might be able to answer. – Aditya Jan 4 '13 at 14:05

You need to define a font feature set to specify font script, language or any other feature you want to use.

\usemodule[simplefonts]
\definefontfeature[malayalam][script=mlym]
\setmainfont[Rachana][features=malayalam]
\starttext
മലയാളം \TeX ഉപയോഗിച്ച് ടൈപ്പ്സെറ്
\stoptext


features=malayalam can be passed to typescripts as well, in place of features=default in the wiki. All features passed to \definefontfeature are in key value syntax, so instead of +liga;-kern in the raw XeTeX syntax, ConTeXt uses liga=yes,kern=no, but the tags are the same (no user friendly names as in fontspec).

• Thank you Khaled!!! Defining features indeed produce the correct rendering. – Rajeesh Apr 23 '13 at 19:49