| 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, int destcp, const FX_CHAR* d
efchar) | 17 CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, const FX_CHAR* d
efchar) |
| 18 { | 18 { |
| 19 if (destcp == 0) { | 19 if (destcp == 0) { |
| 20 if (unicode < 0x80) { | 20 if (unicode < 0x80) { |
| 21 return CFX_ByteString((char)unicode); | 21 return CFX_ByteString((char)unicode); |
| 22 } | 22 } |
| 23 const FX_CHAR* altstr = FCS_GetAltStr(unicode); | 23 const FX_CHAR* altstr = FCS_GetAltStr(unicode); |
| 24 if (altstr) { | 24 if (altstr) { |
| 25 return CFX_ByteString(altstr, -1); | 25 return CFX_ByteString(altstr, -1); |
| 26 } | 26 } |
| 27 return CFX_ByteString(defchar, -1); | 27 return CFX_ByteString(defchar, -1); |
| 28 } | 28 } |
| 29 FX_BOOL bDef = FALSE; | |
| 30 char buf[10]; | 29 char buf[10]; |
| 31 int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 1
0, NULL, &bDef); | 30 int iDef = 0; |
| 32 if (ret && !bDef) { | 31 int ret = FXSYS_WideCharToMultiByte(destcp, 0, (wchar_t*)&unicode, 1, buf, 1
0, NULL, &iDef); |
| 32 if (ret && !iDef) { |
| 33 return CFX_ByteString(buf, ret); | 33 return CFX_ByteString(buf, ret); |
| 34 } | 34 } |
| 35 const FX_CHAR* altstr = FCS_GetAltStr(unicode); | 35 const FX_CHAR* altstr = FCS_GetAltStr(unicode); |
| 36 if (altstr) { | 36 if (altstr) { |
| 37 return CFX_ByteString(altstr, -1); | 37 return CFX_ByteString(altstr, -1); |
| 38 } | 38 } |
| 39 return CFX_ByteString(defchar, -1); | 39 return CFX_ByteString(defchar, -1); |
| 40 } | 40 } |
| 41 CTextPage::CTextPage() | 41 CTextPage::CTextPage() |
| 42 { | 42 { |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 { | 769 { |
| 770 buffer.EstimateSize(0, 10240); | 770 buffer.EstimateSize(0, 10240); |
| 771 CPDF_Page page; | 771 CPDF_Page page; |
| 772 page.Load(pDoc, pPage); | 772 page.Load(pDoc, pPage); |
| 773 CPDF_ParseOptions options; | 773 CPDF_ParseOptions options; |
| 774 options.m_bTextOnly = TRUE; | 774 options.m_bTextOnly = TRUE; |
| 775 options.m_bSeparateForm = FALSE; | 775 options.m_bSeparateForm = FALSE; |
| 776 page.ParseContent(&options); | 776 page.ParseContent(&options); |
| 777 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 777 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); |
| 778 } | 778 } |
| OLD | NEW |