One of several things which specifically appealed to me about Papyrix is that it includes code specifically for rendering Arabic text! So how does it do so?
There's support routines for checking whether a character is in certain ranges, or branching over the char to decide on which side it joins with other chars.
There's a (redundant) support routine for decoding UTF-8 text & iterating over its chars.
1/2?