OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fxge/include/cfx_fontmapper.h" | 7 #include "core/fxge/include/cfx_fontmapper.h" |
8 | 8 |
9 #include "core/fxge/include/ifx_systemfontinfo.h" | 9 #include "core/fxge/include/ifx_systemfontinfo.h" |
10 #include "core/fxge/include/fx_font.h" | 10 #include "core/fxge/include/fx_font.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 [Charset](const FaceData& face) { | 682 [Charset](const FaceData& face) { |
683 return face.charset == static_cast<uint32_t>(Charset); | 683 return face.charset == static_cast<uint32_t>(Charset); |
684 }); | 684 }); |
685 if (it == m_FaceArray.end()) { | 685 if (it == m_FaceArray.end()) { |
686 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, | 686 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, |
687 PitchFamily); | 687 PitchFamily); |
688 } | 688 } |
689 hFont = m_pFontInfo->GetFont(it->name.c_str()); | 689 hFont = m_pFontInfo->GetFont(it->name.c_str()); |
690 } | 690 } |
691 } | 691 } |
692 pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); | |
693 if (!hFont) | 692 if (!hFont) |
694 return nullptr; | 693 return nullptr; |
695 | 694 |
696 m_pFontInfo->GetFaceName(hFont, SubstName); | 695 m_pFontInfo->GetFaceName(hFont, SubstName); |
697 if (Charset == FXFONT_DEFAULT_CHARSET) | 696 if (Charset == FXFONT_DEFAULT_CHARSET) |
698 m_pFontInfo->GetFontCharset(hFont, Charset); | 697 m_pFontInfo->GetFontCharset(hFont, Charset); |
699 uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0); | 698 uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0); |
700 uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0); | 699 uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0); |
701 if (font_size == 0 && ttc_size == 0) { | 700 if (font_size == 0 && ttc_size == 0) { |
702 m_pFontInfo->DeleteFont(hFont); | 701 m_pFontInfo->DeleteFont(hFont); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 int PDF_GetStandardFontName(CFX_ByteString* name) { | 831 int PDF_GetStandardFontName(CFX_ByteString* name) { |
833 AltFontName* found = static_cast<AltFontName*>( | 832 AltFontName* found = static_cast<AltFontName*>( |
834 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 833 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
835 sizeof(AltFontName), CompareString)); | 834 sizeof(AltFontName), CompareString)); |
836 if (!found) | 835 if (!found) |
837 return -1; | 836 return -1; |
838 | 837 |
839 *name = g_Base14FontNames[found->m_Index]; | 838 *name = g_Base14FontNames[found->m_Index]; |
840 return found->m_Index; | 839 return found->m_Index; |
841 } | 840 } |
OLD | NEW |