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_resource.h" | 9 #include "../../../include/fpdfapi/fpdf_resource.h" |
10 #include "../../../include/fxge/fx_freetype.h" | 10 #include "../../../include/fxge/fx_freetype.h" |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 CFX_ByteString subtype = pCIDFontDict->GetString(FX_BSTRC("Subtype")); | 1208 CFX_ByteString subtype = pCIDFontDict->GetString(FX_BSTRC("Subtype")); |
1209 m_bType1 = (subtype == FX_BSTRC("CIDFontType0")); | 1209 m_bType1 = (subtype == FX_BSTRC("CIDFontType0")); |
1210 | 1210 |
1211 if (pEncoding->IsName()) { | 1211 if (pEncoding->IsName()) { |
1212 CFX_ByteString cmap = pEncoding->GetString(); | 1212 CFX_ByteString cmap = pEncoding->GetString(); |
1213 m_pCMap = | 1213 m_pCMap = |
1214 CPDF_ModuleMgr::Get() | 1214 CPDF_ModuleMgr::Get() |
1215 ->GetPageModule() | 1215 ->GetPageModule() |
1216 ->GetFontGlobals() | 1216 ->GetFontGlobals() |
1217 ->m_CMapManager.GetPredefinedCMap(cmap, m_pFontFile && m_bType1); | 1217 ->m_CMapManager.GetPredefinedCMap(cmap, m_pFontFile && m_bType1); |
1218 } else if (pEncoding->GetType() == PDFOBJ_STREAM) { | 1218 } else if (CPDF_Stream* pStream = pEncoding->AsStream()) { |
1219 m_pAllocatedCMap = m_pCMap = new CPDF_CMap; | 1219 m_pAllocatedCMap = m_pCMap = new CPDF_CMap; |
1220 CPDF_Stream* pStream = (CPDF_Stream*)pEncoding; | |
1221 CPDF_StreamAcc acc; | 1220 CPDF_StreamAcc acc; |
1222 acc.LoadAllData(pStream, FALSE); | 1221 acc.LoadAllData(pStream, FALSE); |
1223 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize()); | 1222 m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize()); |
1224 } else { | 1223 } else { |
1225 return FALSE; | 1224 return FALSE; |
1226 } | 1225 } |
1227 if (m_pCMap == NULL) { | 1226 if (m_pCMap == NULL) { |
1228 return FALSE; | 1227 return FALSE; |
1229 } | 1228 } |
1230 m_Charset = m_pCMap->m_Charset; | 1229 m_Charset = m_pCMap->m_Charset; |
(...skipping 27 matching lines...) Expand all Loading... |
1258 LoadMetricsArray(pWidthArray, m_WidthList, 1); | 1257 LoadMetricsArray(pWidthArray, m_WidthList, 1); |
1259 } | 1258 } |
1260 if (!IsEmbedded()) { | 1259 if (!IsEmbedded()) { |
1261 LoadSubstFont(); | 1260 LoadSubstFont(); |
1262 } | 1261 } |
1263 if (1) { | 1262 if (1) { |
1264 if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) { | 1263 if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) { |
1265 CPDF_Object* pmap = | 1264 CPDF_Object* pmap = |
1266 pCIDFontDict->GetElementValue(FX_BSTRC("CIDToGIDMap")); | 1265 pCIDFontDict->GetElementValue(FX_BSTRC("CIDToGIDMap")); |
1267 if (pmap) { | 1266 if (pmap) { |
1268 if (pmap->GetType() == PDFOBJ_STREAM) { | 1267 if (CPDF_Stream* pStream = pmap->AsStream()) { |
1269 m_pCIDToGIDMap = new CPDF_StreamAcc; | 1268 m_pCIDToGIDMap = new CPDF_StreamAcc; |
1270 m_pCIDToGIDMap->LoadAllData((CPDF_Stream*)pmap, FALSE); | 1269 m_pCIDToGIDMap->LoadAllData(pStream, FALSE); |
1271 } else if (pmap->GetString() == FX_BSTRC("Identity")) { | 1270 } else if (pmap->GetString() == FX_BSTRC("Identity")) { |
1272 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1271 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
1273 if (m_pFontFile) { | 1272 if (m_pFontFile) { |
1274 m_bCIDIsGID = TRUE; | 1273 m_bCIDIsGID = TRUE; |
1275 } | 1274 } |
1276 #else | 1275 #else |
1277 m_bCIDIsGID = TRUE; | 1276 m_bCIDIsGID = TRUE; |
1278 #endif | 1277 #endif |
1279 } | 1278 } |
1280 } | 1279 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 | 1744 |
1746 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { | 1745 const uint8_t* CPDF_CIDFont::GetCIDTransform(FX_WORD CID) const { |
1747 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) | 1746 if (m_Charset != CIDSET_JAPAN1 || m_pFontFile) |
1748 return nullptr; | 1747 return nullptr; |
1749 | 1748 |
1750 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( | 1749 const struct CIDTransform* found = (const struct CIDTransform*)FXSYS_bsearch( |
1751 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), | 1750 &CID, g_Japan1_VertCIDs, FX_ArraySize(g_Japan1_VertCIDs), |
1752 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); | 1751 sizeof(g_Japan1_VertCIDs[0]), CompareCIDTransform); |
1753 return found ? &found->a : nullptr; | 1752 return found ? &found->a : nullptr; |
1754 } | 1753 } |
OLD | NEW |