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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 | 704 |
705 CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) { | 705 CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) { |
706 if (!m_pFontInfo) | 706 if (!m_pFontInfo) |
707 return CFX_ByteString(); | 707 return CFX_ByteString(); |
708 | 708 |
709 FX_DWORD size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0); | 709 FX_DWORD size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0); |
710 if (!size) | 710 if (!size) |
711 return CFX_ByteString(); | 711 return CFX_ByteString(); |
712 | 712 |
713 std::vector<uint8_t> buffer(size); | 713 std::vector<uint8_t> buffer(size); |
714 uint8_t* buffer_ptr = pdfium::vector_as_array(&buffer); | 714 uint8_t* buffer_ptr = buffer.data(); |
715 FX_DWORD bytes_read = | 715 FX_DWORD bytes_read = |
716 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); | 716 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); |
717 return (bytes_read == size) ? GetNameFromTT(buffer_ptr, 6) : CFX_ByteString(); | 717 return (bytes_read == size) ? GetNameFromTT(buffer_ptr, 6) : CFX_ByteString(); |
718 } | 718 } |
719 | 719 |
720 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { | 720 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { |
721 if (!m_pFontInfo) { | 721 if (!m_pFontInfo) { |
722 return; | 722 return; |
723 } | 723 } |
724 if (m_CharsetArray.Find((FX_DWORD)charset) == -1) { | 724 if (m_CharsetArray.Find((FX_DWORD)charset) == -1) { |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1504 int PDF_GetStandardFontName(CFX_ByteString* name) { |
1505 AltFontName* found = static_cast<AltFontName*>( | 1505 AltFontName* found = static_cast<AltFontName*>( |
1506 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1506 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
1507 sizeof(AltFontName), CompareString)); | 1507 sizeof(AltFontName), CompareString)); |
1508 if (!found) | 1508 if (!found) |
1509 return -1; | 1509 return -1; |
1510 | 1510 |
1511 *name = g_Base14FontNames[found->m_Index]; | 1511 *name = g_Base14FontNames[found->m_Index]; |
1512 return found->m_Index; | 1512 return found->m_Index; |
1513 } | 1513 } |
OLD | NEW |