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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) { | 141 CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) { |
142 return ""; | 142 return ""; |
143 } | 143 } |
144 | 144 |
145 FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont( | 145 FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont( |
146 int32_t nCharset, | 146 int32_t nCharset, |
147 CFX_ByteString sFontFaceName) { | 147 CFX_ByteString sFontFaceName) { |
148 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); | 148 CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); |
149 if (pFontMgr) { | 149 if (!pFontMgr) |
150 CFX_FontMapper* pFontMapper = pFontMgr->m_pBuiltinMapper; | 150 return FALSE; |
151 if (pFontMapper) { | |
152 int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | |
153 if (nSize == 0) { | |
154 pFontMapper->LoadInstalledFonts(); | |
155 nSize = pFontMapper->m_InstalledTTFonts.GetSize(); | |
156 } | |
157 | 151 |
158 for (int i = 0; i < nSize; i++) { | 152 CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); |
159 if (pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) | 153 if (!pFontMapper) |
160 return TRUE; | 154 return FALSE; |
161 } | 155 |
162 } | 156 int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); |
| 157 if (nSize == 0) { |
| 158 pFontMapper->LoadInstalledFonts(); |
| 159 nSize = pFontMapper->m_InstalledTTFonts.GetSize(); |
| 160 } |
| 161 |
| 162 for (int i = 0; i < nSize; ++i) { |
| 163 if (pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) |
| 164 return TRUE; |
163 } | 165 } |
164 | 166 |
165 return FALSE; | 167 return FALSE; |
166 } | 168 } |
167 | 169 |
168 static int CharSet2CP(int charset) { | 170 static int CharSet2CP(int charset) { |
169 if (charset == 128) | 171 if (charset == 128) |
170 return 932; | 172 return 932; |
171 if (charset == 134) | 173 if (charset == 134) |
172 return 936; | 174 return 936; |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 if (!pFocusAnnot) | 1178 if (!pFocusAnnot) |
1177 return NULL; | 1179 return NULL; |
1178 | 1180 |
1179 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) { | 1181 for (int i = 0; i < m_fxAnnotArray.GetSize(); i++) { |
1180 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); | 1182 CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); |
1181 if (pAnnot == pFocusAnnot) | 1183 if (pAnnot == pFocusAnnot) |
1182 return pAnnot; | 1184 return pAnnot; |
1183 } | 1185 } |
1184 return NULL; | 1186 return NULL; |
1185 } | 1187 } |
OLD | NEW |