RTL/Arabic support

Rebased and squashed version of #2056. @abdoosh00, can you confirm that this looks correct?