diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2014-10-28 10:00:56 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@theqtcompany.com> | 2014-11-15 08:49:15 +0100 |
commit | 1ffe39dfd155c1318e249591c71e808437cc9696 (patch) | |
tree | 9d4b58906967789409827ed22e2cd084d1218765 /src/printsupport | |
parent | 2f1d22c8b4033b7160dde08ba232d22a620f8cd7 (diff) |
Make it possible to disable font embedding
When font embedding is explicitly disabled, fall back to painter paths
as we would if the font prohibits embedding. Note that this flag was
never respected on any platform in any version of Qt, as far as I've
been able to tell, because the handling of it in the X11 print
engine was removed shortly after it was introduced in 2005.
[ChangeLog][Printing] Disabling font embedding is now possible using
the QPrinter::setFontEmbedding() function.
Task-number: QTBUG-41943
Change-Id: Ice5e893f9893c5243310ae7892bec7497dd55c4a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/printsupport')
-rw-r--r-- | src/printsupport/kernel/qprintengine_win.cpp | 16 | ||||
-rw-r--r-- | src/printsupport/kernel/qprintengine_win_p.h | 4 | ||||
-rw-r--r-- | src/printsupport/kernel/qprinter.cpp | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 7f5e83c61e..4e0a3e0795 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -269,7 +269,8 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem bool fallBack = state->pen().brush().style() != Qt::SolidPattern || qAlpha(brushColor) != 0xff || d->txop >= QTransform::TxProject - || ti.fontEngine->type() != QFontEngine::Win; + || ti.fontEngine->type() != QFontEngine::Win + || !d->embed_fonts; if (!fallBack) { const QVariantMap userData = ti.fontEngine->userData().toMap(); @@ -1001,8 +1002,6 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & // The following keys are settings that are unsupported by the Windows PrintEngine case PPK_CustomBase: break; - case PPK_FontEmbedding: - break; case PPK_PageOrder: break; case PPK_PrinterProgram: @@ -1011,6 +1010,10 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & break; // The following keys are properties and settings that are supported by the Windows PrintEngine + case PPK_FontEmbedding: + d->embed_fonts = value.toBool(); + break; + case PPK_CollateCopies: { if (!d->devMode) @@ -1282,9 +1285,6 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const // The following keys are settings that are unsupported by the Windows PrintEngine // Return sensible default values to ensure consistent behavior across platforms - case PPK_FontEmbedding: - value = false; - break; case PPK_PageOrder: value = QPrinter::FirstPageFirst; break; @@ -1296,6 +1296,10 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const break; // The following keys are properties and settings that are supported by the Windows PrintEngine + case PPK_FontEmbedding: + value = d->embed_fonts; + break; + case PPK_CollateCopies: value = d->devMode->dmCollate == DMCOLLATE_TRUE; break; diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h index b84bde8a92..0a87795bb8 100644 --- a/src/printsupport/kernel/qprintengine_win_p.h +++ b/src/printsupport/kernel/qprintengine_win_p.h @@ -125,7 +125,8 @@ public: m_pageLayout(QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0, 0, 0, 0))), num_copies(1), printToFile(false), - reinit(false) + reinit(false), + embed_fonts(true) { } @@ -216,6 +217,7 @@ public: uint has_pen : 1; uint has_brush : 1; uint has_custom_paper_size : 1; + uint embed_fonts : 1; uint txop; diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index c13b1574d0..437a68e609 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -1632,8 +1632,6 @@ QPrinter::PaperSource QPrinter::paperSource() const Enabled or disables font embedding depending on \a enable. - Currently this option is only supported on X11. - \sa fontEmbeddingEnabled() */ void QPrinter::setFontEmbeddingEnabled(bool enable) @@ -1647,8 +1645,6 @@ void QPrinter::setFontEmbeddingEnabled(bool enable) Returns \c true if font embedding is enabled. - Currently this option is only supported on X11. - \sa setFontEmbeddingEnabled() */ bool QPrinter::fontEmbeddingEnabled() const |