| 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_FGAS_STDFONTMGR_H_ | 7 #ifndef XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ |
| 8 #define XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ | 8 #define XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 uint32_t dwFontStyles); | 21 uint32_t dwFontStyles); |
| 22 FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, | 22 FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, |
| 23 const CFX_FontDescriptors& fonts); | 23 const CFX_FontDescriptors& fonts); |
| 24 | 24 |
| 25 class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { | 25 class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { |
| 26 public: | 26 public: |
| 27 explicit CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator); | 27 explicit CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator); |
| 28 ~CFGAS_StdFontMgrImp() override; | 28 ~CFGAS_StdFontMgrImp() override; |
| 29 | 29 |
| 30 // IFGAS_FontMgr: | 30 // IFGAS_FontMgr: |
| 31 void Release() override; | |
| 32 CFGAS_GEFont* GetDefFontByCodePage( | 31 CFGAS_GEFont* GetDefFontByCodePage( |
| 33 uint16_t wCodePage, | 32 uint16_t wCodePage, |
| 34 uint32_t dwFontStyles, | 33 uint32_t dwFontStyles, |
| 35 const FX_WCHAR* pszFontFamily = nullptr) override; | 34 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 36 CFGAS_GEFont* GetDefFontByCharset( | 35 CFGAS_GEFont* GetDefFontByCharset( |
| 37 uint8_t nCharset, | 36 uint8_t nCharset, |
| 38 uint32_t dwFontStyles, | 37 uint32_t dwFontStyles, |
| 39 const FX_WCHAR* pszFontFamily = nullptr) override; | 38 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 40 CFGAS_GEFont* GetDefFontByUnicode( | 39 CFGAS_GEFont* GetDefFontByUnicode( |
| 41 FX_WCHAR wUnicode, | 40 FX_WCHAR wUnicode, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 124 } |
| 126 void* pFileHandle; | 125 void* pFileHandle; |
| 127 CFX_ByteString bsParentPath; | 126 CFX_ByteString bsParentPath; |
| 128 }; | 127 }; |
| 129 | 128 |
| 130 class CFX_FontSourceEnum_File { | 129 class CFX_FontSourceEnum_File { |
| 131 public: | 130 public: |
| 132 CFX_FontSourceEnum_File(); | 131 CFX_FontSourceEnum_File(); |
| 133 ~CFX_FontSourceEnum_File(); | 132 ~CFX_FontSourceEnum_File(); |
| 134 | 133 |
| 135 void Release() { delete this; } | |
| 136 FX_POSITION GetStartPosition(); | 134 FX_POSITION GetStartPosition(); |
| 137 IFX_FileAccess* GetNext(FX_POSITION& pos); | 135 IFX_FileAccess* GetNext(FX_POSITION& pos); |
| 138 | 136 |
| 139 private: | 137 private: |
| 140 CFX_ByteString GetNextFile(); | 138 CFX_ByteString GetNextFile(); |
| 141 | 139 |
| 142 CFX_WideString m_wsNext; | 140 CFX_WideString m_wsNext; |
| 143 CFX_ObjectArray<FX_HandleParentPath> m_FolderQueue; | 141 CFX_ObjectArray<FX_HandleParentPath> m_FolderQueue; |
| 144 CFX_ByteStringArray m_FolderPaths; | 142 CFX_ByteStringArray m_FolderPaths; |
| 145 }; | 143 }; |
| 146 | 144 |
| 147 class CFGAS_FontMgrImp : public IFGAS_FontMgr { | 145 class CFGAS_FontMgrImp : public IFGAS_FontMgr { |
| 148 public: | 146 public: |
| 149 explicit CFGAS_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum); | 147 explicit CFGAS_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum); |
| 150 ~CFGAS_FontMgrImp() override; | 148 ~CFGAS_FontMgrImp() override; |
| 151 | 149 |
| 152 // IFGAS_FontMgr: | 150 // IFGAS_FontMgr: |
| 153 void Release() override; | 151 CFGAS_GEFont* GetDefFontByCodePage(uint16_t wCodePage, |
| 154 CFGAS_GEFont* GetDefFontByCodePage( | 152 uint32_t dwFontStyles, |
| 155 uint16_t wCodePage, | 153 const FX_WCHAR* pszFontFamily) override; |
| 156 uint32_t dwFontStyles, | 154 CFGAS_GEFont* GetDefFontByCharset(uint8_t nCharset, |
| 157 const FX_WCHAR* pszFontFamily = nullptr) override; | 155 uint32_t dwFontStyles, |
| 158 CFGAS_GEFont* GetDefFontByCharset( | 156 const FX_WCHAR* pszFontFamily) override; |
| 159 uint8_t nCharset, | 157 CFGAS_GEFont* GetDefFontByUnicode(FX_WCHAR wUnicode, |
| 160 uint32_t dwFontStyles, | 158 uint32_t dwFontStyles, |
| 161 const FX_WCHAR* pszFontFamily = nullptr) override; | 159 const FX_WCHAR* pszFontFamily) override; |
| 162 CFGAS_GEFont* GetDefFontByUnicode( | 160 CFGAS_GEFont* GetDefFontByLanguage(uint16_t wLanguage, |
| 163 FX_WCHAR wUnicode, | 161 uint32_t dwFontStyles, |
| 164 uint32_t dwFontStyles, | 162 const FX_WCHAR* pszFontFamily) override; |
| 165 const FX_WCHAR* pszFontFamily = nullptr) override; | 163 CFGAS_GEFont* GetFontByCodePage(uint16_t wCodePage, |
| 166 CFGAS_GEFont* GetDefFontByLanguage( | 164 uint32_t dwFontStyles, |
| 167 uint16_t wLanguage, | 165 const FX_WCHAR* pszFontFamily) override; |
| 168 uint32_t dwFontStyles, | 166 CFGAS_GEFont* GetFontByCharset(uint8_t nCharset, |
| 169 const FX_WCHAR* pszFontFamily = nullptr) override; | 167 uint32_t dwFontStyles, |
| 170 CFGAS_GEFont* GetFontByCodePage( | 168 const FX_WCHAR* pszFontFamily) override; |
| 171 uint16_t wCodePage, | 169 CFGAS_GEFont* GetFontByUnicode(FX_WCHAR wUnicode, |
| 172 uint32_t dwFontStyles, | 170 uint32_t dwFontStyles, |
| 173 const FX_WCHAR* pszFontFamily = nullptr) override; | 171 const FX_WCHAR* pszFontFamily) override; |
| 174 CFGAS_GEFont* GetFontByCharset( | 172 CFGAS_GEFont* GetFontByLanguage(uint16_t wLanguage, |
| 175 uint8_t nCharset, | 173 uint32_t dwFontStyles, |
| 176 uint32_t dwFontStyles, | 174 const FX_WCHAR* pszFontFamily) override; |
| 177 const FX_WCHAR* pszFontFamily = nullptr) override; | |
| 178 CFGAS_GEFont* GetFontByUnicode( | |
| 179 FX_WCHAR wUnicode, | |
| 180 uint32_t dwFontStyles, | |
| 181 const FX_WCHAR* pszFontFamily = nullptr) override; | |
| 182 CFGAS_GEFont* GetFontByLanguage( | |
| 183 uint16_t wLanguage, | |
| 184 uint32_t dwFontStyles, | |
| 185 const FX_WCHAR* pszFontFamily = nullptr) override; | |
| 186 void ClearFontCache() override; | 175 void ClearFontCache() override; |
| 187 void RemoveFont(CFGAS_GEFont* pFont) override; | 176 void RemoveFont(CFGAS_GEFont* pFont) override; |
| 188 | 177 |
| 189 CFGAS_GEFont* LoadFont(const CFX_WideString& wsFaceName, | 178 CFGAS_GEFont* LoadFont(const CFX_WideString& wsFaceName, |
| 190 int32_t iFaceIndex, | 179 int32_t iFaceIndex, |
| 191 int32_t* pFaceCount); | 180 int32_t* pFaceCount); |
| 192 FX_BOOL EnumFonts(); | 181 FX_BOOL EnumFonts(); |
| 193 FX_BOOL EnumFontsFromFontMapper(); | 182 FX_BOOL EnumFontsFromFontMapper(); |
| 194 FX_BOOL EnumFontsFromFiles(); | 183 FX_BOOL EnumFontsFromFiles(); |
| 195 | 184 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 225 | 214 |
| 226 CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList; | 215 CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList; |
| 227 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<CFGAS_GEFont*>*> m_Hash2Fonts; | 216 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<CFGAS_GEFont*>*> m_Hash2Fonts; |
| 228 CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_FileRead*> m_IFXFont2FileRead; | 217 CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_FileRead*> m_IFXFont2FileRead; |
| 229 CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2Nullptr; | 218 CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2Nullptr; |
| 230 CFX_FontSourceEnum_File* const m_pFontSource; | 219 CFX_FontSourceEnum_File* const m_pFontSource; |
| 231 }; | 220 }; |
| 232 #endif | 221 #endif |
| 233 | 222 |
| 234 #endif // XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ | 223 #endif // XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ |
| OLD | NEW |