Chromium Code Reviews| 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/fxge/include/fx_font.h" | 10 #include "core/fxge/include/fx_font.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 virtual FX_BOOL GetBBox(CFX_Rect& bbox) = 0; | 94 virtual FX_BOOL GetBBox(CFX_Rect& bbox) = 0; |
| 95 virtual int32_t GetItalicAngle() const = 0; | 95 virtual int32_t GetItalicAngle() const = 0; |
| 96 virtual void Reset() = 0; | 96 virtual void Reset() = 0; |
| 97 virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const = 0; | 97 virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const = 0; |
| 98 virtual void* GetDevFont() const = 0; | 98 virtual void* GetDevFont() const = 0; |
| 99 virtual void SetFontProvider(IFX_FontProvider* pProvider) = 0; | 99 virtual void SetFontProvider(IFX_FontProvider* pProvider) = 0; |
| 100 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 100 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 101 virtual void SetLogicalFontStyle(uint32_t dwLogFontStyle) = 0; | 101 virtual void SetLogicalFontStyle(uint32_t dwLogFontStyle) = 0; |
| 102 #endif | 102 #endif |
| 103 }; | 103 }; |
| 104 | |
| 104 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 105 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 105 struct FX_FONTMATCHPARAMS { | 106 struct FX_FONTMATCHPARAMS { |
| 106 const FX_WCHAR* pwsFamily; | 107 const FX_WCHAR* pwsFamily; |
| 107 uint32_t dwFontStyles; | 108 uint32_t dwFontStyles; |
| 108 uint32_t dwUSB; | 109 uint32_t dwUSB; |
| 109 uint32_t dwMatchFlags; | 110 uint32_t dwMatchFlags; |
| 110 FX_WCHAR wUnicode; | 111 FX_WCHAR wUnicode; |
| 111 uint16_t wCodePage; | 112 uint16_t wCodePage; |
| 112 }; | 113 }; |
| 113 typedef FX_FONTMATCHPARAMS* FX_LPFONTMATCHPARAMS; | 114 typedef FX_FONTMATCHPARAMS* FX_LPFONTMATCHPARAMS; |
| 114 typedef FX_FONTMATCHPARAMS const* FX_LPCFONTMATCHPARAMS; | 115 typedef FX_FONTMATCHPARAMS const* FX_LPCFONTMATCHPARAMS; |
| 115 | 116 |
| 116 struct FX_FONTSIGNATURE { | 117 struct FX_FONTSIGNATURE { |
| 117 uint32_t fsUsb[4]; | 118 uint32_t fsUsb[4]; |
| 118 uint32_t fsCsb[2]; | 119 uint32_t fsCsb[2]; |
| 119 }; | 120 }; |
| 120 inline bool operator==(const FX_FONTSIGNATURE& left, | 121 inline bool operator==(const FX_FONTSIGNATURE& left, |
| 121 const FX_FONTSIGNATURE& right) { | 122 const FX_FONTSIGNATURE& right) { |
| 122 return left.fsUsb[0] == right.fsUsb[0] && left.fsUsb[1] == right.fsUsb[1] && | 123 return left.fsUsb[0] == right.fsUsb[0] && left.fsUsb[1] == right.fsUsb[1] && |
| 123 left.fsUsb[2] == right.fsUsb[2] && left.fsUsb[3] == right.fsUsb[3] && | 124 left.fsUsb[2] == right.fsUsb[2] && left.fsUsb[3] == right.fsUsb[3] && |
| 124 left.fsCsb[0] == right.fsCsb[0] && left.fsCsb[1] == right.fsCsb[1]; | 125 left.fsCsb[0] == right.fsCsb[0] && left.fsCsb[1] == right.fsCsb[1]; |
| 125 } | 126 } |
| 126 | 127 |
| 127 struct FX_FONTDESCRIPTOR { | 128 struct FX_FONTDESCRIPTOR { |
| 128 FX_WCHAR wsFontFace[32]; | 129 FX_WCHAR wsFontFace[32]; |
| 129 uint32_t dwFontStyles; | 130 uint32_t dwFontStyles; |
| 130 uint8_t uCharSet; | 131 uint8_t uCharSet; |
| 131 FX_FONTSIGNATURE FontSignature; | 132 FX_FONTSIGNATURE FontSignature; |
| 132 }; | 133 }; |
| 133 typedef FX_FONTDESCRIPTOR* FX_LPFONTDESCRIPTOR; | 134 typedef FX_FONTDESCRIPTOR* FX_LPFONTDESCRIPTOR; |
|
Tom Sepez
2016/04/08 15:34:07
nit: can we kill these two typedefs while we're at
dsinclair
2016/04/11 13:19:38
Done.
| |
| 134 typedef FX_FONTDESCRIPTOR const* FX_LPCFONTDESCRIPTOR; | 135 typedef FX_FONTDESCRIPTOR const* FX_LPCFONTDESCRIPTOR; |
| 135 typedef CFX_MassArrayTemplate<FX_FONTDESCRIPTOR> CFX_FontDescriptors; | 136 typedef CFX_MassArrayTemplate<FX_FONTDESCRIPTOR> CFX_FontDescriptors; |
| 136 inline bool operator==(const FX_FONTDESCRIPTOR& left, | 137 inline bool operator==(const FX_FONTDESCRIPTOR& left, |
| 137 const FX_FONTDESCRIPTOR& right) { | 138 const FX_FONTDESCRIPTOR& right) { |
| 138 return left.uCharSet == right.uCharSet && | 139 return left.uCharSet == right.uCharSet && |
| 139 left.dwFontStyles == right.dwFontStyles && | 140 left.dwFontStyles == right.dwFontStyles && |
| 140 left.FontSignature == right.FontSignature && | 141 left.FontSignature == right.FontSignature && |
| 141 FXSYS_wcscmp(left.wsFontFace, right.wsFontFace) == 0; | 142 FXSYS_wcscmp(left.wsFontFace, right.wsFontFace) == 0; |
| 142 } | 143 } |
| 143 | 144 |
| 144 #define FX_FONTMATCHPARA_MacthStyle 0x01 | 145 #define FX_FONTMATCHPARA_MacthStyle 0x01 |
| 145 #define FX_FONTMATCHPARA_MacthFamily 0x02 | 146 #define FX_FONTMATCHPARA_MacthFamily 0x02 |
| 146 #define FX_FONTMATCHPARA_MacthUnicode 0x04 | 147 #define FX_FONTMATCHPARA_MacthUnicode 0x04 |
| 147 typedef void (*FX_LPEnumAllFonts)(CFX_FontDescriptors& fonts, | 148 typedef void (*FX_LPEnumAllFonts)(CFX_FontDescriptors& fonts, |
| 148 void* pUserData, | |
| 149 const FX_WCHAR* pwsFaceName, | 149 const FX_WCHAR* pwsFaceName, |
| 150 FX_WCHAR wUnicode); | 150 FX_WCHAR wUnicode); |
| 151 FX_LPEnumAllFonts FX_GetDefFontEnumerator(); | 151 FX_LPEnumAllFonts FX_GetDefFontEnumerator(); |
| 152 typedef FX_LPCFONTDESCRIPTOR (*FX_LPMatchFont)(FX_LPFONTMATCHPARAMS pParams, | 152 typedef FX_LPCFONTDESCRIPTOR (*FX_LPMatchFont)( |
| 153 const CFX_FontDescriptors& fonts, | 153 FX_LPFONTMATCHPARAMS pParams, |
| 154 void* pUserData); | 154 const CFX_FontDescriptors& fonts); |
| 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, | |
| 160 void* pUserData = NULL); | |
| 161 virtual ~IFX_FontMgr() {} | 159 virtual ~IFX_FontMgr() {} |
| 162 virtual void Release() = 0; | 160 virtual void Release() = 0; |
| 163 virtual IFX_Font* GetDefFontByCodePage( | 161 virtual IFX_Font* GetDefFontByCodePage( |
| 164 uint16_t wCodePage, | 162 uint16_t wCodePage, |
| 165 uint32_t dwFontStyles, | 163 uint32_t dwFontStyles, |
| 166 const FX_WCHAR* pszFontFamily = NULL) = 0; | 164 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 167 virtual IFX_Font* GetDefFontByCharset( | 165 virtual IFX_Font* GetDefFontByCharset( |
| 168 uint8_t nCharset, | 166 uint8_t nCharset, |
| 169 uint32_t dwFontStyles, | 167 uint32_t dwFontStyles, |
| 170 const FX_WCHAR* pszFontFamily = NULL) = 0; | 168 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 185 const FX_WCHAR* pszFontAlias = NULL, | 183 const FX_WCHAR* pszFontAlias = NULL, |
| 186 uint32_t dwFontStyles = 0, | 184 uint32_t dwFontStyles = 0, |
| 187 uint16_t wCodePage = 0, | 185 uint16_t wCodePage = 0, |
| 188 FX_BOOL bSaveStream = FALSE) = 0; | 186 FX_BOOL bSaveStream = FALSE) = 0; |
| 189 virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, | 187 virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, |
| 190 uint32_t dwFontStyles, | 188 uint32_t dwFontStyles, |
| 191 uint16_t wCodePage = 0xFFFF) = 0; | 189 uint16_t wCodePage = 0xFFFF) = 0; |
| 192 virtual void ClearFontCache() = 0; | 190 virtual void ClearFontCache() = 0; |
| 193 virtual void RemoveFont(IFX_Font* pFont) = 0; | 191 virtual void RemoveFont(IFX_Font* pFont) = 0; |
| 194 }; | 192 }; |
| 195 #else | 193 |
| 196 class IFX_FontMgrDelegate { | 194 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 197 public: | 195 |
| 198 virtual ~IFX_FontMgrDelegate() {} | |
| 199 virtual IFX_Font* GetDefFontByCodePage( | |
| 200 IFX_FontMgr* pFontMgr, | |
| 201 uint16_t wCodePage, | |
| 202 uint32_t dwFontStyles, | |
| 203 const FX_WCHAR* pszFontFamily = NULL) = 0; | |
| 204 virtual IFX_Font* GetDefFontByCharset( | |
| 205 IFX_FontMgr* pFontMgr, | |
| 206 uint8_t nCharset, | |
| 207 uint32_t dwFontStyles, | |
| 208 const FX_WCHAR* pszFontFamily = NULL) = 0; | |
| 209 virtual IFX_Font* GetDefFontByUnicode( | |
| 210 IFX_FontMgr* pFontMgr, | |
| 211 FX_WCHAR wUnicode, | |
| 212 uint32_t dwFontStyles, | |
| 213 const FX_WCHAR* pszFontFamily = NULL) = 0; | |
| 214 virtual IFX_Font* GetDefFontByLanguage( | |
| 215 IFX_FontMgr* pFontMgr, | |
| 216 uint16_t wLanguage, | |
| 217 uint32_t dwFontStyles, | |
| 218 const FX_WCHAR* pszFontFamily = NULL) = 0; | |
| 219 }; | |
| 220 class IFX_FontSourceEnum { | 196 class IFX_FontSourceEnum { |
| 221 public: | 197 public: |
| 222 virtual ~IFX_FontSourceEnum() {} | 198 virtual ~IFX_FontSourceEnum() {} |
| 223 virtual void Release() = 0; | 199 virtual void Release() = 0; |
| 224 virtual FX_POSITION GetStartPosition(void* pUserData = NULL) = 0; | 200 virtual FX_POSITION GetStartPosition() = 0; |
| 225 virtual IFX_FileAccess* GetNext(FX_POSITION& pos, void* pUserData = NULL) = 0; | 201 virtual IFX_FileAccess* GetNext(FX_POSITION& pos) = 0; |
| 226 }; | 202 }; |
| 227 IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum(); | 203 IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum(); |
| 228 class IFX_FontMgr { | 204 class IFX_FontMgr { |
| 229 public: | 205 public: |
| 230 static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum, | 206 static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum); |
| 231 IFX_FontMgrDelegate* pDelegate = NULL, | |
| 232 void* pUserData = NULL); | |
| 233 virtual ~IFX_FontMgr() {} | 207 virtual ~IFX_FontMgr() {} |
| 234 virtual void Release() = 0; | 208 virtual void Release() = 0; |
| 235 virtual IFX_Font* GetDefFontByCodePage( | 209 virtual IFX_Font* GetDefFontByCodePage( |
| 236 uint16_t wCodePage, | 210 uint16_t wCodePage, |
| 237 uint32_t dwFontStyles, | 211 uint32_t dwFontStyles, |
| 238 const FX_WCHAR* pszFontFamily = NULL) = 0; | 212 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| 239 virtual IFX_Font* GetDefFontByCharset( | 213 virtual IFX_Font* GetDefFontByCharset( |
| 240 uint8_t nCharset, | 214 uint8_t nCharset, |
| 241 uint32_t dwFontStyles, | 215 uint32_t dwFontStyles, |
| 242 const FX_WCHAR* pszFontFamily = NULL) = 0; | 216 const FX_WCHAR* pszFontFamily = NULL) = 0; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 273 int32_t iFaceIndex, | 247 int32_t iFaceIndex, |
| 274 int32_t* pFaceCount = NULL) = 0; | 248 int32_t* pFaceCount = NULL) = 0; |
| 275 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, | 249 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, |
| 276 int32_t iFaceIndex, | 250 int32_t iFaceIndex, |
| 277 int32_t* pFaceCount = NULL, | 251 int32_t* pFaceCount = NULL, |
| 278 FX_BOOL bSaveStream = FALSE) = 0; | 252 FX_BOOL bSaveStream = FALSE) = 0; |
| 279 | 253 |
| 280 virtual void ClearFontCache() = 0; | 254 virtual void ClearFontCache() = 0; |
| 281 virtual void RemoveFont(IFX_Font* pFont) = 0; | 255 virtual void RemoveFont(IFX_Font* pFont) = 0; |
| 282 }; | 256 }; |
| 283 #endif | 257 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 284 | 258 |
| 285 #endif // XFA_FGAS_FONT_FGAS_FONT_H_ | 259 #endif // XFA_FGAS_FONT_FGAS_FONT_H_ |
| OLD | NEW |