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>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2013-07-04 10:34:16 +02:00 committed by The Qt Project
parent 6d8f7a8d34
commit a4478b2896

View File

@ -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());