Fun with XeTeX: Colouring Arabic glyphs

Pre-processing Arabic text

Just a quick example of colouring Arabic glyphs via the XeTeX engine (XeLaTeX) using a pre-processor written in C (via FreeType and libotf). The glyph paths were obtained via FreeType and written out as TeX files that used XeTeX (i.e., xdvipdfmx) specials (\special{pdf: content...}) to draw the glyphs, taking care to close paths when FreeType’s FT_Outline_Decompose(...) function emits a moveto. It is a relatively straightforward exercise to extend this to fully-shaped Arabic using a (home-grown) context-analysis/shaping engine. I’ll post some examples and code.

Download PDF