diff options
author | Dmitry Shachnev <mitya57@gmail.com> | 2013-02-22 09:57:42 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-22 10:26:17 (GMT) |
commit | 077a6573a880fccb013f3b96ac76ca9f7899a5a1 (patch) | |
tree | 2a49d3eeb80882fd5d72248c17ce2c359a6ca5a3 /src/gui | |
parent | ab0ed0dfcd0f47598761ab0c834dd47d8c9742cf (diff) | |
download | Qt-077a6573a880fccb013f3b96ac76ca9f7899a5a1.zip Qt-077a6573a880fccb013f3b96ac76ca9f7899a5a1.tar.gz Qt-077a6573a880fccb013f3b96ac76ca9f7899a5a1.tar.bz2 |
QPdfEnginePrivate: Fix invalid format for rectangles on some locales
This is done by using locale-independent QByteArray::setNum() instead
of qvsnprintf() for printing doubles.
Cherry-picked from qtbase c9ae652487514acd19f3631224ced7ac14f756c8.
Task-number: QTBUG-24949
Change-Id: Id0a6e9ad6a45d7e17dfcffd625891d68c00d516c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qprintengine_pdf.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index 7ad9de4..b2b928f 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -679,15 +679,19 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) trans.map(ti.width.toReal()/size, (ti.ascent.toReal()-ti.descent.toReal())/size, &x2, &y2); uint annot = addXrefEntry(-1); + QByteArray x1s, y1s, x2s, y2s; + x1s.setNum(static_cast<double>(x1), 'f'); + y1s.setNum(static_cast<double>(y1), 'f'); + x2s.setNum(static_cast<double>(x2), 'f'); + y2s.setNum(static_cast<double>(y2), 'f'); + QByteArray rectData = x1s + ' ' + y1s + ' ' + x2s + ' ' + y2s; + xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect ["); + xprintf(rectData.constData()); #ifdef Q_DEBUG_PDF_LINKS - xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect [%f %f %f %f]\n/Border [16 16 1]\n/A <<\n", + xprintf("]\n/Border [16 16 1]\n/A <<\n"); #else - xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect [%f %f %f %f]\n/Border [0 0 0]\n/A <<\n", + xprintf("]\n/Border [0 0 0]\n/A <<\n"); #endif - static_cast<double>(x1), - static_cast<double>(y1), - static_cast<double>(x2), - static_cast<double>(y2)); xprintf("/Type /Action\n/S /URI\n/URI (%s)\n", ti.charFormat.anchorHref().toLatin1().constData()); xprintf(">>\n>>\n"); |