[Qt-interest] Display non printable characters in a QTextEdit/QPlainTextEdit

Atlant Schmidt aschmidt at dekaresearch.com
Tue Sep 6 13:11:56 CEST 2011


Timo:

(The following text is using the "Lucida Sans" face.)

I'm not sure I understand your question. What I think you're asking␍␊
is how to cause Qt to display text that looks like this, right?␍␊

(In case that didn't work for you, here's the same thing
set in Consolas”)

I'm not sure I understand your question. What I think you're asking␍␊
is how to cause Qt to display text that looks like this, right?␍␊

In this case, these two typefaces implement that section of
Unicode that contains glyphs that look to the human eye like
the names of the ASCII C0 control characters: ␀, ␁, ␂, ␃,
and so on. This section of Unicode is called “Control Pictures”;
see:

    http://unicode.org/charts/PDF/U2400.pdf


If you’re using a typeface (~font) that implements this section
of Unicode, then there’s no magic that needs to be done. If you’re
in your mode where you want to “display control characters”, then
just ensure that you emit the appropriate one of these glyphs for
each C0 control character that you’re trying to represent. All the
usual font metric magic will occur and everything should render fine.

If your typeface font DOESN’T contain these characters, then you could
dynamically switch to a face/font that does; quite a few acceptable
faces contain this Unicode section. Font metric should still generally
work “OK”.

Or you could always resort to the ugly old fall-back of representing
your controls as “<SOH>” or even “<^A>” ;-).

                                   Atlant


-----Original Message-----
From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Timo Falk
Sent: Tuesday, September 06, 2011 03:55
To: 'qt-interest at qt.nokia.com'
Subject: [Qt-interest] Display non printable characters in a QTextEdit/QPlainTextEdit

Hi!

I want to display non printable characters (eg. ASCII control chars  < 32)
like Notepad++ (the second step is to toggle the display...). After
browsing the qt source for a while, I think I have to deal with two
things:

1. the layout of (the) line
2. the rendering of the glyphs

But now I am totally lost in the darkness between QTextLayout,
QAbstractDocumentLayout, QTextEngine, etc...

Can anybody help me to sun againt? I have no idea what is the right point
to start.

Timo
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest


 Click https://www.mailcontrol.com/sr/8ry!7mFd3M!TndxI!oX7UpJAdpTSMUBqWaBqDecok5qgrhqdE5V9qRIe1v95RjzlovXkhiCN+o1TQ40Is2HDWw==  to report this email as spam.



  ________________________________
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110906/b73da74b/attachment.html 


More information about the Qt-interest-old mailing list