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_module.h" | 7 #include "../../../include/fpdfapi/fpdf_module.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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 CPDF_FontGlobals::~CPDF_FontGlobals() { | 31 CPDF_FontGlobals::~CPDF_FontGlobals() { |
32 ClearAll(); | 32 ClearAll(); |
33 FX_Free(m_pContrastRamps); | 33 FX_Free(m_pContrastRamps); |
34 } | 34 } |
35 class CFX_StockFontArray { | 35 class CFX_StockFontArray { |
36 public: | 36 public: |
37 CFX_StockFontArray() { | 37 CFX_StockFontArray() { |
38 FXSYS_memset(m_pStockFonts, 0, sizeof(m_pStockFonts)); | 38 FXSYS_memset(m_pStockFonts, 0, sizeof(m_pStockFonts)); |
39 } | 39 } |
40 ~CFX_StockFontArray() { | 40 ~CFX_StockFontArray() { |
41 for (int i = 0; i < FX_ArraySize(m_pStockFonts); i++) { | 41 for (size_t i = 0; i < FX_ArraySize(m_pStockFonts); i++) { |
42 if (!m_pStockFonts[i]) | 42 if (!m_pStockFonts[i]) |
43 continue; | 43 continue; |
44 CPDF_Dictionary* pFontDict = m_pStockFonts[i]->GetFontDict(); | 44 CPDF_Dictionary* pFontDict = m_pStockFonts[i]->GetFontDict(); |
45 if (pFontDict) | 45 if (pFontDict) |
46 pFontDict->Release(); | 46 pFontDict->Release(); |
47 delete m_pStockFonts[i]; | 47 delete m_pStockFonts[i]; |
48 } | 48 } |
49 } | 49 } |
50 CPDF_Font* GetFont(int index) const { | 50 CPDF_Font* GetFont(int index) const { |
51 if (index < 0 || index >= FX_ArraySize(m_pStockFonts)) | 51 if (index < 0 || index >= FX_ArraySize(m_pStockFonts)) |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 ch = 0; | 586 ch = 0; |
587 } | 587 } |
588 } | 588 } |
589 return result; | 589 return result; |
590 } | 590 } |
591 if (buf[0] == '(') { | 591 if (buf[0] == '(') { |
592 } | 592 } |
593 return result; | 593 return result; |
594 } | 594 } |
595 void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { | 595 void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { |
596 int CIDSet = 0; | 596 CIDSet cid_set = CIDSET_UNKNOWN; |
597 CPDF_StreamAcc stream; | 597 CPDF_StreamAcc stream; |
598 stream.LoadAllData(pStream, FALSE); | 598 stream.LoadAllData(pStream, FALSE); |
599 CPDF_SimpleParser parser(stream.GetData(), stream.GetSize()); | 599 CPDF_SimpleParser parser(stream.GetData(), stream.GetSize()); |
600 while (1) { | 600 while (1) { |
601 CFX_ByteStringC word = parser.GetWord(); | 601 CFX_ByteStringC word = parser.GetWord(); |
602 if (word.IsEmpty()) { | 602 if (word.IsEmpty()) { |
603 break; | 603 break; |
604 } | 604 } |
605 if (word == FX_BSTRC("beginbfchar")) { | 605 if (word == FX_BSTRC("beginbfchar")) { |
606 while (1) { | 606 while (1) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } | 674 } |
675 m_Map[code] = m_MultiCharBuf.GetLength() * 0x10000 + 0xffff; | 675 m_Map[code] = m_MultiCharBuf.GetLength() * 0x10000 + 0xffff; |
676 m_MultiCharBuf.AppendChar(retcode.GetLength()); | 676 m_MultiCharBuf.AppendChar(retcode.GetLength()); |
677 m_MultiCharBuf << retcode; | 677 m_MultiCharBuf << retcode; |
678 destcode = retcode; | 678 destcode = retcode; |
679 } | 679 } |
680 } | 680 } |
681 } | 681 } |
682 } | 682 } |
683 } else if (word == FX_BSTRC("/Adobe-Korea1-UCS2")) { | 683 } else if (word == FX_BSTRC("/Adobe-Korea1-UCS2")) { |
684 CIDSet = CIDSET_KOREA1; | 684 cid_set = CIDSET_KOREA1; |
685 } else if (word == FX_BSTRC("/Adobe-Japan1-UCS2")) { | 685 } else if (word == FX_BSTRC("/Adobe-Japan1-UCS2")) { |
686 CIDSet = CIDSET_JAPAN1; | 686 cid_set = CIDSET_JAPAN1; |
687 } else if (word == FX_BSTRC("/Adobe-CNS1-UCS2")) { | 687 } else if (word == FX_BSTRC("/Adobe-CNS1-UCS2")) { |
688 CIDSet = CIDSET_CNS1; | 688 cid_set = CIDSET_CNS1; |
689 } else if (word == FX_BSTRC("/Adobe-GB1-UCS2")) { | 689 } else if (word == FX_BSTRC("/Adobe-GB1-UCS2")) { |
690 CIDSet = CIDSET_GB1; | 690 cid_set = CIDSET_GB1; |
691 } | 691 } |
692 } | 692 } |
693 if (CIDSet) { | 693 if (cid_set) { |
694 m_pBaseMap = CPDF_ModuleMgr::Get() | 694 m_pBaseMap = CPDF_ModuleMgr::Get() |
695 ->GetPageModule() | 695 ->GetPageModule() |
696 ->GetFontGlobals() | 696 ->GetFontGlobals() |
697 ->m_CMapManager.GetCID2UnicodeMap(CIDSet, FALSE); | 697 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); |
698 } else { | 698 } else { |
699 m_pBaseMap = NULL; | 699 m_pBaseMap = NULL; |
700 } | 700 } |
701 } | 701 } |
702 static FX_BOOL GetPredefinedEncoding(int& basemap, | 702 static FX_BOOL GetPredefinedEncoding(int& basemap, |
703 const CFX_ByteString& value) { | 703 const CFX_ByteString& value) { |
704 if (value == FX_BSTRC("WinAnsiEncoding")) { | 704 if (value == FX_BSTRC("WinAnsiEncoding")) { |
705 basemap = PDFFONT_ENCODING_WINANSI; | 705 basemap = PDFFONT_ENCODING_WINANSI; |
706 } else if (value == FX_BSTRC("MacRomanEncoding")) { | 706 } else if (value == FX_BSTRC("MacRomanEncoding")) { |
707 basemap = PDFFONT_ENCODING_MACROMAN; | 707 basemap = PDFFONT_ENCODING_MACROMAN; |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 CPDF_Type3Char::CPDF_Type3Char() { | 1780 CPDF_Type3Char::CPDF_Type3Char() { |
1781 m_pForm = NULL; | 1781 m_pForm = NULL; |
1782 m_pBitmap = NULL; | 1782 m_pBitmap = NULL; |
1783 m_bPageRequired = FALSE; | 1783 m_bPageRequired = FALSE; |
1784 m_bColored = FALSE; | 1784 m_bColored = FALSE; |
1785 } | 1785 } |
1786 CPDF_Type3Char::~CPDF_Type3Char() { | 1786 CPDF_Type3Char::~CPDF_Type3Char() { |
1787 delete m_pForm; | 1787 delete m_pForm; |
1788 delete m_pBitmap; | 1788 delete m_pBitmap; |
1789 } | 1789 } |
OLD | NEW |