From 3ddb2c325e832afc7deef7a48c130408130f0d9e Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 5 Apr 2016 16:52:11 -0700 Subject: Fix QPrinter PDF output using fonts with spaces in the PostScript name. Task-number: QTBUG-52352 Done-with: Andy Shaw Change-Id: Id8dcb4a57520c2cc53483672f6578e5ab0bb5de5 Reviewed-by: Lars Knoll --- src/gui/painting/qpdf.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gui/painting/qpdf.cpp') diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index d68d719c39..22a387bd28 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1556,6 +1556,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font) int toUnicode = requestObject(); QFontEngine::Properties properties = font->fontEngine->properties(); + QByteArray postscriptName = properties.postscriptName.replace(' ', '_'); { qreal scale = 1000/properties.emSquare.toReal(); @@ -1569,7 +1570,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font) s << (char)('A' + (tag % 26)); tag /= 26; } - s << '+' << properties.postscriptName << "\n" + s << '+' << postscriptName << "\n" "/Flags " << 4 << "\n" "/FontBBox [" << properties.boundingBox.x()*scale @@ -1612,7 +1613,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font) QPdf::ByteStream s(&cid); s << "<< /Type /Font\n" "/Subtype /CIDFontType2\n" - "/BaseFont /" << properties.postscriptName << "\n" + "/BaseFont /" << postscriptName << "\n" "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n" "/FontDescriptor " << fontDescriptor << "0 R\n" "/CIDToGIDMap /Identity\n" @@ -1636,7 +1637,7 @@ void QPdfEnginePrivate::embedFont(QFontSubset *font) QPdf::ByteStream s(&font); s << "<< /Type /Font\n" "/Subtype /Type0\n" - "/BaseFont /" << properties.postscriptName << "\n" + "/BaseFont /" << postscriptName << "\n" "/Encoding /Identity-H\n" "/DescendantFonts [" << cidfont << "0 R]\n" "/ToUnicode " << toUnicode << "0 R" -- cgit v1.2.3