| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 } | 1274 } |
| 1275 m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); | 1275 m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); |
| 1276 face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, | 1276 face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, |
| 1277 font_size, | 1277 font_size, |
| 1278 m_pFontInfo->GetFaceIndex(hFont)); | 1278 m_pFontInfo->GetFaceIndex(hFont)); |
| 1279 } | 1279 } |
| 1280 } | 1280 } |
| 1281 m_pFontInfo->DeleteFont(hFont); | 1281 m_pFontInfo->DeleteFont(hFont); |
| 1282 return face; | 1282 return face; |
| 1283 } | 1283 } |
| 1284 |
| 1285 void* IFX_SystemFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, |
| 1286 int weight, |
| 1287 FX_BOOL bItalic, |
| 1288 int pitch_family) { |
| 1289 return nullptr; |
| 1290 } |
| 1284 #endif // PDF_ENABLE_XFA | 1291 #endif // PDF_ENABLE_XFA |
| 1285 | 1292 |
| 1293 int IFX_SystemFontInfo::GetFaceIndex(void* hFont) { |
| 1294 return 0; |
| 1295 } |
| 1296 |
| 1297 void* IFX_SystemFontInfo::RetainFont(void* hFont) { |
| 1298 return NULL; |
| 1299 } |
| 1300 |
| 1286 int CFX_FontMapper::GetFaceSize() const { | 1301 int CFX_FontMapper::GetFaceSize() const { |
| 1287 return pdfium::CollectionSize<int>(m_FaceArray); | 1302 return pdfium::CollectionSize<int>(m_FaceArray); |
| 1288 } | 1303 } |
| 1289 | 1304 |
| 1290 FX_BOOL CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const { | 1305 FX_BOOL CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const { |
| 1291 for (int i = 0; i < MM_FACE_COUNT; ++i) { | 1306 for (int i = 0; i < MM_FACE_COUNT; ++i) { |
| 1292 if (m_MMFaces[i] == face) { | 1307 if (m_MMFaces[i] == face) { |
| 1293 return TRUE; | 1308 return TRUE; |
| 1294 } | 1309 } |
| 1295 } | 1310 } |
| 1296 for (int i = 0; i < FOXIT_FACE_COUNT; ++i) { | 1311 for (int i = 0; i < FOXIT_FACE_COUNT; ++i) { |
| 1297 if (m_FoxitFaces[i] == face) { | 1312 if (m_FoxitFaces[i] == face) { |
| 1298 return TRUE; | 1313 return TRUE; |
| 1299 } | 1314 } |
| 1300 } | 1315 } |
| 1301 return FALSE; | 1316 return FALSE; |
| 1302 } | 1317 } |
| 1303 | 1318 |
| 1304 extern "C" { | 1319 extern "C" { |
| 1305 unsigned long _FTStreamRead(FXFT_Stream stream, | 1320 unsigned long _FTStreamRead(FXFT_Stream stream, |
| 1306 unsigned long offset, | 1321 unsigned long offset, |
| 1307 unsigned char* buffer, | 1322 unsigned char* buffer, |
| 1308 unsigned long count); | 1323 unsigned long count); |
| 1309 void _FTStreamClose(FXFT_Stream stream); | 1324 void _FTStreamClose(FXFT_Stream stream); |
| 1310 }; | 1325 }; |
| 1326 |
| 1311 #if _FX_OS_ == _FX_ANDROID_ | 1327 #if _FX_OS_ == _FX_ANDROID_ |
| 1312 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { | 1328 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { |
| 1313 return NULL; | 1329 return NULL; |
| 1314 } | 1330 } |
| 1315 #endif | 1331 #endif |
| 1332 |
| 1316 CFX_FolderFontInfo::CFX_FolderFontInfo() {} | 1333 CFX_FolderFontInfo::CFX_FolderFontInfo() {} |
| 1317 CFX_FolderFontInfo::~CFX_FolderFontInfo() { | 1334 CFX_FolderFontInfo::~CFX_FolderFontInfo() { |
| 1318 for (const auto& pair : m_FontList) { | 1335 for (const auto& pair : m_FontList) { |
| 1319 delete pair.second; | 1336 delete pair.second; |
| 1320 } | 1337 } |
| 1321 } | 1338 } |
| 1322 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { | 1339 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { |
| 1323 m_PathList.push_back(path); | 1340 m_PathList.push_back(path); |
| 1324 } | 1341 } |
| 1325 void CFX_FolderFontInfo::Release() { | 1342 void CFX_FolderFontInfo::Release() { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1613 int PDF_GetStandardFontName(CFX_ByteString* name) { |
| 1597 AltFontName* found = static_cast<AltFontName*>( | 1614 AltFontName* found = static_cast<AltFontName*>( |
| 1598 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1615 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
| 1599 sizeof(AltFontName), CompareString)); | 1616 sizeof(AltFontName), CompareString)); |
| 1600 if (!found) | 1617 if (!found) |
| 1601 return -1; | 1618 return -1; |
| 1602 | 1619 |
| 1603 *name = g_Base14FontNames[found->m_Index]; | 1620 *name = g_Base14FontNames[found->m_Index]; |
| 1604 return found->m_Index; | 1621 return found->m_Index; |
| 1605 } | 1622 } |
| OLD | NEW |