Implementation of the Unicode BiDi algorithm