diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-15 12:56:53 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-01-15 12:56:53 (GMT) |
commit | 4c9e8b781eca47d6cfde686b360e447f620898fd (patch) | |
tree | dfa64f0f72f9fc276cd04213795bff01c7f87068 | |
parent | a0e8b661ee3278426437a61e2b1949690526cc5f (diff) | |
parent | 001ebdf49623641048122189d81cdbfe70652a52 (diff) | |
download | Qt-4c9e8b781eca47d6cfde686b360e447f620898fd.zip Qt-4c9e8b781eca47d6cfde686b360e447f620898fd.tar.gz Qt-4c9e8b781eca47d6cfde686b360e447f620898fd.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Clarify the docs slightly for QPainter::beginNativePainting().
Fixed the encoding of the Tile and Creator tags in the PDF engine.
-rw-r--r-- | src/gui/painting/qpainter.cpp | 17 | ||||
-rw-r--r-- | src/gui/painting/qprintengine_pdf.cpp | 26 |
2 files changed, 29 insertions, 14 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a98ac10..a9dcea0 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1984,9 +1984,14 @@ QPaintEngine *QPainter::paintEngine() const /*! \since 4.6 - Flushes the painting pipeline and prepares for the user issuing - commands directly to the underlying graphics context. Must be - followed by a call to endNativePainting(). + Flushes the painting pipeline and prepares for the user issuing commands + directly to the underlying graphics context. Must be followed by a call to + endNativePainting(). + + Note that only the states the underlying paint engine changes will be reset + to their respective default states. If, for example, the OpenGL polygon + mode is changed by the user inside a beginNativePaint()/endNativePainting() + block, it will not be reset to the default state by endNativePainting(). Here is an example that shows intermixing of painter commands and raw OpenGL commands: @@ -2010,9 +2015,9 @@ void QPainter::beginNativePainting() /*! \since 4.6 - Restores the painter after manually issuing native painting commands. - Lets the painter restore any native state that it relies on before - calling any other painter commands. + Restores the painter after manually issuing native painting commands. Lets + the painter restore any native state that it relies on before calling any + other painter commands. \sa beginNativePainting() */ diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index e3a2461..b8bf15e 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -931,14 +931,24 @@ void QPdfEnginePrivate::writeHeader() void QPdfEnginePrivate::writeInfo() { info = addXrefEntry(-1); - xprintf("<<\n" - "/Title (%s)\n" -// "/Author (%s)\n" - "/Creator (%s)\n" - "/Producer (Qt " QT_VERSION_STR " (C) 2009 Nokia Corporation and/or its subsidiary(-ies))\n", - title.toUtf8().constData(), -// author.toUtf8().constData(), - creator.toUtf8().constData()); + + // The 'text string' type in PDF is encoded either as PDFDocEncoding, or + // Unicode UTF-16 with a Unicode byte order mark as the first character + // (0xfeff), with the high-order byte first. + QByteArray array("<<\n/Title (\xfe\xff"); + const ushort *utf16Title = title.utf16(); + for (int i=0; i < title.size(); ++i) { + array.append((*(utf16Title + i)) >> 8); + array.append((*(utf16Title + i)) & 0xff); + } + array.append(")\n/Creator (\xfe\xff"); + const ushort *utf16Creator = creator.utf16(); + for (int i=0; i < creator.size(); ++i) { + array.append((*(utf16Creator + i)) >> 8); + array.append((*(utf16Creator + i)) & 0xff); + } + array.append(")\n/Producer (Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies))\n"); + write(array); QDateTime now = QDateTime::currentDateTime().toUTC(); QTime t = now.time(); |