[DF-4762] Improve BiDi transformation for multiline text.