summaryrefslogtreecommitdiffstats
path: root/src/gui/embedded
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2009-10-22 10:28:27 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2009-10-23 14:08:58 (GMT)
commit04d18b38c38c5ff623b30366ea08d56128b9b7d0 (patch)
tree01a551d66ddfc77084bf55ed9f6942661d528f45 /src/gui/embedded
parent37dc859e7e2e0f135e4c40bc7f6f824fcdb21e86 (diff)
downloadQt-04d18b38c38c5ff623b30366ea08d56128b9b7d0.zip
Qt-04d18b38c38c5ff623b30366ea08d56128b9b7d0.tar.gz
Qt-04d18b38c38c5ff623b30366ea08d56128b9b7d0.tar.bz2
Line spacing fixes
QTextEdit (via QTextLayout) and QPlainTextEdit in Qt used to ignore any font leading but added one extra pixel in QFontMetrics. With many freetype fonts, this resulted in a "spacy" text layout. The necessary fixes on X11 and Windows were to take (positive) leading into account, to make the font database convert point sizes to pixel sizes without rounding to plain integer values, and to subtract the extra pixel from QFontMetrics from the font engines' descent value. The change also fixes several places in styles and widgets, where QFontMetrics::lineSpacing() was wrongly used instead of QFontMetrics::height(). Ideally we should also handle negative leading, which would require additional and bigger code changes in QTextLayout and QPlainTextEdit. In addition, all other editors we have tested seem to ignore leading on X11. If we choose to believe the values provided by freetype, our text layout would be one pixel smaller than everybody else's. On the Mac, this change does nothing. There our layout is still too spacy, and for smaller fonts quite ugly compared to native Mac applications. Done with mae. Reviewed-by: mae
Diffstat (limited to 'src/gui/embedded')
-rw-r--r--src/gui/embedded/qdecorationdefault_qws.cpp2
-rw-r--r--src/gui/embedded/qdecorationwindows_qws.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/embedded/qdecorationdefault_qws.cpp b/src/gui/embedded/qdecorationdefault_qws.cpp
index 5bc8826..70389d3 100644
--- a/src/gui/embedded/qdecorationdefault_qws.cpp
+++ b/src/gui/embedded/qdecorationdefault_qws.cpp
@@ -394,7 +394,7 @@ QPixmap QDecorationDefault::pixmapFor(const QWidget *widget,
*/
int QDecorationDefault::titleBarHeight(const QWidget *)
{
- return qMax(20, QApplication::fontMetrics().lineSpacing() + BORDER_WIDTH);
+ return qMax(20, QApplication::fontMetrics().height() + BORDER_WIDTH);
}
/*!
diff --git a/src/gui/embedded/qdecorationwindows_qws.cpp b/src/gui/embedded/qdecorationwindows_qws.cpp
index 77393cf..7764ca5 100644
--- a/src/gui/embedded/qdecorationwindows_qws.cpp
+++ b/src/gui/embedded/qdecorationwindows_qws.cpp
@@ -216,7 +216,7 @@ QRegion QDecorationWindows::region(const QWidget *widget, const QRect &rect, int
bool hasMinimize = flags & Qt::WindowMinimizeButtonHint;
bool hasMaximize = flags & Qt::WindowMaximizeButtonHint;
const QFontMetrics fontMetrics = QApplication::fontMetrics();
- int titleHeight = hasTitle ? qMax(20, fontMetrics.lineSpacing()) : 0;
+ int titleHeight = hasTitle ? qMax(20, fontMetrics.height()) : 0;
int state = widget->windowState();
bool isMinimized = state & Qt::WindowMinimized;
bool isMaximized = state & Qt::WindowMaximized;