fix a text layout issue when using non-fixed-width font