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

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

Issue 1294933008: Merge to XFA: Extern in .cpp file is a code smell, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: IWYU Created 5 years, 4 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 "../../../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_resource.h" 9 #include "../../../include/fpdfapi/fpdf_resource.h"
10 #include "../../../include/fxge/fx_freetype.h" 10 #include "../../../include/fxge/fx_freetype.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 {0x81, 0xfe}}, 423 {0x81, 0xfe}},
424 {"KSCpc-EUC", 424 {"KSCpc-EUC",
425 CIDSET_KOREA1, 425 CIDSET_KOREA1,
426 CIDCODING_KOREA, 426 CIDCODING_KOREA,
427 CPDF_CMap::MixedTwoBytes, 427 CPDF_CMap::MixedTwoBytes,
428 1, 428 1,
429 {0xa1, 0xfd}}, 429 {0xa1, 0xfd}},
430 {"UniKS-UCS2", CIDSET_KOREA1, CIDCODING_UCS2, CPDF_CMap::TwoBytes}, 430 {"UniKS-UCS2", CIDSET_KOREA1, CIDCODING_UCS2, CPDF_CMap::TwoBytes},
431 {"UniKS-UTF16", CIDSET_KOREA1, CIDCODING_UTF16, CPDF_CMap::TwoBytes}, 431 {"UniKS-UTF16", CIDSET_KOREA1, CIDCODING_UTF16, CPDF_CMap::TwoBytes},
432 {NULL, 0, 0}}; 432 {NULL, 0, 0}};
433 extern void FPDFAPI_FindEmbeddedCMap(const char* name, 433
434 int charset,
435 int coding,
436 const FXCMAP_CMap*& pMap);
437 extern FX_WORD FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap,
438 FX_DWORD charcode);
439 FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, 434 FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
440 const FX_CHAR* pName, 435 const FX_CHAR* pName,
441 FX_BOOL bPromptCJK) { 436 FX_BOOL bPromptCJK) {
442 m_PredefinedCMap = pName; 437 m_PredefinedCMap = pName;
443 if (m_PredefinedCMap == FX_BSTRC("Identity-H") || 438 if (m_PredefinedCMap == FX_BSTRC("Identity-H") ||
444 m_PredefinedCMap == FX_BSTRC("Identity-V")) { 439 m_PredefinedCMap == FX_BSTRC("Identity-V")) {
445 m_Coding = CIDCODING_CID; 440 m_Coding = CIDCODING_CID;
446 m_bVertical = pName[9] == 'V'; 441 m_bVertical = pName[9] == 'V';
447 m_bLoaded = TRUE; 442 m_bLoaded = TRUE;
448 return TRUE; 443 return TRUE;
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 } 800 }
806 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const { 801 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const {
807 if (m_pCMap == NULL) { 802 if (m_pCMap == NULL) {
808 return (FX_WORD)charcode; 803 return (FX_WORD)charcode;
809 } 804 }
810 return m_pCMap->CIDFromCharCode(charcode); 805 return m_pCMap->CIDFromCharCode(charcode);
811 } 806 }
812 FX_BOOL CPDF_CIDFont::IsVertWriting() const { 807 FX_BOOL CPDF_CIDFont::IsVertWriting() const {
813 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE; 808 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE;
814 } 809 }
815 extern FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, FX_WORD cid);
816 static FX_DWORD _EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, 810 static FX_DWORD _EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap,
817 int charset, 811 int charset,
818 FX_WCHAR unicode) { 812 FX_WCHAR unicode) {
819 if (charset <= 0 || charset > 4) { 813 if (charset <= 0 || charset > 4) {
820 return 0; 814 return 0;
821 } 815 }
822 CPDF_FontGlobals* pFontGlobals = 816 CPDF_FontGlobals* pFontGlobals =
823 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); 817 CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
824 const FX_WORD* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; 818 const FX_WORD* pCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap;
825 if (pCodes == NULL) { 819 if (pCodes == NULL) {
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 if (middlecode > CID) { 1624 if (middlecode > CID) {
1631 end = middle - 1; 1625 end = middle - 1;
1632 } else if (middlecode < CID) { 1626 } else if (middlecode < CID) {
1633 begin = middle + 1; 1627 begin = middle + 1;
1634 } else { 1628 } else {
1635 return &Japan1_VertCIDs[middle].a; 1629 return &Japan1_VertCIDs[middle].a;
1636 } 1630 }
1637 } 1631 }
1638 return NULL; 1632 return NULL;
1639 } 1633 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698