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 #ifndef XFA_FGAS_FONT_CFGAS_FONTMGR_H_ | 7 #ifndef XFA_FGAS_FONT_CFGAS_FONTMGR_H_ |
8 #define XFA_FGAS_FONT_CFGAS_FONTMGR_H_ | 8 #define XFA_FGAS_FONT_CFGAS_FONTMGR_H_ |
9 | 9 |
| 10 #include <map> |
10 #include <memory> | 11 #include <memory> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "core/fxcrt/fx_ext.h" | 14 #include "core/fxcrt/fx_ext.h" |
14 #include "core/fxge/cfx_fontmapper.h" | 15 #include "core/fxge/cfx_fontmapper.h" |
15 #include "core/fxge/fx_freetype.h" | 16 #include "core/fxge/fx_freetype.h" |
16 #include "core/fxge/ifx_systemfontinfo.h" | 17 #include "core/fxge/ifx_systemfontinfo.h" |
17 #include "third_party/freetype/include/freetype/fttypes.h" | 18 #include "third_party/freetype/include/freetype/fttypes.h" |
18 #include "xfa/fgas/crt/fgas_stream.h" | 19 #include "xfa/fgas/crt/fgas_stream.h" |
19 #include "xfa/fgas/font/cfgas_fontmgr.h" | 20 #include "xfa/fgas/font/cfgas_fontmgr.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 uint32_t dwFontStyles, | 208 uint32_t dwFontStyles, |
208 uint16_t wCodePage) { | 209 uint16_t wCodePage) { |
209 return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); | 210 return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); |
210 } | 211 } |
211 | 212 |
212 private: | 213 private: |
213 bool EnumFonts(); | 214 bool EnumFonts(); |
214 bool EnumFontsFromFontMapper(); | 215 bool EnumFontsFromFontMapper(); |
215 bool EnumFontsFromFiles(); | 216 bool EnumFontsFromFiles(); |
216 void RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName); | 217 void RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName); |
217 void RegisterFaces(IFX_SeekableReadStream* pFontStream, | 218 void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, |
218 const CFX_WideString* pFaceName); | 219 const CFX_WideString* pFaceName); |
219 void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names); | 220 void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names); |
220 std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; | 221 std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; |
221 void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); | 222 void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); |
222 uint32_t GetFlags(FXFT_Face pFace); | 223 uint32_t GetFlags(FXFT_Face pFace); |
223 bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); | 224 bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); |
224 bool VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode); | 225 bool VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode); |
225 int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); | 226 int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); |
226 int32_t MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, | 227 int32_t MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, |
227 uint16_t wCodePage, | 228 uint16_t wCodePage, |
228 uint32_t dwFontStyles, | 229 uint32_t dwFontStyles, |
229 const CFX_WideString& FontName, | 230 const CFX_WideString& FontName, |
230 FX_WCHAR wcUnicode = 0xFFFE); | 231 FX_WCHAR wcUnicode = 0xFFFE); |
231 int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, | 232 int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, |
232 uint16_t wCodePage, | 233 uint16_t wCodePage, |
233 uint32_t dwFontStyles, | 234 uint32_t dwFontStyles, |
234 const CFX_WideString& FontName, | 235 const CFX_WideString& FontName, |
235 FX_WCHAR wcUnicode = 0xFFFE); | 236 FX_WCHAR wcUnicode = 0xFFFE); |
236 CFGAS_GEFont* LoadFont(const CFX_WideString& wsFaceName, | 237 CFGAS_GEFont* LoadFont(const CFX_WideString& wsFaceName, |
237 int32_t iFaceIndex, | 238 int32_t iFaceIndex, |
238 int32_t* pFaceCount); | 239 int32_t* pFaceCount); |
239 FXFT_Face LoadFace(IFX_SeekableReadStream* pFontStream, int32_t iFaceIndex); | 240 FXFT_Face LoadFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, |
240 IFX_SeekableReadStream* CreateFontStream(CFX_FontMapper* pFontMapper, | 241 int32_t iFaceIndex); |
241 IFX_SystemFontInfo* pSystemFontInfo, | 242 CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( |
242 uint32_t index); | 243 CFX_FontMapper* pFontMapper, |
243 IFX_SeekableReadStream* CreateFontStream(const CFX_ByteString& bsFaceName); | 244 IFX_SystemFontInfo* pSystemFontInfo, |
| 245 uint32_t index); |
| 246 CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( |
| 247 const CFX_ByteString& bsFaceName); |
244 | 248 |
245 CFX_FontDescriptors m_InstalledFonts; | 249 CFX_FontDescriptors m_InstalledFonts; |
246 CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList; | 250 CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList; |
247 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<CFGAS_GEFont*>*> m_Hash2Fonts; | 251 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<CFGAS_GEFont*>*> m_Hash2Fonts; |
248 CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_SeekableReadStream*> m_IFXFont2FileRead; | 252 std::map<CFGAS_GEFont*, CFX_RetainPtr<IFX_SeekableReadStream> > |
| 253 m_IFXFont2FileRead; |
249 CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2Nullptr; | 254 CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2Nullptr; |
250 CFX_FontSourceEnum_File* const m_pFontSource; | 255 CFX_FontSourceEnum_File* const m_pFontSource; |
251 }; | 256 }; |
252 #endif | 257 #endif |
253 | 258 |
254 #endif // XFA_FGAS_FONT_CFGAS_FONTMGR_H_ | 259 #endif // XFA_FGAS_FONT_CFGAS_FONTMGR_H_ |
OLD | NEW |