| 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 "core/fxcrt/include/fx_ext.h" | 10 #include "core/fxcrt/include/fx_ext.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { | 21 class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { |
| 22 public: | 22 public: |
| 23 explicit CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator); | 23 explicit CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator); |
| 24 ~CFGAS_StdFontMgrImp() override; | 24 ~CFGAS_StdFontMgrImp() override; |
| 25 | 25 |
| 26 // IFGAS_FontMgr: | 26 // IFGAS_FontMgr: |
| 27 void Release() override { delete this; } | 27 void Release() override { delete this; } |
| 28 IFGAS_Font* GetDefFontByCodePage( | 28 IFGAS_Font* GetDefFontByCodePage( |
| 29 uint16_t wCodePage, | 29 uint16_t wCodePage, |
| 30 uint32_t dwFontStyles, | 30 uint32_t dwFontStyles, |
| 31 const FX_WCHAR* pszFontFamily = NULL) override; | 31 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 32 IFGAS_Font* GetDefFontByCharset( | 32 IFGAS_Font* GetDefFontByCharset( |
| 33 uint8_t nCharset, | 33 uint8_t nCharset, |
| 34 uint32_t dwFontStyles, | 34 uint32_t dwFontStyles, |
| 35 const FX_WCHAR* pszFontFamily = NULL) override; | 35 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 36 IFGAS_Font* GetDefFontByUnicode( | 36 IFGAS_Font* GetDefFontByUnicode( |
| 37 FX_WCHAR wUnicode, | 37 FX_WCHAR wUnicode, |
| 38 uint32_t dwFontStyles, | 38 uint32_t dwFontStyles, |
| 39 const FX_WCHAR* pszFontFamily = NULL) override; | 39 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 40 IFGAS_Font* GetDefFontByLanguage( | 40 IFGAS_Font* GetDefFontByLanguage( |
| 41 uint16_t wLanguage, | 41 uint16_t wLanguage, |
| 42 uint32_t dwFontStyles, | 42 uint32_t dwFontStyles, |
| 43 const FX_WCHAR* pszFontFamily = NULL) override; | 43 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 44 IFGAS_Font* LoadFont(const FX_WCHAR* pszFontFamily, | 44 IFGAS_Font* LoadFont(const FX_WCHAR* pszFontFamily, |
| 45 uint32_t dwFontStyles, | 45 uint32_t dwFontStyles, |
| 46 uint16_t wCodePage = 0xFFFF) override; | 46 uint16_t wCodePage = 0xFFFF) override; |
| 47 IFGAS_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) override; | 47 IFGAS_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) override; |
| 48 IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName) override; | 48 IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName) override; |
| 49 IFGAS_Font* LoadFont(IFX_Stream* pFontStream, | 49 IFGAS_Font* LoadFont(IFX_Stream* pFontStream, |
| 50 const FX_WCHAR* pszFontAlias = NULL, | 50 const FX_WCHAR* pszFontAlias = nullptr, |
| 51 uint32_t dwFontStyles = 0, | 51 uint32_t dwFontStyles = 0, |
| 52 uint16_t wCodePage = 0, | 52 uint16_t wCodePage = 0, |
| 53 FX_BOOL bSaveStream = FALSE) override; | 53 FX_BOOL bSaveStream = FALSE) override; |
| 54 IFGAS_Font* LoadFont(IFGAS_Font* pSrcFont, | 54 IFGAS_Font* LoadFont(IFGAS_Font* pSrcFont, |
| 55 uint32_t dwFontStyles, | 55 uint32_t dwFontStyles, |
| 56 uint16_t wCodePage = 0xFFFF) override; | 56 uint16_t wCodePage = 0xFFFF) override; |
| 57 | 57 |
| 58 void ClearFontCache() override; | 58 void ClearFontCache() override; |
| 59 void RemoveFont(IFGAS_Font* pFont) override; | 59 void RemoveFont(IFGAS_Font* pFont) override; |
| 60 | 60 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 79 CFX_MapPtrToPtr m_StreamFonts; | 79 CFX_MapPtrToPtr m_StreamFonts; |
| 80 CFX_MapPtrToPtr m_DeriveFonts; | 80 CFX_MapPtrToPtr m_DeriveFonts; |
| 81 }; | 81 }; |
| 82 uint32_t FX_GetGdiFontStyles(const LOGFONTW& lf); | 82 uint32_t FX_GetGdiFontStyles(const LOGFONTW& lf); |
| 83 | 83 |
| 84 #else | 84 #else |
| 85 | 85 |
| 86 class CFX_FontDescriptor { | 86 class CFX_FontDescriptor { |
| 87 public: | 87 public: |
| 88 CFX_FontDescriptor() | 88 CFX_FontDescriptor() |
| 89 : m_pFileAccess(NULL), m_nFaceIndex(0), m_dwFontStyles(0) { | 89 : m_pFileAccess(nullptr), m_nFaceIndex(0), m_dwFontStyles(0) { |
| 90 m_dwUsb[0] = m_dwUsb[1] = m_dwUsb[2] = m_dwUsb[3] = 0; | 90 m_dwUsb[0] = m_dwUsb[1] = m_dwUsb[2] = m_dwUsb[3] = 0; |
| 91 m_dwCsb[0] = m_dwCsb[1] = 0; | 91 m_dwCsb[0] = m_dwCsb[1] = 0; |
| 92 } | 92 } |
| 93 |
| 93 ~CFX_FontDescriptor() { | 94 ~CFX_FontDescriptor() { |
| 94 if (NULL != m_pFileAccess) { | 95 if (m_pFileAccess) |
| 95 m_pFileAccess->Release(); | 96 m_pFileAccess->Release(); |
| 96 } | |
| 97 } | 97 } |
| 98 |
| 98 IFX_FileAccess* m_pFileAccess; | 99 IFX_FileAccess* m_pFileAccess; |
| 99 int32_t m_nFaceIndex; | 100 int32_t m_nFaceIndex; |
| 100 CFX_WideString m_wsFaceName; | 101 CFX_WideString m_wsFaceName; |
| 101 CFX_WideStringArray m_wsFamilyNames; | 102 CFX_WideStringArray m_wsFamilyNames; |
| 102 uint32_t m_dwFontStyles; | 103 uint32_t m_dwFontStyles; |
| 103 uint32_t m_dwUsb[4]; | 104 uint32_t m_dwUsb[4]; |
| 104 uint32_t m_dwCsb[2]; | 105 uint32_t m_dwCsb[2]; |
| 105 }; | 106 }; |
| 106 typedef CFX_ArrayTemplate<CFX_FontDescriptor*> CFX_FontDescriptors; | 107 typedef CFX_ArrayTemplate<CFX_FontDescriptor*> CFX_FontDescriptors; |
| 107 | 108 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 class CFGAS_FontMgrImp : public IFGAS_FontMgr { | 152 class CFGAS_FontMgrImp : public IFGAS_FontMgr { |
| 152 public: | 153 public: |
| 153 explicit CFGAS_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum); | 154 explicit CFGAS_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum); |
| 154 ~CFGAS_FontMgrImp() override; | 155 ~CFGAS_FontMgrImp() override; |
| 155 | 156 |
| 156 // IFGAS_FontMgr: | 157 // IFGAS_FontMgr: |
| 157 void Release() override; | 158 void Release() override; |
| 158 IFGAS_Font* GetDefFontByCodePage( | 159 IFGAS_Font* GetDefFontByCodePage( |
| 159 uint16_t wCodePage, | 160 uint16_t wCodePage, |
| 160 uint32_t dwFontStyles, | 161 uint32_t dwFontStyles, |
| 161 const FX_WCHAR* pszFontFamily = NULL) override; | 162 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 162 IFGAS_Font* GetDefFontByCharset( | 163 IFGAS_Font* GetDefFontByCharset( |
| 163 uint8_t nCharset, | 164 uint8_t nCharset, |
| 164 uint32_t dwFontStyles, | 165 uint32_t dwFontStyles, |
| 165 const FX_WCHAR* pszFontFamily = NULL) override; | 166 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 166 IFGAS_Font* GetDefFontByUnicode( | 167 IFGAS_Font* GetDefFontByUnicode( |
| 167 FX_WCHAR wUnicode, | 168 FX_WCHAR wUnicode, |
| 168 uint32_t dwFontStyles, | 169 uint32_t dwFontStyles, |
| 169 const FX_WCHAR* pszFontFamily = NULL) override; | 170 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 170 IFGAS_Font* GetDefFontByLanguage( | 171 IFGAS_Font* GetDefFontByLanguage( |
| 171 uint16_t wLanguage, | 172 uint16_t wLanguage, |
| 172 uint32_t dwFontStyles, | 173 uint32_t dwFontStyles, |
| 173 const FX_WCHAR* pszFontFamily = NULL) override; | 174 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 174 IFGAS_Font* GetFontByCodePage(uint16_t wCodePage, | 175 IFGAS_Font* GetFontByCodePage( |
| 175 uint32_t dwFontStyles, | 176 uint16_t wCodePage, |
| 176 const FX_WCHAR* pszFontFamily = NULL) override; | 177 uint32_t dwFontStyles, |
| 177 IFGAS_Font* GetFontByCharset(uint8_t nCharset, | 178 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 178 uint32_t dwFontStyles, | 179 IFGAS_Font* GetFontByCharset( |
| 179 const FX_WCHAR* pszFontFamily = NULL) override; | 180 uint8_t nCharset, |
| 180 IFGAS_Font* GetFontByUnicode(FX_WCHAR wUnicode, | 181 uint32_t dwFontStyles, |
| 181 uint32_t dwFontStyles, | 182 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 182 const FX_WCHAR* pszFontFamily = NULL) override; | 183 IFGAS_Font* GetFontByUnicode( |
| 183 IFGAS_Font* GetFontByLanguage(uint16_t wLanguage, | 184 FX_WCHAR wUnicode, |
| 184 uint32_t dwFontStyles, | 185 uint32_t dwFontStyles, |
| 185 const FX_WCHAR* pszFontFamily = NULL) override; | 186 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 187 IFGAS_Font* GetFontByLanguage( |
| 188 uint16_t wLanguage, |
| 189 uint32_t dwFontStyles, |
| 190 const FX_WCHAR* pszFontFamily = nullptr) override; |
| 186 IFGAS_Font* LoadFont(const uint8_t* pBuffer, | 191 IFGAS_Font* LoadFont(const uint8_t* pBuffer, |
| 187 int32_t iLength, | 192 int32_t iLength, |
| 188 int32_t iFaceIndex, | 193 int32_t iFaceIndex, |
| 189 int32_t* pFaceCount) override; | 194 int32_t* pFaceCount) override; |
| 190 IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName, | 195 IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName, |
| 191 int32_t iFaceIndex, | 196 int32_t iFaceIndex, |
| 192 int32_t* pFaceCount) override; | 197 int32_t* pFaceCount) override; |
| 193 IFGAS_Font* LoadFont(IFX_Stream* pFontStream, | 198 IFGAS_Font* LoadFont(IFX_Stream* pFontStream, |
| 194 int32_t iFaceIndex, | 199 int32_t iFaceIndex, |
| 195 int32_t* pFaceCount, | 200 int32_t* pFaceCount, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<IFGAS_Font*>*> m_Hash2Fonts; | 248 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<IFGAS_Font*>*> m_Hash2Fonts; |
| 244 CFX_MapPtrTemplate<uint32_t, IFX_FileAccess*> m_Hash2FileAccess; | 249 CFX_MapPtrTemplate<uint32_t, IFX_FileAccess*> m_Hash2FileAccess; |
| 245 CFX_MapPtrTemplate<uint32_t, IFGAS_Font*> m_FileAccess2IFXFont; | 250 CFX_MapPtrTemplate<uint32_t, IFGAS_Font*> m_FileAccess2IFXFont; |
| 246 CFX_MapPtrTemplate<IFGAS_Font*, IFX_FileRead*> m_IFXFont2FileRead; | 251 CFX_MapPtrTemplate<IFGAS_Font*, IFX_FileRead*> m_IFXFont2FileRead; |
| 247 CFX_MapPtrTemplate<FX_WCHAR, IFGAS_Font*> m_FailedUnicodes2NULL; | 252 CFX_MapPtrTemplate<FX_WCHAR, IFGAS_Font*> m_FailedUnicodes2NULL; |
| 248 CFX_FontSourceEnum_File* const m_pFontSource; | 253 CFX_FontSourceEnum_File* const m_pFontSource; |
| 249 }; | 254 }; |
| 250 #endif | 255 #endif |
| 251 | 256 |
| 252 #endif // XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ | 257 #endif // XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ |
| OLD | NEW |