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_fontmgr.h" | 7 #include "core/fxge/include/cfx_fontmgr.h" |
8 | 8 |
9 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h" | 9 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h" |
10 #include "core/fxge/ge/cttfontdesc.h" | 10 #include "core/fxge/ge/cttfontdesc.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 face_index = 0; | 74 face_index = 0; |
75 else | 75 else |
76 face_index = index; | 76 face_index = index; |
77 return face_index; | 77 return face_index; |
78 } | 78 } |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 CFX_FontMgr::CFX_FontMgr() | 82 CFX_FontMgr::CFX_FontMgr() |
83 : m_FTLibrary(nullptr), m_FTLibrarySupportsHinting(false) { | 83 : m_FTLibrary(nullptr), m_FTLibrarySupportsHinting(false) { |
84 m_pBuiltinMapper.reset(new CFX_FontMapper(this)); | 84 m_pBuiltinMapper = WrapUnique(new CFX_FontMapper(this)); |
85 } | 85 } |
86 | 86 |
87 CFX_FontMgr::~CFX_FontMgr() { | 87 CFX_FontMgr::~CFX_FontMgr() { |
88 for (const auto& pair : m_FaceMap) | 88 for (const auto& pair : m_FaceMap) |
89 delete pair.second; | 89 delete pair.second; |
90 | 90 |
91 // |m_pBuiltinMapper| references |m_FTLibrary|, so it has to be destroyed | 91 // |m_pBuiltinMapper| references |m_FTLibrary|, so it has to be destroyed |
92 // first. | 92 // first. |
93 m_pBuiltinMapper.reset(); | 93 m_pBuiltinMapper.reset(); |
94 FXFT_Done_FreeType(m_FTLibrary); | 94 FXFT_Done_FreeType(m_FTLibrary); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 return true; | 250 return true; |
251 } | 251 } |
252 index -= FX_ArraySize(g_FoxitFonts); | 252 index -= FX_ArraySize(g_FoxitFonts); |
253 if (index < FX_ArraySize(g_MMFonts)) { | 253 if (index < FX_ArraySize(g_MMFonts)) { |
254 *pFontData = g_MMFonts[index].m_pFontData; | 254 *pFontData = g_MMFonts[index].m_pFontData; |
255 *size = g_MMFonts[index].m_dwSize; | 255 *size = g_MMFonts[index].m_dwSize; |
256 return true; | 256 return true; |
257 } | 257 } |
258 return false; | 258 return false; |
259 } | 259 } |
OLD | NEW |