View Full Version : Spaces in QTextEdit

22nd June 2009, 02:22

I'm trying to get a thin space that is the same (relative) width in a variety of different fonts so that when I format and markup a document (using spaces and thin spaces) and then change the font, the formatting isn't all messed up. Ideally, I would like a space that is always 1/4 of the width of a normal space in every font, but unicode doesn't seem to support such a space. Thin space, et. al. in unicode all have drastically different widths depending on the fonts used. Is there any way in a QTextEdit to insert a space of a specified number of pixels? Any other ideas? Thanks.

22nd June 2009, 08:53
Your issue sounds very specialized - perhaps you need to write your own rendering widget.

For the text edit, try adding a white image between each word and specify a width. You can add images using pseudo-html.

22nd June 2009, 19:28
Unicode supports spaces with different widths (http://en.wikipedia.org/wiki/Space_(punctuation)). Another question is if the font of QTextEdit will handle them correctly.