Feature tab alignments infrastructure

This branch contains the bulk of the infrastructure needed for implementing the tabstop alignment feature. In doing so, it also fixes the problem with tab ordering being incorrect for right-to-left text (hence the separate pull request).

Could probably do with some more testing and tidying up of commented-out blocks of code before merging...