From 49fa50d7e922746c02f7b70c8436466d7f62696a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 8 Jun 2018 15:31:10 +0000 Subject: Use FPDFText_GetBoundedText() to get the visible text in a test. Add a test PDF with multiple pages, each with a different media box and crop box. Demonstrate how FPDFText_GetText() gets all the text on the page, and how FPDFText_GetBoundedText() with the right bounding boxes gets only the visible text on the page. Also fix a small nit in CPDF_TextPage::GetTextByRect() found while writing this CL. BUG=pdfium:387 Change-Id: I9ce4bb181e2ba5b454ea1341bbccef9ba94c9cd8 Reviewed-on: https://pdfium-review.googlesource.com/34550 Commit-Queue: Ryan Harrison Reviewed-by: Ryan Harrison --- core/fpdftext/cpdf_textpage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index dae973bea9..60e574558b 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -446,9 +446,9 @@ WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const { IsAddLineFeed = false; if (charinfo.m_Unicode) strText += charinfo.m_Unicode; - } else if (charinfo.m_Unicode == 32) { - if (IsContainPreChar && charinfo.m_Unicode) { - strText += charinfo.m_Unicode; + } else if (charinfo.m_Unicode == L' ') { + if (IsContainPreChar) { + strText += L' '; IsContainPreChar = false; IsAddLineFeed = false; } -- cgit v1.2.3