diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-09-09 12:27:18 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-09-09 12:38:28 (GMT) |
commit | d6993e7d88750a55d62bf5acbe7e7d03069dfbdf (patch) | |
tree | 6d5abd938d42639ba5d8ad0b70c34eb40f2efd3f /src/gui/painting/qprintengine_win.cpp | |
parent | 8cb263eeaffa2948477a8b3a1c8512f94ec9bb0b (diff) | |
download | Qt-d6993e7d88750a55d62bf5acbe7e7d03069dfbdf.zip Qt-d6993e7d88750a55d62bf5acbe7e7d03069dfbdf.tar.gz Qt-d6993e7d88750a55d62bf5acbe7e7d03069dfbdf.tar.bz2 |
Avoid garbled output on Windows for non-ascii-compatible text
In the Windows print engine, we try to send a text item as a raw string
of characters to the printer driver if this is possible. This is to
facilitate using PDF-printers as much as possible, allowing them to
save the text in the document so for searching etc. We can only safely
do this if all the characters in the string are ASCII-compatible, i.e.
in the 7 bit range, since this is the only part of the set which is
guaranteed to be compatible across code pages.
Task-number: 180655
Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting/qprintengine_win.cpp')
-rw-r--r-- | src/gui/painting/qprintengine_win.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index d239581..96e8cff 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -400,11 +400,11 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem return ; } - // We only want to convert the glyphs to text if the entire string is latin1 - bool latin1String = true; + // We only want to convert the glyphs to text if the entire string is compatible with ASCII + bool convertToText = true; for (int i=0; i < ti.num_chars; ++i) { - if (ti.chars[i].unicode() >= 0x100) { - latin1String = false; + if (ti.chars[i].unicode() >= 0x80) { + convertToText = false; break; } } @@ -414,7 +414,7 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem SelectObject(d->hdc, CreatePen(PS_SOLID, 1, cf)); SetTextColor(d->hdc, cf); - draw_text_item_win(p, ti, d->hdc, latin1String, d->matrix, d->devPaperRect.topLeft()); + draw_text_item_win(p, ti, d->hdc, convertToText, d->matrix, d->devPaperRect.topLeft()); DeleteObject(SelectObject(d->hdc,GetStockObject(HOLLOW_BRUSH))); DeleteObject(SelectObject(d->hdc,GetStockObject(BLACK_PEN))); } |