Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.2
-
None
-
Have only tested on OS X 10.6, Qt 4.6.2 (Cocoa), Windows/Linux not available to me
-
ef9e7168a8ed3e8149204cf6c604a38db35245c0
Description
The code below should display two lines of text with perfect vertical alignment, however the colored line is slightly longer.
It appears each time a color is changed the next character is spaced by an additional pixel.
#include <QtGui> #include <QtDebug> int main(int argv, char **args) { QApplication app(argv, args); QTextEdit textEdit; QFont fixedWidthFont("Courier"); textEdit.document()->setDefaultFont(fixedWidthFont); if (!textEdit.document()->defaultFont().fixedPitch()) qDebug() << textEdit.document()->defaultFont() << "not fixed pitch?!"; textEdit.show(); QTextCursor cursor = textEdit.textCursor(); cursor.insertText("...RGB..."); cursor.insertBlock(); QTextCharFormat format = cursor.charFormat(); format.setForeground(QColor(0, 0, 0)); cursor.insertText("...", format); format.setForeground(QColor(255, 0, 0)); cursor.insertText("R", format); format.setForeground(QColor(0, 255, 0)); cursor.insertText("G", format); format.setForeground(QColor(0, 0, 255)); cursor.insertText("B", format); format.setForeground(QColor(0, 0, 0)); cursor.insertText("...", format); return app.exec(); }
Attachments
Issue Links
- replaces
-
QTCREATORBUG-381 Cocoa: Fixed font rendering does not respect fixed size
- Closed