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

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

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years 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
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/src/fpdfapi/fpdf_font/ttgsubtable.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "font_int.h" 7 #include "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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 return TRUE; 841 return TRUE;
842 } 842 }
843 843
844 FX_WORD CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const { 844 FX_WORD CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const {
845 if (m_Coding == CIDCODING_CID) { 845 if (m_Coding == CIDCODING_CID) {
846 return (FX_WORD)charcode; 846 return (FX_WORD)charcode;
847 } 847 }
848 if (m_pEmbedMap) { 848 if (m_pEmbedMap) {
849 return FPDFAPI_CIDFromCharCode(m_pEmbedMap, charcode); 849 return FPDFAPI_CIDFromCharCode(m_pEmbedMap, charcode);
850 } 850 }
851 if (m_pMapping == NULL) { 851 if (!m_pMapping) {
852 return (FX_WORD)charcode; 852 return (FX_WORD)charcode;
853 } 853 }
854 if (charcode >> 16) { 854 if (charcode >> 16) {
855 if (m_pAddMapping) { 855 if (m_pAddMapping) {
856 void* found = FXSYS_bsearch(&charcode, m_pAddMapping + 4, 856 void* found = FXSYS_bsearch(&charcode, m_pAddMapping + 4,
857 *(FX_DWORD*)m_pAddMapping, 8, CompareCID); 857 *(FX_DWORD*)m_pAddMapping, 8, CompareCID);
858 if (found == NULL) { 858 if (!found) {
859 if (m_pUseMap) { 859 if (m_pUseMap) {
860 return m_pUseMap->CIDFromCharCode(charcode); 860 return m_pUseMap->CIDFromCharCode(charcode);
861 } 861 }
862 return 0; 862 return 0;
863 } 863 }
864 return (FX_WORD)(((FX_DWORD*)found)[1] % 65536 + charcode - 864 return (FX_WORD)(((FX_DWORD*)found)[1] % 65536 + charcode -
865 *(FX_DWORD*)found); 865 *(FX_DWORD*)found);
866 } 866 }
867 if (m_pUseMap) 867 if (m_pUseMap)
868 return m_pUseMap->CIDFromCharCode(charcode); 868 return m_pUseMap->CIDFromCharCode(charcode);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 } 1051 }
1052 CPDF_CIDFont::~CPDF_CIDFont() { 1052 CPDF_CIDFont::~CPDF_CIDFont() {
1053 if (m_pAnsiWidths) { 1053 if (m_pAnsiWidths) {
1054 FX_Free(m_pAnsiWidths); 1054 FX_Free(m_pAnsiWidths);
1055 } 1055 }
1056 delete m_pAllocatedCMap; 1056 delete m_pAllocatedCMap;
1057 delete m_pCIDToGIDMap; 1057 delete m_pCIDToGIDMap;
1058 delete m_pTTGSUBTable; 1058 delete m_pTTGSUBTable;
1059 } 1059 }
1060 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const { 1060 FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const {
1061 if (m_pCMap == NULL) { 1061 if (!m_pCMap) {
1062 return (FX_WORD)charcode; 1062 return (FX_WORD)charcode;
1063 } 1063 }
1064 return m_pCMap->CIDFromCharCode(charcode); 1064 return m_pCMap->CIDFromCharCode(charcode);
1065 } 1065 }
1066 FX_BOOL CPDF_CIDFont::IsVertWriting() const { 1066 FX_BOOL CPDF_CIDFont::IsVertWriting() const {
1067 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE; 1067 return m_pCMap ? m_pCMap->IsVertWriting() : FALSE;
1068 } 1068 }
1069 1069
1070 FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const { 1070 FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const {
1071 switch (m_pCMap->m_Coding) { 1071 switch (m_pCMap->m_Coding) {
1072 case CIDCODING_UCS2: 1072 case CIDCODING_UCS2:
1073 case CIDCODING_UTF16: 1073 case CIDCODING_UTF16:
1074 return (FX_WCHAR)charcode; 1074 return (FX_WCHAR)charcode;
1075 case CIDCODING_CID: 1075 case CIDCODING_CID:
1076 if (m_pCID2UnicodeMap == NULL || !m_pCID2UnicodeMap->IsLoaded()) { 1076 if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) {
1077 return 0; 1077 return 0;
1078 } 1078 }
1079 return m_pCID2UnicodeMap->UnicodeFromCID((FX_WORD)charcode); 1079 return m_pCID2UnicodeMap->UnicodeFromCID((FX_WORD)charcode);
1080 } 1080 }
1081 if (!m_pCMap->IsLoaded() || m_pCID2UnicodeMap == NULL || 1081 if (!m_pCMap->IsLoaded() || !m_pCID2UnicodeMap ||
1082 !m_pCID2UnicodeMap->IsLoaded()) { 1082 !m_pCID2UnicodeMap->IsLoaded()) {
1083 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 1083 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
1084 FX_WCHAR unicode; 1084 FX_WCHAR unicode;
1085 int charsize = 1; 1085 int charsize = 1;
1086 if (charcode > 255) { 1086 if (charcode > 255) {
1087 charcode = (charcode % 256) * 256 + (charcode / 256); 1087 charcode = (charcode % 256) * 256 + (charcode / 256);
1088 charsize = 2; 1088 charsize = 2;
1089 } 1089 }
1090 int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0, 1090 int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0,
1091 (const FX_CHAR*)&charcode, charsize, 1091 (const FX_CHAR*)&charcode, charsize,
(...skipping 12 matching lines...) Expand all
1104 return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode)); 1104 return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode));
1105 } 1105 }
1106 FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const { 1106 FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const {
1107 switch (m_pCMap->m_Coding) { 1107 switch (m_pCMap->m_Coding) {
1108 case CIDCODING_UNKNOWN: 1108 case CIDCODING_UNKNOWN:
1109 return 0; 1109 return 0;
1110 case CIDCODING_UCS2: 1110 case CIDCODING_UCS2:
1111 case CIDCODING_UTF16: 1111 case CIDCODING_UTF16:
1112 return unicode; 1112 return unicode;
1113 case CIDCODING_CID: { 1113 case CIDCODING_CID: {
1114 if (m_pCID2UnicodeMap == NULL || !m_pCID2UnicodeMap->IsLoaded()) { 1114 if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) {
1115 return 0; 1115 return 0;
1116 } 1116 }
1117 FX_DWORD CID = 0; 1117 FX_DWORD CID = 0;
1118 while (CID < 65536) { 1118 while (CID < 65536) {
1119 FX_WCHAR this_unicode = m_pCID2UnicodeMap->UnicodeFromCID((FX_WORD)CID); 1119 FX_WCHAR this_unicode = m_pCID2UnicodeMap->UnicodeFromCID((FX_WORD)CID);
1120 if (this_unicode == unicode) { 1120 if (this_unicode == unicode) {
1121 return CID; 1121 return CID;
1122 } 1122 }
1123 CID++; 1123 CID++;
1124 } 1124 }
(...skipping 25 matching lines...) Expand all
1150 } 1150 }
1151 #endif 1151 #endif
1152 return 0; 1152 return 0;
1153 } 1153 }
1154 1154
1155 FX_BOOL CPDF_CIDFont::_Load() { 1155 FX_BOOL CPDF_CIDFont::_Load() {
1156 if (m_pFontDict->GetString("Subtype") == "TrueType") { 1156 if (m_pFontDict->GetString("Subtype") == "TrueType") {
1157 return LoadGB2312(); 1157 return LoadGB2312();
1158 } 1158 }
1159 CPDF_Array* pFonts = m_pFontDict->GetArray("DescendantFonts"); 1159 CPDF_Array* pFonts = m_pFontDict->GetArray("DescendantFonts");
1160 if (pFonts == NULL) { 1160 if (!pFonts) {
1161 return FALSE; 1161 return FALSE;
1162 } 1162 }
1163 if (pFonts->GetCount() != 1) { 1163 if (pFonts->GetCount() != 1) {
1164 return FALSE; 1164 return FALSE;
1165 } 1165 }
1166 CPDF_Dictionary* pCIDFontDict = pFonts->GetDict(0); 1166 CPDF_Dictionary* pCIDFontDict = pFonts->GetDict(0);
1167 if (pCIDFontDict == NULL) { 1167 if (!pCIDFontDict) {
1168 return FALSE; 1168 return FALSE;
1169 } 1169 }
1170 m_BaseFont = pCIDFontDict->GetString("BaseFont"); 1170 m_BaseFont = pCIDFontDict->GetString("BaseFont");
1171 if ((m_BaseFont.Compare("CourierStd") == 0 || 1171 if ((m_BaseFont.Compare("CourierStd") == 0 ||
1172 m_BaseFont.Compare("CourierStd-Bold") == 0 || 1172 m_BaseFont.Compare("CourierStd-Bold") == 0 ||
1173 m_BaseFont.Compare("CourierStd-BoldOblique") == 0 || 1173 m_BaseFont.Compare("CourierStd-BoldOblique") == 0 ||
1174 m_BaseFont.Compare("CourierStd-Oblique") == 0) && 1174 m_BaseFont.Compare("CourierStd-Oblique") == 0) &&
1175 !IsEmbedded()) { 1175 !IsEmbedded()) {
1176 m_bAdobeCourierStd = TRUE; 1176 m_bAdobeCourierStd = TRUE;
1177 } 1177 }
1178 CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDict("FontDescriptor"); 1178 CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDict("FontDescriptor");
1179 if (pFontDesc) { 1179 if (pFontDesc) {
1180 LoadFontDescriptor(pFontDesc); 1180 LoadFontDescriptor(pFontDesc);
1181 } 1181 }
1182 CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding"); 1182 CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding");
1183 if (pEncoding == NULL) { 1183 if (!pEncoding) {
1184 return FALSE; 1184 return FALSE;
1185 } 1185 }
1186 CFX_ByteString subtype = pCIDFontDict->GetString("Subtype"); 1186 CFX_ByteString subtype = pCIDFontDict->GetString("Subtype");
1187 m_bType1 = (subtype == "CIDFontType0"); 1187 m_bType1 = (subtype == "CIDFontType0");
1188 1188
1189 if (pEncoding->IsName()) { 1189 if (pEncoding->IsName()) {
1190 CFX_ByteString cmap = pEncoding->GetString(); 1190 CFX_ByteString cmap = pEncoding->GetString();
1191 m_pCMap = 1191 m_pCMap =
1192 CPDF_ModuleMgr::Get() 1192 CPDF_ModuleMgr::Get()
1193 ->GetPageModule() 1193 ->GetPageModule()
1194 ->GetFontGlobals() 1194 ->GetFontGlobals()
1195 ->m_CMapManager.GetPredefinedCMap(cmap, m_pFontFile && m_bType1); 1195 ->m_CMapManager.GetPredefinedCMap(cmap, m_pFontFile && m_bType1);
1196 } else if (CPDF_Stream* pStream = pEncoding->AsStream()) { 1196 } else if (CPDF_Stream* pStream = pEncoding->AsStream()) {
1197 m_pAllocatedCMap = m_pCMap = new CPDF_CMap; 1197 m_pAllocatedCMap = m_pCMap = new CPDF_CMap;
1198 CPDF_StreamAcc acc; 1198 CPDF_StreamAcc acc;
1199 acc.LoadAllData(pStream, FALSE); 1199 acc.LoadAllData(pStream, FALSE);
1200 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize()); 1200 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
1201 } else { 1201 } else {
1202 return FALSE; 1202 return FALSE;
1203 } 1203 }
1204 if (m_pCMap == NULL) { 1204 if (!m_pCMap) {
1205 return FALSE; 1205 return FALSE;
1206 } 1206 }
1207 m_Charset = m_pCMap->m_Charset; 1207 m_Charset = m_pCMap->m_Charset;
1208 if (m_Charset == CIDSET_UNKNOWN) { 1208 if (m_Charset == CIDSET_UNKNOWN) {
1209 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDict("CIDSystemInfo"); 1209 CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDict("CIDSystemInfo");
1210 if (pCIDInfo) { 1210 if (pCIDInfo) {
1211 m_Charset = CharsetFromOrdering(pCIDInfo->GetString("Ordering")); 1211 m_Charset = CharsetFromOrdering(pCIDInfo->GetString("Ordering"));
1212 } 1212 }
1213 } 1213 }
1214 if (m_Charset != CIDSET_UNKNOWN) 1214 if (m_Charset != CIDSET_UNKNOWN)
1215 m_pCID2UnicodeMap = 1215 m_pCID2UnicodeMap =
1216 CPDF_ModuleMgr::Get() 1216 CPDF_ModuleMgr::Get()
1217 ->GetPageModule() 1217 ->GetPageModule()
1218 ->GetFontGlobals() 1218 ->GetFontGlobals()
1219 ->m_CMapManager.GetCID2UnicodeMap( 1219 ->m_CMapManager.GetCID2UnicodeMap(
1220 m_Charset, 1220 m_Charset,
1221 m_pFontFile == NULL && (m_pCMap->m_Coding == CIDCODING_CID || 1221 !m_pFontFile && (m_pCMap->m_Coding == CIDCODING_CID ||
1222 pCIDFontDict->KeyExist("W"))); 1222 pCIDFontDict->KeyExist("W")));
1223 if (m_Font.GetFace()) { 1223 if (m_Font.GetFace()) {
1224 if (m_bType1) { 1224 if (m_bType1) {
1225 FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE); 1225 FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE);
1226 } else { 1226 } else {
1227 FT_UseCIDCharmap(m_Font.GetFace(), m_pCMap->m_Coding); 1227 FT_UseCIDCharmap(m_Font.GetFace(), m_pCMap->m_Coding);
1228 } 1228 }
1229 } 1229 }
1230 m_DefaultWidth = pCIDFontDict->GetInteger("DW", 1000); 1230 m_DefaultWidth = pCIDFontDict->GetInteger("DW", 1000);
1231 CPDF_Array* pWidthArray = pCIDFontDict->GetArray("W"); 1231 CPDF_Array* pWidthArray = pCIDFontDict->GetArray("W");
1232 if (pWidthArray) { 1232 if (pWidthArray) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 rect.top = TT2PDF(FXFT_Get_Glyph_HoriBearingY(face), face); 1326 rect.top = TT2PDF(FXFT_Get_Glyph_HoriBearingY(face), face);
1327 rect.top += rect.top / 64; 1327 rect.top += rect.top / 64;
1328 rect.bottom = TT2PDF( 1328 rect.bottom = TT2PDF(
1329 FXFT_Get_Glyph_HoriBearingY(face) - FXFT_Get_Glyph_Height(face), 1329 FXFT_Get_Glyph_HoriBearingY(face) - FXFT_Get_Glyph_Height(face),
1330 face); 1330 face);
1331 } 1331 }
1332 } 1332 }
1333 } else { 1333 } else {
1334 rect = FX_RECT(0, 0, 0, 0); 1334 rect = FX_RECT(0, 0, 0, 0);
1335 } 1335 }
1336 if (m_pFontFile == NULL && m_Charset == CIDSET_JAPAN1) { 1336 if (!m_pFontFile && m_Charset == CIDSET_JAPAN1) {
1337 FX_WORD CID = CIDFromCharCode(charcode); 1337 FX_WORD CID = CIDFromCharCode(charcode);
1338 const uint8_t* pTransform = GetCIDTransform(CID); 1338 const uint8_t* pTransform = GetCIDTransform(CID);
1339 if (pTransform && !bVert) { 1339 if (pTransform && !bVert) {
1340 CFX_Matrix matrix(CIDTransformToFloat(pTransform[0]), 1340 CFX_Matrix matrix(CIDTransformToFloat(pTransform[0]),
1341 CIDTransformToFloat(pTransform[1]), 1341 CIDTransformToFloat(pTransform[1]),
1342 CIDTransformToFloat(pTransform[2]), 1342 CIDTransformToFloat(pTransform[2]),
1343 CIDTransformToFloat(pTransform[3]), 1343 CIDTransformToFloat(pTransform[3]),
1344 CIDTransformToFloat(pTransform[4]) * 1000, 1344 CIDTransformToFloat(pTransform[4]) * 1000,
1345 CIDTransformToFloat(pTransform[5]) * 1000); 1345 CIDTransformToFloat(pTransform[5]) * 1000);
1346 CFX_FloatRect rect_f(rect); 1346 CFX_FloatRect rect_f(rect);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 } 1451 }
1452 if (pVertGlyph) { 1452 if (pVertGlyph) {
1453 *pVertGlyph = FALSE; 1453 *pVertGlyph = FALSE;
1454 } 1454 }
1455 return index; 1455 return index;
1456 } 1456 }
1457 int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { 1457 int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
1458 if (pVertGlyph) { 1458 if (pVertGlyph) {
1459 *pVertGlyph = FALSE; 1459 *pVertGlyph = FALSE;
1460 } 1460 }
1461 if (m_pFontFile == NULL && m_pCIDToGIDMap == NULL) { 1461 if (!m_pFontFile && !m_pCIDToGIDMap) {
1462 FX_WORD cid = CIDFromCharCode(charcode); 1462 FX_WORD cid = CIDFromCharCode(charcode);
1463 FX_WCHAR unicode = 0; 1463 FX_WCHAR unicode = 0;
1464 if (m_bCIDIsGID) { 1464 if (m_bCIDIsGID) {
1465 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ 1465 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
1466 return cid; 1466 return cid;
1467 #else 1467 #else
1468 if (m_Flags & PDFFONT_SYMBOLIC) { 1468 if (m_Flags & PDFFONT_SYMBOLIC) {
1469 return cid; 1469 return cid;
1470 } 1470 }
1471 CFX_WideString uni_str = UnicodeFromCharCode(charcode); 1471 CFX_WideString uni_str = UnicodeFromCharCode(charcode);
(...skipping 25 matching lines...) Expand all
1497 if (!bMSUnicode) { 1497 if (!bMSUnicode) {
1498 bMacRoman = FT_UseTTCharmap(face, 1, 0); 1498 bMacRoman = FT_UseTTCharmap(face, 1, 0);
1499 } 1499 }
1500 iBaseEncoding = PDFFONT_ENCODING_STANDARD; 1500 iBaseEncoding = PDFFONT_ENCODING_STANDARD;
1501 if (bMSUnicode) { 1501 if (bMSUnicode) {
1502 iBaseEncoding = PDFFONT_ENCODING_WINANSI; 1502 iBaseEncoding = PDFFONT_ENCODING_WINANSI;
1503 } else if (bMacRoman) { 1503 } else if (bMacRoman) {
1504 iBaseEncoding = PDFFONT_ENCODING_MACROMAN; 1504 iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
1505 } 1505 }
1506 const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode); 1506 const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode);
1507 if (name == NULL) { 1507 if (!name) {
1508 return charcode == 0 ? -1 : (int)charcode; 1508 return charcode == 0 ? -1 : (int)charcode;
1509 } 1509 }
1510 FX_WORD unicode = PDF_UnicodeFromAdobeName(name); 1510 FX_WORD unicode = PDF_UnicodeFromAdobeName(name);
1511 if (unicode) { 1511 if (unicode) {
1512 if (bMSUnicode) { 1512 if (bMSUnicode) {
1513 index = FXFT_Get_Char_Index(face, unicode); 1513 index = FXFT_Get_Char_Index(face, unicode);
1514 } else if (bMacRoman) { 1514 } else if (bMacRoman) {
1515 FX_DWORD maccode = 1515 FX_DWORD maccode =
1516 FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode); 1516 FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode);
1517 index = !maccode ? FXFT_Get_Name_Index(face, (char*)name) 1517 index = !maccode ? FXFT_Get_Name_Index(face, (char*)name)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 int CPDF_CIDFont::GetCharSize(FX_DWORD charcode) const { 1609 int CPDF_CIDFont::GetCharSize(FX_DWORD charcode) const {
1610 return m_pCMap->GetCharSize(charcode); 1610 return m_pCMap->GetCharSize(charcode);
1611 } 1611 }
1612 int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const { 1612 int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const {
1613 return m_pCMap->CountChar(pString, size); 1613 return m_pCMap->CountChar(pString, size);
1614 } 1614 }
1615 int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const { 1615 int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const {
1616 return m_pCMap->AppendChar(str, charcode); 1616 return m_pCMap->AppendChar(str, charcode);
1617 } 1617 }
1618 FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const { 1618 FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const {
1619 if (!m_pCMap->IsLoaded() || m_pCID2UnicodeMap == NULL || 1619 if (!m_pCMap->IsLoaded() || !m_pCID2UnicodeMap ||
1620 !m_pCID2UnicodeMap->IsLoaded()) { 1620 !m_pCID2UnicodeMap->IsLoaded()) {
1621 return m_pCMap->m_Coding != CIDCODING_UNKNOWN; 1621 return m_pCMap->m_Coding != CIDCODING_UNKNOWN;
1622 } 1622 }
1623 return TRUE; 1623 return TRUE;
1624 } 1624 }
1625 FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const { 1625 FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const {
1626 return TRUE; 1626 return TRUE;
1627 } 1627 }
1628 void CPDF_CIDFont::LoadSubstFont() { 1628 void CPDF_CIDFont::LoadSubstFont() {
1629 m_Font.LoadSubst(m_BaseFont, !m_bType1, m_Flags, m_StemV * 5, m_ItalicAngle, 1629 m_Font.LoadSubst(m_BaseFont, !m_bType1, m_Flags, m_StemV * 5, m_ItalicAngle,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 1716
1717 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { 1717 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const {
1718 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) 1718 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
1719 return nullptr; 1719 return nullptr;
1720 1720
1721 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( 1721 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch(
1722 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), 1722 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs),
1723 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); 1723 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform);
1724 return found ? &found->a : nullptr; 1724 return found ? &found->a : nullptr;
1725 } 1725 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/src/fpdfapi/fpdf_font/ttgsubtable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698