summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbpotter <rbpotter@chromium.org>2017-07-26 16:42:26 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-07-27 00:02:33 +0000
commit663e02dfadabb0b7e1049cc7a9a8fe11a0f5bed7 (patch)
tree2eafc929863bcdae650f7a92a29cd4dc7bff120f
parent6ba39e8a2f79b9ccfe8d3aeed3eeb4871c13520e (diff)
downloadpdfium-663e02dfadabb0b7e1049cc7a9a8fe11a0f5bed7.tar.xz
Text Driver: add CLRF characters for new lines
CLRF characters seem to still work with label printer drivers, and some users want to preserve these characters when printing. We cannot distinguish new lines due to CLRF characters in the original text from new lines created during layout, so just add the characters to all new lines. Bug: chromium:734850 Change-Id: I4d032a311c33e20a27b2cc1d5d0ba3eb9ef2fd41 Reviewed-on: https://pdfium-review.googlesource.com/9110 Commit-Queue: Rebekah Potter <rbpotter@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fxge/win32/fx_win32_print.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index cae3859406..23c7c0e30c 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -611,13 +611,14 @@ bool CTextOnlyPrinterDriver::DrawDeviceText(int nChars,
CFX_WideString wsText;
int totalLength = nChars;
- // Detect new lines and add a space. Was likely removed by SkPDF if this is
- // just text, and spaces seem to be ignored by label printers that use this
- // driver.
+ // Detect new lines and add clrf characters (since this is Windows only).
+ // These characters are removed by SkPDF, but the new line information is
+ // preserved in the text location. clrf characters seem to be ignored by
+ // label printers that use this driver.
if (m_SetOrigin &&
FXSYS_round(m_OriginY) != FXSYS_round(pObject2Device->f * kScaleFactor)) {
- wsText += L" ";
- totalLength++;
+ wsText += L"\r\n";
+ totalLength += 2;
}
m_OriginY = pObject2Device->f * kScaleFactor;
m_SetOrigin = true;