| 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 "../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../third_party/base/nonstd_unique_ptr.h" |
| 8 #include "../../include/fpdfapi/fpdf_page.h" | 8 #include "../../include/fpdfapi/fpdf_page.h" |
| 9 #include "../../include/fpdfapi/fpdf_pageobj.h" | 9 #include "../../include/fpdfapi/fpdf_pageobj.h" |
| 10 #include "../../include/fpdfapi/fpdf_resource.h" | 10 #include "../../include/fpdfapi/fpdf_resource.h" |
| 11 #include "../../include/fpdftext/fpdf_text.h" | 11 #include "../../include/fpdftext/fpdf_text.h" |
| 12 #include "../../include/fxcrt/fx_arb.h" | 12 #include "../../include/fxcrt/fx_arb.h" |
| 13 #include "../../include/fxcrt/fx_ucd.h" | 13 #include "../../include/fxcrt/fx_ucd.h" |
| 14 #include "text_int.h" | 14 #include "text_int.h" |
| 15 #include "txtproc.h" | 15 #include "txtproc.h" |
| 16 | 16 |
| 17 CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, | 17 CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, |
| 18 int destcp, | 18 int destcp, |
| 19 const FX_CHAR* defchar) { | 19 const FX_CHAR* defchar) { |
| 20 if (destcp == 0) { | 20 if (destcp == 0) { |
| 21 if (unicode < 0x80) { | 21 if (unicode < 0x80) { |
| 22 return CFX_ByteString((char)unicode); | 22 return CFX_ByteString((char)unicode); |
| 23 } | 23 } |
| 24 const FX_CHAR* altstr = FCS_GetAltStr(unicode); | 24 const FX_CHAR* altstr = FCS_GetAltStr(unicode); |
| 25 if (altstr) { | 25 return CFX_ByteString(altstr ? altstr : defchar); |
| 26 return CFX_ByteString(altstr, -1); | |
| 27 } | |
| 28 return CFX_ByteString(defchar, -1); | |
| 29 } | 26 } |
| 30 char buf[10]; | 27 char buf[10]; |
| 31 int iDef = 0; | 28 int iDef = 0; |
| 32 int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 10, | 29 int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 10, |
| 33 NULL, &iDef); | 30 NULL, &iDef); |
| 34 if (ret && !iDef) { | 31 if (ret && !iDef) { |
| 35 return CFX_ByteString(buf, ret); | 32 return CFX_ByteString(buf, ret); |
| 36 } | 33 } |
| 37 const FX_CHAR* altstr = FCS_GetAltStr(unicode); | 34 const FX_CHAR* altstr = FCS_GetAltStr(unicode); |
| 38 if (altstr) { | 35 return CFX_ByteString(altstr ? altstr : defchar); |
| 39 return CFX_ByteString(altstr, -1); | |
| 40 } | |
| 41 return CFX_ByteString(defchar, -1); | |
| 42 } | 36 } |
| 43 CTextPage::CTextPage() {} | 37 CTextPage::CTextPage() {} |
| 44 CTextPage::~CTextPage() { | 38 CTextPage::~CTextPage() { |
| 45 int i; | 39 int i; |
| 46 for (i = 0; i < m_BaseLines.GetSize(); i++) { | 40 for (i = 0; i < m_BaseLines.GetSize(); i++) { |
| 47 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i); | 41 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i); |
| 48 delete pBaseLine; | 42 delete pBaseLine; |
| 49 } | 43 } |
| 50 for (i = 0; i < m_TextColumns.GetSize(); i++) { | 44 for (i = 0; i < m_TextColumns.GetSize(); i++) { |
| 51 CTextColumn* pTextColumn = (CTextColumn*)m_TextColumns.GetAt(i); | 45 CTextColumn* pTextColumn = (CTextColumn*)m_TextColumns.GetAt(i); |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 FX_DWORD flags) { | 783 FX_DWORD flags) { |
| 790 buffer.EstimateSize(0, 10240); | 784 buffer.EstimateSize(0, 10240); |
| 791 CPDF_Page page; | 785 CPDF_Page page; |
| 792 page.Load(pDoc, pPage); | 786 page.Load(pDoc, pPage); |
| 793 CPDF_ParseOptions options; | 787 CPDF_ParseOptions options; |
| 794 options.m_bTextOnly = TRUE; | 788 options.m_bTextOnly = TRUE; |
| 795 options.m_bSeparateForm = FALSE; | 789 options.m_bSeparateForm = FALSE; |
| 796 page.ParseContent(&options); | 790 page.ParseContent(&options); |
| 797 GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 791 GetTextStream_Unicode(buffer, &page, TRUE, NULL); |
| 798 } | 792 } |
| OLD | NEW |