From 663e02dfadabb0b7e1049cc7a9a8fe11a0f5bed7 Mon Sep 17 00:00:00 2001 From: rbpotter Date: Wed, 26 Jul 2017 16:42:26 -0700 Subject: 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 Reviewed-by: dsinclair Reviewed-by: Lei Zhang --- core/fxge/win32/fx_win32_print.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'core/fxge/win32/fx_win32_print.cpp') 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; -- cgit v1.2.3