| 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_FONT_H_ | 7 #ifndef XFA_FGAS_FONT_FGAS_FONT_H_ |
| 8 #define XFA_FGAS_FONT_FGAS_FONT_H_ | 8 #define XFA_FGAS_FONT_FGAS_FONT_H_ |
| 9 | 9 |
| 10 #include "core/include/fxge/fx_font.h" | 10 #include "core/include/fxge/fx_font.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 virtual FX_BOOL GetCharWidth(IFX_Font* pFont, | 54 virtual FX_BOOL GetCharWidth(IFX_Font* pFont, |
| 55 FX_WCHAR wUnicode, | 55 FX_WCHAR wUnicode, |
| 56 int32_t& iWidth, | 56 int32_t& iWidth, |
| 57 FX_BOOL bCharCode = FALSE) = 0; | 57 FX_BOOL bCharCode = FALSE) = 0; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class IFX_Font { | 60 class IFX_Font { |
| 61 public: | 61 public: |
| 62 static IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, | 62 static IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, |
| 63 FX_DWORD dwFontStyles, | 63 FX_DWORD dwFontStyles, |
| 64 FX_WORD wCodePage, | 64 uint16_t wCodePage, |
| 65 IFX_FontMgr* pFontMgr); | 65 IFX_FontMgr* pFontMgr); |
| 66 static IFX_Font* LoadFont(const uint8_t* pBuffer, | 66 static IFX_Font* LoadFont(const uint8_t* pBuffer, |
| 67 int32_t iLength, | 67 int32_t iLength, |
| 68 IFX_FontMgr* pFontMgr); | 68 IFX_FontMgr* pFontMgr); |
| 69 static IFX_Font* LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr* pFontMgr); | 69 static IFX_Font* LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr* pFontMgr); |
| 70 static IFX_Font* LoadFont(IFX_Stream* pFontStream, | 70 static IFX_Font* LoadFont(IFX_Stream* pFontStream, |
| 71 IFX_FontMgr* pFontMgr, | 71 IFX_FontMgr* pFontMgr, |
| 72 FX_BOOL bSaveStream = FALSE); | 72 FX_BOOL bSaveStream = FALSE); |
| 73 static IFX_Font* LoadFont(CFX_Font* pExtFont, | 73 static IFX_Font* LoadFont(CFX_Font* pExtFont, |
| 74 IFX_FontMgr* pFontMgr, | 74 IFX_FontMgr* pFontMgr, |
| 75 FX_BOOL bTakeOver = FALSE); | 75 FX_BOOL bTakeOver = FALSE); |
| 76 virtual ~IFX_Font() {} | 76 virtual ~IFX_Font() {} |
| 77 virtual void Release() = 0; | 77 virtual void Release() = 0; |
| 78 virtual IFX_Font* Retain() = 0; | 78 virtual IFX_Font* Retain() = 0; |
| 79 virtual IFX_Font* Derive(FX_DWORD dwFontStyles, FX_WORD wCodePage = 0) = 0; | 79 virtual IFX_Font* Derive(FX_DWORD dwFontStyles, uint16_t wCodePage = 0) = 0; |
| 80 virtual void GetFamilyName(CFX_WideString& wsFamily) const = 0; | 80 virtual void GetFamilyName(CFX_WideString& wsFamily) const = 0; |
| 81 virtual void GetPsName(CFX_WideString& wsName) const = 0; | 81 virtual void GetPsName(CFX_WideString& wsName) const = 0; |
| 82 virtual FX_DWORD GetFontStyles() const = 0; | 82 virtual FX_DWORD GetFontStyles() const = 0; |
| 83 virtual uint8_t GetCharSet() const = 0; | 83 virtual uint8_t GetCharSet() const = 0; |
| 84 virtual FX_BOOL GetCharWidth(FX_WCHAR wUnicode, | 84 virtual FX_BOOL GetCharWidth(FX_WCHAR wUnicode, |
| 85 int32_t& iWidth, | 85 int32_t& iWidth, |
| 86 FX_BOOL bCharCode = FALSE) = 0; | 86 FX_BOOL bCharCode = FALSE) = 0; |
| 87 virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode, | 87 virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode, |
| 88 FX_BOOL bCharCode = FALSE) = 0; | 88 FX_BOOL bCharCode = FALSE) = 0; |
| 89 virtual int32_t GetAscent() const = 0; | 89 virtual int32_t GetAscent() const = 0; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 virtual void SetLogicalFontStyle(FX_DWORD dwLogFontStyle) = 0; | 101 virtual void SetLogicalFontStyle(FX_DWORD dwLogFontStyle) = 0; |
| 102 #endif | 102 #endif |
| 103 }; | 103 }; |
| 104 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 104 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 105 struct FX_FONTMATCHPARAMS { | 105 struct FX_FONTMATCHPARAMS { |
| 106 const FX_WCHAR* pwsFamily; | 106 const FX_WCHAR* pwsFamily; |
| 107 FX_DWORD dwFontStyles; | 107 FX_DWORD dwFontStyles; |
| 108 FX_DWORD dwUSB; | 108 FX_DWORD dwUSB; |
| 109 FX_DWORD dwMatchFlags; | 109 FX_DWORD dwMatchFlags; |
| 110 FX_WCHAR wUnicode; | 110 FX_WCHAR wUnicode; |
| 111 FX_WORD wCodePage; | 111 uint16_t wCodePage; |
| 112 }; | 112 }; |
| 113 typedef FX_FONTMATCHPARAMS* FX_LPFONTMATCHPARAMS; | 113 typedef FX_FONTMATCHPARAMS* FX_LPFONTMATCHPARAMS; |
| 114 typedef FX_FONTMATCHPARAMS const* FX_LPCFONTMATCHPARAMS; | 114 typedef FX_FONTMATCHPARAMS const* FX_LPCFONTMATCHPARAMS; |
| 115 | 115 |
| 116 struct FX_FONTSIGNATURE { | 116 struct FX_FONTSIGNATURE { |
| 117 FX_DWORD fsUsb[4]; | 117 FX_DWORD fsUsb[4]; |
| 118 FX_DWORD fsCsb[2]; | 118 FX_DWORD fsCsb[2]; |
| 119 }; | 119 }; |
| 120 inline bool operator==(const FX_FONTSIGNATURE& left, | 120 inline bool operator==(const FX_FONTSIGNATURE& left, |
| 121 const FX_FONTSIGNATURE& right) { | 121 const FX_FONTSIGNATURE& right) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void* pUserData); | 154 void* pUserData); |
| 155 FX_LPMatchFont FX_GetDefFontMatchor(); | 155 FX_LPMatchFont FX_GetDefFontMatchor(); |
| 156 class IFX_FontMgr { | 156 class IFX_FontMgr { |
| 157 public: | 157 public: |
| 158 static IFX_FontMgr* Create(FX_LPEnumAllFonts pEnumerator, | 158 static IFX_FontMgr* Create(FX_LPEnumAllFonts pEnumerator, |
| 159 FX_LPMatchFont pMatcher = NULL, | 159 FX_LPMatchFont pMatcher = NULL, |
| 160 void* pUserData = NULL); | 160 void* pUserData = NULL); |
| 161 virtual ~IFX_FontMgr() {} | 161 virtual ~IFX_FontMgr() {} |
| 162 virtual void Release() = 0; | 162 virtual void Release() = 0; |
| 163 virtual IFX_Font* GetDefFontByCodePage( | 163 virtual IFX_Font* GetDefFontByCodePage( |
| 164 FX_WORD wCodePage, | 164 uint16_t wCodePage, |
| 165 FX_DWORD dwFontStyles, | 165 FX_DWORD dwFontStyles, |
| 166 const FX_WCHAR* pszFontFamily = NULL) = 0; | 166 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 167 virtual IFX_Font* GetDefFontByCharset( | 167 virtual IFX_Font* GetDefFontByCharset( |
| 168 uint8_t nCharset, | 168 uint8_t nCharset, |
| 169 FX_DWORD dwFontStyles, | 169 FX_DWORD dwFontStyles, |
| 170 const FX_WCHAR* pszFontFamily = NULL) = 0; | 170 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 171 virtual IFX_Font* GetDefFontByUnicode( | 171 virtual IFX_Font* GetDefFontByUnicode( |
| 172 FX_WCHAR wUnicode, | 172 FX_WCHAR wUnicode, |
| 173 FX_DWORD dwFontStyles, | 173 FX_DWORD dwFontStyles, |
| 174 const FX_WCHAR* pszFontFamily = NULL) = 0; | 174 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 175 virtual IFX_Font* GetDefFontByLanguage( | 175 virtual IFX_Font* GetDefFontByLanguage( |
| 176 FX_WORD wLanguage, | 176 uint16_t wLanguage, |
| 177 FX_DWORD dwFontStyles, | 177 FX_DWORD dwFontStyles, |
| 178 const FX_WCHAR* pszFontFamily = NULL) = 0; | 178 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 179 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, | 179 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, |
| 180 FX_DWORD dwFontStyles, | 180 FX_DWORD dwFontStyles, |
| 181 FX_WORD wCodePage = 0xFFFF) = 0; | 181 uint16_t wCodePage = 0xFFFF) = 0; |
| 182 virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0; | 182 virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0; |
| 183 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName) = 0; | 183 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName) = 0; |
| 184 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, | 184 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, |
| 185 const FX_WCHAR* pszFontAlias = NULL, | 185 const FX_WCHAR* pszFontAlias = NULL, |
| 186 FX_DWORD dwFontStyles = 0, | 186 FX_DWORD dwFontStyles = 0, |
| 187 FX_WORD wCodePage = 0, | 187 uint16_t wCodePage = 0, |
| 188 FX_BOOL bSaveStream = FALSE) = 0; | 188 FX_BOOL bSaveStream = FALSE) = 0; |
| 189 virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, | 189 virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, |
| 190 FX_DWORD dwFontStyles, | 190 FX_DWORD dwFontStyles, |
| 191 FX_WORD wCodePage = 0xFFFF) = 0; | 191 uint16_t wCodePage = 0xFFFF) = 0; |
| 192 virtual void ClearFontCache() = 0; | 192 virtual void ClearFontCache() = 0; |
| 193 virtual void RemoveFont(IFX_Font* pFont) = 0; | 193 virtual void RemoveFont(IFX_Font* pFont) = 0; |
| 194 }; | 194 }; |
| 195 #else | 195 #else |
| 196 class IFX_FontMgrDelegate { | 196 class IFX_FontMgrDelegate { |
| 197 public: | 197 public: |
| 198 virtual ~IFX_FontMgrDelegate() {} | 198 virtual ~IFX_FontMgrDelegate() {} |
| 199 virtual IFX_Font* GetDefFontByCodePage( | 199 virtual IFX_Font* GetDefFontByCodePage( |
| 200 IFX_FontMgr* pFontMgr, | 200 IFX_FontMgr* pFontMgr, |
| 201 FX_WORD wCodePage, | 201 uint16_t wCodePage, |
| 202 FX_DWORD dwFontStyles, | 202 FX_DWORD dwFontStyles, |
| 203 const FX_WCHAR* pszFontFamily = NULL) = 0; | 203 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 204 virtual IFX_Font* GetDefFontByCharset( | 204 virtual IFX_Font* GetDefFontByCharset( |
| 205 IFX_FontMgr* pFontMgr, | 205 IFX_FontMgr* pFontMgr, |
| 206 uint8_t nCharset, | 206 uint8_t nCharset, |
| 207 FX_DWORD dwFontStyles, | 207 FX_DWORD dwFontStyles, |
| 208 const FX_WCHAR* pszFontFamily = NULL) = 0; | 208 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 209 virtual IFX_Font* GetDefFontByUnicode( | 209 virtual IFX_Font* GetDefFontByUnicode( |
| 210 IFX_FontMgr* pFontMgr, | 210 IFX_FontMgr* pFontMgr, |
| 211 FX_WCHAR wUnicode, | 211 FX_WCHAR wUnicode, |
| 212 FX_DWORD dwFontStyles, | 212 FX_DWORD dwFontStyles, |
| 213 const FX_WCHAR* pszFontFamily = NULL) = 0; | 213 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 214 virtual IFX_Font* GetDefFontByLanguage( | 214 virtual IFX_Font* GetDefFontByLanguage( |
| 215 IFX_FontMgr* pFontMgr, | 215 IFX_FontMgr* pFontMgr, |
| 216 FX_WORD wLanguage, | 216 uint16_t wLanguage, |
| 217 FX_DWORD dwFontStyles, | 217 FX_DWORD dwFontStyles, |
| 218 const FX_WCHAR* pszFontFamily = NULL) = 0; | 218 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 219 }; | 219 }; |
| 220 class IFX_FontSourceEnum { | 220 class IFX_FontSourceEnum { |
| 221 public: | 221 public: |
| 222 virtual ~IFX_FontSourceEnum() {} | 222 virtual ~IFX_FontSourceEnum() {} |
| 223 virtual void Release() = 0; | 223 virtual void Release() = 0; |
| 224 virtual FX_POSITION GetStartPosition(void* pUserData = NULL) = 0; | 224 virtual FX_POSITION GetStartPosition(void* pUserData = NULL) = 0; |
| 225 virtual IFX_FileAccess* GetNext(FX_POSITION& pos, void* pUserData = NULL) = 0; | 225 virtual IFX_FileAccess* GetNext(FX_POSITION& pos, void* pUserData = NULL) = 0; |
| 226 }; | 226 }; |
| 227 IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum(); | 227 IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum(); |
| 228 class IFX_FontMgr { | 228 class IFX_FontMgr { |
| 229 public: | 229 public: |
| 230 static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum, | 230 static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum, |
| 231 IFX_FontMgrDelegate* pDelegate = NULL, | 231 IFX_FontMgrDelegate* pDelegate = NULL, |
| 232 void* pUserData = NULL); | 232 void* pUserData = NULL); |
| 233 virtual ~IFX_FontMgr() {} | 233 virtual ~IFX_FontMgr() {} |
| 234 virtual void Release() = 0; | 234 virtual void Release() = 0; |
| 235 virtual IFX_Font* GetDefFontByCodePage( | 235 virtual IFX_Font* GetDefFontByCodePage( |
| 236 FX_WORD wCodePage, | 236 uint16_t wCodePage, |
| 237 FX_DWORD dwFontStyles, | 237 FX_DWORD dwFontStyles, |
| 238 const FX_WCHAR* pszFontFamily = NULL) = 0; | 238 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 239 virtual IFX_Font* GetDefFontByCharset( | 239 virtual IFX_Font* GetDefFontByCharset( |
| 240 uint8_t nCharset, | 240 uint8_t nCharset, |
| 241 FX_DWORD dwFontStyles, | 241 FX_DWORD dwFontStyles, |
| 242 const FX_WCHAR* pszFontFamily = NULL) = 0; | 242 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 243 virtual IFX_Font* GetDefFontByUnicode( | 243 virtual IFX_Font* GetDefFontByUnicode( |
| 244 FX_WCHAR wUnicode, | 244 FX_WCHAR wUnicode, |
| 245 FX_DWORD dwFontStyles, | 245 FX_DWORD dwFontStyles, |
| 246 const FX_WCHAR* pszFontFamily = NULL) = 0; | 246 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 247 virtual IFX_Font* GetDefFontByLanguage( | 247 virtual IFX_Font* GetDefFontByLanguage( |
| 248 FX_WORD wLanguage, | 248 uint16_t wLanguage, |
| 249 FX_DWORD dwFontStyles, | 249 FX_DWORD dwFontStyles, |
| 250 const FX_WCHAR* pszFontFamily = NULL) = 0; | 250 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 251 virtual IFX_Font* GetFontByCodePage(FX_WORD wCodePage, | 251 virtual IFX_Font* GetFontByCodePage(uint16_t wCodePage, |
| 252 FX_DWORD dwFontStyles, | 252 FX_DWORD dwFontStyles, |
| 253 const FX_WCHAR* pszFontFamily = NULL) = 0; | 253 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 254 inline IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, | 254 inline IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, |
| 255 FX_DWORD dwFontStyles, | 255 FX_DWORD dwFontStyles, |
| 256 FX_WORD wCodePage) { | 256 uint16_t wCodePage) { |
| 257 return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); | 257 return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); |
| 258 } | 258 } |
| 259 virtual IFX_Font* GetFontByCharset(uint8_t nCharset, | 259 virtual IFX_Font* GetFontByCharset(uint8_t nCharset, |
| 260 FX_DWORD dwFontStyles, | 260 FX_DWORD dwFontStyles, |
| 261 const FX_WCHAR* pszFontFamily = NULL) = 0; | 261 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 262 virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, | 262 virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, |
| 263 FX_DWORD dwFontStyles, | 263 FX_DWORD dwFontStyles, |
| 264 const FX_WCHAR* pszFontFamily = NULL) = 0; | 264 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 265 virtual IFX_Font* GetFontByLanguage(FX_WORD wLanguage, | 265 virtual IFX_Font* GetFontByLanguage(uint16_t wLanguage, |
| 266 FX_DWORD dwFontStyles, | 266 FX_DWORD dwFontStyles, |
| 267 const FX_WCHAR* pszFontFamily = NULL) = 0; | 267 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 268 virtual IFX_Font* LoadFont(const uint8_t* pBuffer, | 268 virtual IFX_Font* LoadFont(const uint8_t* pBuffer, |
| 269 int32_t iLength, | 269 int32_t iLength, |
| 270 int32_t iFaceIndex, | 270 int32_t iFaceIndex, |
| 271 int32_t* pFaceCount = NULL) = 0; | 271 int32_t* pFaceCount = NULL) = 0; |
| 272 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName, | 272 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName, |
| 273 int32_t iFaceIndex, | 273 int32_t iFaceIndex, |
| 274 int32_t* pFaceCount = NULL) = 0; | 274 int32_t* pFaceCount = NULL) = 0; |
| 275 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, | 275 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, |
| 276 int32_t iFaceIndex, | 276 int32_t iFaceIndex, |
| 277 int32_t* pFaceCount = NULL, | 277 int32_t* pFaceCount = NULL, |
| 278 FX_BOOL bSaveStream = FALSE) = 0; | 278 FX_BOOL bSaveStream = FALSE) = 0; |
| 279 | 279 |
| 280 virtual void ClearFontCache() = 0; | 280 virtual void ClearFontCache() = 0; |
| 281 virtual void RemoveFont(IFX_Font* pFont) = 0; | 281 virtual void RemoveFont(IFX_Font* pFont) = 0; |
| 282 }; | 282 }; |
| 283 #endif | 283 #endif |
| 284 | 284 |
| 285 #endif // XFA_FGAS_FONT_FGAS_FONT_H_ | 285 #endif // XFA_FGAS_FONT_FGAS_FONT_H_ |
| OLD | NEW |