Fix alignment issues of Bi-Directional text.
The previous code broke after porting to Qt5, and alignment get messed up. This fixes that.
BUG: 346137 REVIEW: 126881