OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/fpdfapi/fpdf_page.h" | 7 #include "../../include/fpdfapi/fpdf_page.h" |
8 #include "../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../include/fpdfapi/fpdf_pageobj.h" |
9 #include "../../include/fpdftext/fpdf_text.h" | 9 #include "../../include/fpdftext/fpdf_text.h" |
10 #include "txtproc.h" | 10 #include "txtproc.h" |
11 #include "text_int.h" | 11 #include "text_int.h" |
12 #if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) | |
13 extern FX_LPCSTR FCS_GetAltStr(FX_WCHAR); | 12 extern FX_LPCSTR FCS_GetAltStr(FX_WCHAR); |
14 CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defcha
r) | 13 CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defcha
r) |
15 { | 14 { |
16 if (destcp == 0) { | 15 if (destcp == 0) { |
17 if (unicode < 0x80) { | 16 if (unicode < 0x80) { |
18 return CFX_ByteString((char)unicode); | 17 return CFX_ByteString((char)unicode); |
19 } | 18 } |
20 FX_LPCSTR altstr = FCS_GetAltStr(unicode); | 19 FX_LPCSTR altstr = FCS_GetAltStr(unicode); |
21 if (altstr) { | 20 if (altstr) { |
22 return CFX_ByteString(altstr, -1); | 21 return CFX_ByteString(altstr, -1); |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 PDF_GetPageText_Unicode(wlines, pDoc, pPage, iMinWidth, flags); | 768 PDF_GetPageText_Unicode(wlines, pDoc, pPage, iMinWidth, flags); |
770 for (int i = 0; i < wlines.GetSize(); i ++) { | 769 for (int i = 0; i < wlines.GetSize(); i ++) { |
771 CFX_WideString wstr = wlines[i]; | 770 CFX_WideString wstr = wlines[i]; |
772 CFX_ByteString str; | 771 CFX_ByteString str; |
773 for (int c = 0; c < wstr.GetLength(); c ++) { | 772 for (int c = 0; c < wstr.GetLength(); c ++) { |
774 str += CharFromUnicodeAlt(wstr[c], FXSYS_GetACP(), "?"); | 773 str += CharFromUnicodeAlt(wstr[c], FXSYS_GetACP(), "?"); |
775 } | 774 } |
776 lines.Add(str); | 775 lines.Add(str); |
777 } | 776 } |
778 } | 777 } |
779 #endif | |
780 extern void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects
* pPage, FX_BOOL bUseLF, | 778 extern void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects
* pPage, FX_BOOL bUseLF, |
781 CFX_PtrArray* pObjArray); | 779 CFX_PtrArray* pObjArray); |
782 void PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_Document* pDoc, CPD
F_Dictionary* pPage, FX_DWORD flags) | 780 void PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_Document* pDoc, CPD
F_Dictionary* pPage, FX_DWORD flags) |
783 { | 781 { |
784 buffer.EstimateSize(0, 10240); | 782 buffer.EstimateSize(0, 10240); |
785 CPDF_Page page; | 783 CPDF_Page page; |
786 page.Load(pDoc, pPage); | 784 page.Load(pDoc, pPage); |
787 CPDF_ParseOptions options; | 785 CPDF_ParseOptions options; |
788 options.m_bTextOnly = TRUE; | 786 options.m_bTextOnly = TRUE; |
789 options.m_bSeparateForm = FALSE; | 787 options.m_bSeparateForm = FALSE; |
790 page.ParseContent(&options); | 788 page.ParseContent(&options); |
791 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 789 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); |
792 } | 790 } |
OLD | NEW |