| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "fpdfsdk/include/fsdk_mgr.h" | 10 #include "fpdfsdk/include/fsdk_mgr.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 int32_t nCharset, | 169 int32_t nCharset, |
| 170 CFX_ByteString sFontFaceName) { | 170 CFX_ByteString sFontFaceName) { |
| 171 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); | 171 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); |
| 172 if (!pFontMgr) | 172 if (!pFontMgr) |
| 173 return FALSE; | 173 return FALSE; |
| 174 | 174 |
| 175 CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); | 175 CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); |
| 176 if (!pFontMapper) | 176 if (!pFontMapper) |
| 177 return FALSE; | 177 return FALSE; |
| 178 | 178 |
| 179 int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | 179 if (pFontMapper->m_InstalledTTFonts.empty()) |
| 180 if (nSize == 0) { | |
| 181 pFontMapper->LoadInstalledFonts(); | 180 pFontMapper->LoadInstalledFonts(); |
| 182 nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | |
| 183 } | |
| 184 | 181 |
| 185 for (int i = 0; i < nSize; ++i) { | 182 for (const auto& font : pFontMapper->m_InstalledTTFonts) { |
| 186 if (pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) | 183 if (font.Compare(sFontFaceName)) |
| 187 return TRUE; | 184 return TRUE; |
| 188 } | 185 } |
| 189 | 186 |
| 190 return FALSE; | 187 return FALSE; |
| 191 } | 188 } |
| 192 | 189 |
| 193 CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF( | 190 CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF( |
| 194 CPDF_Document* pDoc, | 191 CPDF_Document* pDoc, |
| 195 CFX_ByteString sFontFaceName, | 192 CFX_ByteString sFontFaceName, |
| 196 uint8_t nCharset) { | 193 uint8_t nCharset) { |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1189 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
| 1193 if (!pFocusAnnot) | 1190 if (!pFocusAnnot) |
| 1194 return nullptr; | 1191 return nullptr; |
| 1195 | 1192 |
| 1196 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1193 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
| 1197 if (pAnnot == pFocusAnnot) | 1194 if (pAnnot == pFocusAnnot) |
| 1198 return pAnnot; | 1195 return pAnnot; |
| 1199 } | 1196 } |
| 1200 return nullptr; | 1197 return nullptr; |
| 1201 } | 1198 } |
| OLD | NEW |