Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp

Issue 1729823004: refactor CPDF_Font and subclasses (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove types and delete unused Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/src/fpdfapi/fpdf_font/font_int.h" 7 #include "core/src/fpdfapi/fpdf_font/font_int.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_page.h" 10 #include "core/include/fpdfapi/fpdf_page.h"
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 return 0; 1031 return 0;
1032 } 1032 }
1033 1033
1034 void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, 1034 void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr,
1035 CIDSet charset, 1035 CIDSet charset,
1036 FX_BOOL bPromptCJK) { 1036 FX_BOOL bPromptCJK) {
1037 m_Charset = charset; 1037 m_Charset = charset;
1038 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount); 1038 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount);
1039 } 1039 }
1040 1040
1041 CPDF_CIDFont::CPDF_CIDFont() : CPDF_Font(PDFFONT_CIDFONT) { 1041 CPDF_CIDFont::CPDF_CIDFont()
1042 m_pCMap = NULL; 1042 : m_pCMap(nullptr),
1043 m_pAllocatedCMap = NULL; 1043 m_pAllocatedCMap(nullptr),
1044 m_pCID2UnicodeMap = NULL; 1044 m_pCID2UnicodeMap(nullptr),
1045 m_pAnsiWidths = NULL; 1045 m_pCIDToGIDMap(nullptr),
1046 m_pCIDToGIDMap = NULL; 1046 m_bCIDIsGID(FALSE),
1047 m_bCIDIsGID = FALSE; 1047 m_pAnsiWidths(nullptr),
1048 m_bAdobeCourierStd = FALSE; 1048 m_bAdobeCourierStd(FALSE),
1049 m_pTTGSUBTable = NULL; 1049 m_pTTGSUBTable(nullptr) {
1050 FXSYS_memset(m_CharBBox, 0xff, 256 * sizeof(FX_SMALL_RECT)); 1050 FXSYS_memset(m_CharBBox, 0xff, 256 * sizeof(FX_SMALL_RECT));
1051 } 1051 }
1052
1052 CPDF_CIDFont::~CPDF_CIDFont() { 1053 CPDF_CIDFont::~CPDF_CIDFont() {
1053 if (m_pAnsiWidths) { 1054 if (m_pAnsiWidths) {
1054 FX_Free(m_pAnsiWidths); 1055 FX_Free(m_pAnsiWidths);
1055 } 1056 }
1056 delete m_pAllocatedCMap; 1057 delete m_pAllocatedCMap;
1057 delete m_pCIDToGIDMap; 1058 delete m_pCIDToGIDMap;
1058 delete m_pTTGSUBTable; 1059 delete m_pTTGSUBTable;
1059 } 1060 }
1061
1060 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const { 1062 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const {
1061 if (!m_pCMap) { 1063 if (!m_pCMap) {
1062 return (FX_WORD)charcode; 1064 return (FX_WORD)charcode;
1063 } 1065 }
1064 return m_pCMap->CIDFromCharCode(charcode); 1066 return m_pCMap->CIDFromCharCode(charcode);
1065 } 1067 }
1068
1066 FX_BOOL CPDF_CIDFont::IsVertWriting() const { 1069 FX_BOOL CPDF_CIDFont::IsVertWriting() const {
1067 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE; 1070 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE;
1068 } 1071 }
1069 1072
1070 FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const { 1073 FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const {
1071 switch (m_pCMap->m_Coding) { 1074 switch (m_pCMap->m_Coding) {
1072 case CIDCODING_UCS2: 1075 case CIDCODING_UCS2:
1073 case CIDCODING_UTF16: 1076 case CIDCODING_UTF16:
1074 return (FX_WCHAR)charcode; 1077 return (FX_WCHAR)charcode;
1075 case CIDCODING_CID: 1078 case CIDCODING_CID:
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 1719
1717 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { 1720 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const {
1718 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 1721 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
1719 return nullptr; 1722 return nullptr;
1720 1723
1721 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( 1724 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch(
1722 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), 1725 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs),
1723 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); 1726 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform);
1724 return found ? &found->a : nullptr; 1727 return found ? &found->a : nullptr;
1725 } 1728 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698