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 "../../public/fpdf_ext.h" | 7 #include "../../public/fpdf_ext.h" |
8 #include "../../third_party/base/nonstd_unique_ptr.h" | 8 #include "../../third_party/base/nonstd_unique_ptr.h" |
9 #include "../include/formfiller/FFL_FormFiller.h" | 9 #include "../include/formfiller/FFL_FormFiller.h" |
10 #include "../include/fsdk_define.h" | 10 #include "../include/fsdk_define.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) { | 140 CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) { |
141 return ""; | 141 return ""; |
142 } | 142 } |
143 | 143 |
144 FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont( | 144 FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont( |
145 int32_t nCharset, | 145 int32_t nCharset, |
146 CFX_ByteString sFontFaceName) { | 146 CFX_ByteString sFontFaceName) { |
147 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); | 147 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); |
148 if (pFontMgr) { | 148 if (!pFontMgr) |
149 CFX_FontMapper* pFontMapper = pFontMgr->m_pBuiltinMapper; | 149 return FALSE; |
150 if (pFontMapper) { | |
151 int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | |
152 if (nSize == 0) { | |
153 pFontMapper->LoadInstalledFonts(); | |
154 nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | |
155 } | |
156 | 150 |
157 for (int i = 0; i < nSize; i++) { | 151 CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); |
158 if (pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) | 152 if (!pFontMapper) |
159 return TRUE; | 153 return FALSE; |
160 } | 154 |
161 } | 155 int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); |
| 156 if (nSize == 0) { |
| 157 pFontMapper->LoadInstalledFonts(); |
| 158 nSize = pFontMapper->m_InstalledTTFonts.GetSize(); |
| 159 } |
| 160 |
| 161 for (int i = 0; i < nSize; ++i) { |
| 162 if (pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) |
| 163 return TRUE; |
162 } | 164 } |
163 | 165 |
164 return FALSE; | 166 return FALSE; |
165 } | 167 } |
166 | 168 |
167 static int CharSet2CP(int charset) { | 169 static int CharSet2CP(int charset) { |
168 if (charset == 128) | 170 if (charset == 128) |
169 return 932; | 171 return 932; |
170 if (charset == 134) | 172 if (charset == 134) |
171 return 936; | 173 return 936; |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 if (!pFocusAnnot) | 987 if (!pFocusAnnot) |
986 return NULL; | 988 return NULL; |
987 | 989 |
988 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) { | 990 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) { |
989 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 991 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
990 if (pAnnot == pFocusAnnot) | 992 if (pAnnot == pFocusAnnot) |
991 return pAnnot; | 993 return pAnnot; |
992 } | 994 } |
993 return NULL; | 995 return NULL; |
994 } | 996 } |
OLD | NEW |