summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2013-07-04 10:34:16 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-05 13:37:22 +0200
commita4478b28966c5f630ba3d93b97bc91a3cec2fdbe (patch)
tree7b000b23a6eda489d7a0bcfcef9f3b8963f0ec95 /src/gui/painting
parent6d8f7a8d34906187c834e948b3ccd12a92fcccaa (diff)
REG: Fix character size when exporting PDF on Windows
In Qt 4, there was a special case in qpdf.cpp which would use the tmHeight from TEXTMETRIC to calculate the height of the text instead of the pixel size. This was removed when all code inside Q_WS_WIN was removed from QtGui. The tmHeight is defined to be the same as ascent + descent, so we reinsert this code for Windows. It could be that this code is okay cross-platform, since the font height and the pixel size are supposed to be the same, though for some reason not on Windows. However, the safer approach is to #ifdef it for Windows, since the bug is not present on other platforms, and since it was #ifdef'd in Qt 4. Task-number: QTBUG-30875 Change-Id: If0817768bf0ca5ce216842119422a0be944df0bf Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpdf.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 345ebefea7..1ca54f0432 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -2518,6 +2518,10 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
qreal size = ti.fontEngine->fontDef.pixelSize;
+#if defined(Q_OS_WIN)
+ size = (ti.fontEngine->ascent() + ti.fontEngine->descent()).toReal();
+#endif
+
QVarLengthArray<glyph_t> glyphs;
QVarLengthArray<QFixedPoint> positions;
QTransform m = QTransform::fromTranslate(p.x(), p.y());