| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "core/include/fxge/fx_freetype.h" | 9 #include "core/include/fxge/fx_freetype.h" |
| 10 #include "core/include/fxge/fx_ge.h" | 10 #include "core/include/fxge/fx_ge.h" |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, | 1080 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, |
| 1081 family, iExact); | 1081 family, iExact); |
| 1082 if (iExact) { | 1082 if (iExact) { |
| 1083 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; | 1083 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; |
| 1084 } | 1084 } |
| 1085 if (hFont == NULL) { | 1085 if (hFont == NULL) { |
| 1086 #ifdef PDF_ENABLE_XFA | 1086 #ifdef PDF_ENABLE_XFA |
| 1087 if (flags & FXFONT_EXACTMATCH) { | 1087 if (flags & FXFONT_EXACTMATCH) { |
| 1088 return NULL; | 1088 return NULL; |
| 1089 } | 1089 } |
| 1090 #endif | 1090 #endif // PDF_ENABLE_XFA |
| 1091 if (bCJK) { | 1091 if (bCJK) { |
| 1092 if (italic_angle != 0) { | 1092 if (italic_angle != 0) { |
| 1093 bItalic = TRUE; | 1093 bItalic = TRUE; |
| 1094 } else { | 1094 } else { |
| 1095 bItalic = FALSE; | 1095 bItalic = FALSE; |
| 1096 } | 1096 } |
| 1097 weight = old_weight; | 1097 weight = old_weight; |
| 1098 } | 1098 } |
| 1099 if (!match.IsEmpty()) { | 1099 if (!match.IsEmpty()) { |
| 1100 hFont = m_pFontInfo->GetFont(match); | 1100 hFont = m_pFontInfo->GetFont(match); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 return TRUE; | 1289 return TRUE; |
| 1290 } | 1290 } |
| 1291 } | 1291 } |
| 1292 for (int i = 0; i < FOXIT_FACE_COUNT; ++i) { | 1292 for (int i = 0; i < FOXIT_FACE_COUNT; ++i) { |
| 1293 if (m_FoxitFaces[i] == face) { | 1293 if (m_FoxitFaces[i] == face) { |
| 1294 return TRUE; | 1294 return TRUE; |
| 1295 } | 1295 } |
| 1296 } | 1296 } |
| 1297 return FALSE; | 1297 return FALSE; |
| 1298 } | 1298 } |
| 1299 #endif | 1299 #endif // PDF_ENABLE_XFA |
| 1300 |
| 1300 extern "C" { | 1301 extern "C" { |
| 1301 unsigned long _FTStreamRead(FXFT_Stream stream, | 1302 unsigned long _FTStreamRead(FXFT_Stream stream, |
| 1302 unsigned long offset, | 1303 unsigned long offset, |
| 1303 unsigned char* buffer, | 1304 unsigned char* buffer, |
| 1304 unsigned long count); | 1305 unsigned long count); |
| 1305 void _FTStreamClose(FXFT_Stream stream); | 1306 void _FTStreamClose(FXFT_Stream stream); |
| 1306 }; | 1307 }; |
| 1307 #if _FX_OS_ == _FX_ANDROID_ | 1308 #if _FX_OS_ == _FX_ANDROID_ |
| 1308 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { | 1309 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { |
| 1309 return NULL; | 1310 return NULL; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 return pFind; | 1512 return pFind; |
| 1512 } | 1513 } |
| 1513 void* CFX_FolderFontInfo::MapFont(int weight, | 1514 void* CFX_FolderFontInfo::MapFont(int weight, |
| 1514 FX_BOOL bItalic, | 1515 FX_BOOL bItalic, |
| 1515 int charset, | 1516 int charset, |
| 1516 int pitch_family, | 1517 int pitch_family, |
| 1517 const FX_CHAR* family, | 1518 const FX_CHAR* family, |
| 1518 int& iExact) { | 1519 int& iExact) { |
| 1519 return NULL; | 1520 return NULL; |
| 1520 } | 1521 } |
| 1522 |
| 1521 #ifdef PDF_ENABLE_XFA | 1523 #ifdef PDF_ENABLE_XFA |
| 1522 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, | 1524 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, |
| 1523 int weight, | 1525 int weight, |
| 1524 FX_BOOL bItalic, | 1526 FX_BOOL bItalic, |
| 1525 int pitch_family) { | 1527 int pitch_family) { |
| 1526 return NULL; | 1528 return NULL; |
| 1527 } | 1529 } |
| 1528 #endif | 1530 #endif // PDF_ENABLE_XFA |
| 1531 |
| 1529 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { | 1532 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { |
| 1530 auto it = m_FontList.find(face); | 1533 auto it = m_FontList.find(face); |
| 1531 return it != m_FontList.end() ? it->second : nullptr; | 1534 return it != m_FontList.end() ? it->second : nullptr; |
| 1532 } | 1535 } |
| 1533 | 1536 |
| 1534 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, | 1537 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, |
| 1535 FX_DWORD table, | 1538 FX_DWORD table, |
| 1536 uint8_t* buffer, | 1539 uint8_t* buffer, |
| 1537 FX_DWORD size) { | 1540 FX_DWORD size) { |
| 1538 if (!hFont) | 1541 if (!hFont) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1591 int PDF_GetStandardFontName(CFX_ByteString* name) { |
| 1589 AltFontName* found = static_cast<AltFontName*>( | 1592 AltFontName* found = static_cast<AltFontName*>( |
| 1590 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1593 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
| 1591 sizeof(AltFontName), CompareString)); | 1594 sizeof(AltFontName), CompareString)); |
| 1592 if (!found) | 1595 if (!found) |
| 1593 return -1; | 1596 return -1; |
| 1594 | 1597 |
| 1595 *name = g_Base14FontNames[found->m_Index]; | 1598 *name = g_Base14FontNames[found->m_Index]; |
| 1596 return found->m_Index; | 1599 return found->m_Index; |
| 1597 } | 1600 } |
| OLD | NEW |