| 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 "core/fpdfapi/font/font_int.h" | 7 #include "core/fpdfapi/font/font_int.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/cpdf_modulemgr.h" | 9 #include "core/fpdfapi/cpdf_modulemgr.h" |
| 10 #include "core/fpdfapi/page/cpdf_form.h" | 10 #include "core/fpdfapi/page/cpdf_form.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return true; | 40 return true; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 CFX_StockFontArray::CFX_StockFontArray() {} | 46 CFX_StockFontArray::CFX_StockFontArray() {} |
| 47 | 47 |
| 48 CFX_StockFontArray::~CFX_StockFontArray() { | 48 CFX_StockFontArray::~CFX_StockFontArray() { |
| 49 for (size_t i = 0; i < FX_ArraySize(m_StockFonts); ++i) { | 49 for (size_t i = 0; i < FX_ArraySize(m_StockFonts); ++i) { |
| 50 if (m_StockFonts[i]) | 50 if (!m_StockFonts[i]) |
| 51 delete m_StockFonts[i]->GetFontDict(); | 51 continue; |
| 52 CPDF_Dictionary* pFontDict = m_StockFonts[i]->GetFontDict(); |
| 53 if (pFontDict) |
| 54 pFontDict->Release(); |
| 52 } | 55 } |
| 53 } | 56 } |
| 54 | 57 |
| 55 CPDF_Font* CFX_StockFontArray::GetFont(uint32_t index) const { | 58 CPDF_Font* CFX_StockFontArray::GetFont(uint32_t index) const { |
| 56 if (index >= FX_ArraySize(m_StockFonts)) | 59 if (index >= FX_ArraySize(m_StockFonts)) |
| 57 return nullptr; | 60 return nullptr; |
| 58 return m_StockFonts[index].get(); | 61 return m_StockFonts[index].get(); |
| 59 } | 62 } |
| 60 | 63 |
| 61 CPDF_Font* CFX_StockFontArray::SetFont(uint32_t index, | 64 CPDF_Font* CFX_StockFontArray::SetFont(uint32_t index, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 305 } |
| 303 if (cid_set) { | 306 if (cid_set) { |
| 304 m_pBaseMap = CPDF_ModuleMgr::Get() | 307 m_pBaseMap = CPDF_ModuleMgr::Get() |
| 305 ->GetPageModule() | 308 ->GetPageModule() |
| 306 ->GetFontGlobals() | 309 ->GetFontGlobals() |
| 307 ->m_CMapManager.GetCID2UnicodeMap(cid_set, false); | 310 ->m_CMapManager.GetCID2UnicodeMap(cid_set, false); |
| 308 } else { | 311 } else { |
| 309 m_pBaseMap = nullptr; | 312 m_pBaseMap = nullptr; |
| 310 } | 313 } |
| 311 } | 314 } |
| OLD | NEW |