| 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 uint32_t bytes_read = | 737 uint32_t bytes_read = |
| 738 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); | 738 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); |
| 739 return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6) | 739 return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6) |
| 740 : CFX_ByteString(); | 740 : CFX_ByteString(); |
| 741 } | 741 } |
| 742 | 742 |
| 743 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { | 743 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { |
| 744 if (!m_pFontInfo) | 744 if (!m_pFontInfo) |
| 745 return; | 745 return; |
| 746 | 746 |
| 747 m_FaceArray.push_back({name, static_cast<uint32_t>(charset)}); | 747 m_FaceArray.push_back({name, charset}); |
| 748 if (name == m_LastFamily) | 748 if (name == m_LastFamily) |
| 749 return; | 749 return; |
| 750 | 750 |
| 751 const uint8_t* ptr = name.raw_str(); | 751 const uint8_t* ptr = name.raw_str(); |
| 752 FX_BOOL bLocalized = FALSE; | 752 FX_BOOL bLocalized = FALSE; |
| 753 for (int i = 0; i < name.GetLength(); i++) { | 753 for (int i = 0; i < name.GetLength(); i++) { |
| 754 if (ptr[i] > 0x80) { | 754 if (ptr[i] > 0x80) { |
| 755 bLocalized = TRUE; | 755 bLocalized = TRUE; |
| 756 break; | 756 break; |
| 757 } | 757 } |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1642 int PDF_GetStandardFontName(CFX_ByteString* name) { |
| 1643 AltFontName* found = static_cast<AltFontName*>( | 1643 AltFontName* found = static_cast<AltFontName*>( |
| 1644 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1644 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
| 1645 sizeof(AltFontName), CompareString)); | 1645 sizeof(AltFontName), CompareString)); |
| 1646 if (!found) | 1646 if (!found) |
| 1647 return -1; | 1647 return -1; |
| 1648 | 1648 |
| 1649 *name = g_Base14FontNames[found->m_Index]; | 1649 *name = g_Base14FontNames[found->m_Index]; |
| 1650 return found->m_Index; | 1650 return found->m_Index; |
| 1651 } | 1651 } |
| OLD | NEW |