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 CORE_INCLUDE_FXGE_FX_FONT_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_FONT_H_ |
| 8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ | 8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "../fxcrt/fx_system.h" | 12 #include "../fxcrt/fx_system.h" |
| 13 #include "fx_dib.h" | 13 #include "fx_dib.h" |
| 14 | 14 |
| 15 typedef struct FT_FaceRec_* FXFT_Face; | 15 typedef struct FT_FaceRec_* FXFT_Face; |
| 16 typedef void* FXFT_Library; | 16 typedef void* FXFT_Library; |
| 17 class IFX_FontEncoding; | |
| 18 class CFX_PathData; | 17 class CFX_PathData; |
|
Tom Sepez
2015/08/14 19:59:18
nit: alphabetize while we're at it.
Lei Zhang
2015/08/14 21:23:49
Done.
| |
| 19 class CFX_SubstFont; | 18 class CFX_SubstFont; |
| 20 class CFX_FaceCache; | 19 class CFX_FaceCache; |
| 21 class CFX_FontMapper; | 20 class CFX_FontMapper; |
| 22 class IFX_SystemFontInfo; | 21 class IFX_SystemFontInfo; |
| 23 class CFontFileFaceInfo; | 22 class CFontFileFaceInfo; |
| 23 | |
| 24 #define FXFONT_FIXED_PITCH 0x01 | 24 #define FXFONT_FIXED_PITCH 0x01 |
| 25 #define FXFONT_SERIF 0x02 | 25 #define FXFONT_SERIF 0x02 |
| 26 #define FXFONT_SYMBOLIC 0x04 | 26 #define FXFONT_SYMBOLIC 0x04 |
| 27 #define FXFONT_SCRIPT 0x08 | 27 #define FXFONT_SCRIPT 0x08 |
| 28 #define FXFONT_ITALIC 0x40 | 28 #define FXFONT_ITALIC 0x40 |
| 29 #define FXFONT_BOLD 0x40000 | 29 #define FXFONT_BOLD 0x40000 |
| 30 #define FXFONT_USEEXTERNATTR 0x80000 | 30 #define FXFONT_USEEXTERNATTR 0x80000 |
| 31 #define FXFONT_CIDFONT 0x100000 | 31 #define FXFONT_CIDFONT 0x100000 |
| 32 #define FXFONT_ANSI_CHARSET 0 | 32 #define FXFONT_ANSI_CHARSET 0 |
| 33 #define FXFONT_DEFAULT_CHARSET 1 | 33 #define FXFONT_DEFAULT_CHARSET 1 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 | 126 |
| 127 void DeleteFace(); | 127 void DeleteFace(); |
| 128 | 128 |
| 129 protected: | 129 protected: |
| 130 FX_BOOL m_bEmbedded; | 130 FX_BOOL m_bEmbedded; |
| 131 FX_BOOL m_bVertical; | 131 FX_BOOL m_bVertical; |
| 132 void* m_pOwnedStream; | 132 void* m_pOwnedStream; |
| 133 }; | 133 }; |
| 134 #define ENCODING_INTERNAL 0 | 134 #define ENCODING_INTERNAL 0 |
| 135 #define ENCODING_UNICODE 1 | 135 #define ENCODING_UNICODE 1 |
| 136 | |
| 136 class IFX_FontEncoding { | 137 class IFX_FontEncoding { |
| 137 public: | 138 public: |
| 138 virtual ~IFX_FontEncoding() {} | 139 virtual ~IFX_FontEncoding() {} |
| 139 | 140 |
| 140 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; | 141 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; |
| 141 | 142 |
| 142 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0; | 143 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0; |
| 143 | 144 |
| 144 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0; | 145 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0; |
| 145 }; | 146 }; |
| 147 | |
| 146 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); | 148 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); |
| 147 #define FXFONT_SUBST_MM 0x01 | 149 #define FXFONT_SUBST_MM 0x01 |
| 148 #define FXFONT_SUBST_GLYPHPATH 0x04 | 150 #define FXFONT_SUBST_GLYPHPATH 0x04 |
| 149 #define FXFONT_SUBST_CLEARTYPE 0x08 | 151 #define FXFONT_SUBST_CLEARTYPE 0x08 |
| 150 #define FXFONT_SUBST_TRANSFORM 0x10 | 152 #define FXFONT_SUBST_TRANSFORM 0x10 |
| 151 #define FXFONT_SUBST_NONSYMBOL 0x20 | 153 #define FXFONT_SUBST_NONSYMBOL 0x20 |
| 152 #define FXFONT_SUBST_EXACT 0x40 | 154 #define FXFONT_SUBST_EXACT 0x40 |
| 153 #define FXFONT_SUBST_STANDARD 0x80 | 155 #define FXFONT_SUBST_STANDARD 0x80 |
| 154 class CFX_SubstFont { | 156 class CFX_SubstFont { |
| 155 public: | 157 public: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 CFX_SubstFont* pSubstFont); | 223 CFX_SubstFont* pSubstFont); |
| 222 | 224 |
| 223 void FreeCache(); | 225 void FreeCache(); |
| 224 | 226 |
| 225 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); | 227 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); |
| 226 CFX_FontMapper* m_pBuiltinMapper; | 228 CFX_FontMapper* m_pBuiltinMapper; |
| 227 CFX_MapByteStringToPtr m_FaceMap; | 229 CFX_MapByteStringToPtr m_FaceMap; |
| 228 FXFT_Library m_FTLibrary; | 230 FXFT_Library m_FTLibrary; |
| 229 FoxitFonts m_ExternalFonts[16]; | 231 FoxitFonts m_ExternalFonts[16]; |
| 230 }; | 232 }; |
| 233 | |
| 231 class IFX_FontEnumerator { | 234 class IFX_FontEnumerator { |
| 232 public: | 235 public: |
| 233 virtual ~IFX_FontEnumerator() {} | |
| 234 | |
| 235 virtual void HitFont() = 0; | 236 virtual void HitFont() = 0; |
| 236 | 237 |
| 237 virtual void Finish() = 0; | 238 virtual void Finish() = 0; |
| 239 | |
| 240 protected: | |
| 241 virtual ~IFX_FontEnumerator() {} | |
| 238 }; | 242 }; |
| 243 | |
| 239 class IFX_AdditionalFontEnum { | 244 class IFX_AdditionalFontEnum { |
| 240 public: | 245 public: |
| 241 virtual ~IFX_AdditionalFontEnum() {} | |
| 242 virtual int CountFiles() = 0; | 246 virtual int CountFiles() = 0; |
| 243 virtual IFX_FileStream* GetFontFile(int index) = 0; | 247 virtual IFX_FileStream* GetFontFile(int index) = 0; |
| 248 | |
| 249 protected: | |
| 250 virtual ~IFX_AdditionalFontEnum() {} | |
| 244 }; | 251 }; |
| 252 | |
| 245 class CFX_FontMapper { | 253 class CFX_FontMapper { |
| 246 public: | 254 public: |
| 247 CFX_FontMapper(CFX_FontMgr* mgr); | 255 CFX_FontMapper(CFX_FontMgr* mgr); |
| 248 ~CFX_FontMapper(); | 256 ~CFX_FontMapper(); |
| 249 | 257 |
| 250 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); | 258 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); |
| 251 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo; } | 259 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo; } |
| 252 void AddInstalledFont(const CFX_ByteString& name, int charset); | 260 void AddInstalledFont(const CFX_ByteString& name, int charset); |
| 253 void LoadInstalledFonts(); | 261 void LoadInstalledFonts(); |
| 254 CFX_ByteStringArray m_InstalledTTFonts; | 262 CFX_ByteStringArray m_InstalledTTFonts; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 276 FX_BOOL m_bListLoaded; | 284 FX_BOOL m_bListLoaded; |
| 277 FXFT_Face m_MMFaces[2]; | 285 FXFT_Face m_MMFaces[2]; |
| 278 CFX_ByteString m_LastFamily; | 286 CFX_ByteString m_LastFamily; |
| 279 CFX_DWordArray m_CharsetArray; | 287 CFX_DWordArray m_CharsetArray; |
| 280 CFX_ByteStringArray m_FaceArray; | 288 CFX_ByteStringArray m_FaceArray; |
| 281 IFX_SystemFontInfo* m_pFontInfo; | 289 IFX_SystemFontInfo* m_pFontInfo; |
| 282 FXFT_Face m_FoxitFaces[14]; | 290 FXFT_Face m_FoxitFaces[14]; |
| 283 IFX_FontEnumerator* m_pFontEnumerator; | 291 IFX_FontEnumerator* m_pFontEnumerator; |
| 284 CFX_FontMgr* const m_pFontMgr; | 292 CFX_FontMgr* const m_pFontMgr; |
| 285 }; | 293 }; |
| 294 | |
| 286 class IFX_SystemFontInfo { | 295 class IFX_SystemFontInfo { |
| 287 public: | 296 public: |
| 288 static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths); | 297 static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths); |
| 289 virtual void Release() = 0; | 298 virtual void Release() = 0; |
| 290 | 299 |
| 291 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; | 300 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; |
| 292 virtual void* MapFont(int weight, | 301 virtual void* MapFont(int weight, |
| 293 FX_BOOL bItalic, | 302 FX_BOOL bItalic, |
| 294 int charset, | 303 int charset, |
| 295 int pitch_family, | 304 int pitch_family, |
| 296 const FX_CHAR* face, | 305 const FX_CHAR* face, |
| 297 int& iExact) = 0; | 306 int& iExact) = 0; |
| 298 virtual void* GetFont(const FX_CHAR* face) = 0; | 307 virtual void* GetFont(const FX_CHAR* face) = 0; |
| 299 virtual FX_DWORD GetFontData(void* hFont, | 308 virtual FX_DWORD GetFontData(void* hFont, |
| 300 FX_DWORD table, | 309 FX_DWORD table, |
| 301 uint8_t* buffer, | 310 uint8_t* buffer, |
| 302 FX_DWORD size) = 0; | 311 FX_DWORD size) = 0; |
| 303 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; | 312 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; |
| 304 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; | 313 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; |
| 305 virtual int GetFaceIndex(void* hFont) { return 0; } | 314 virtual int GetFaceIndex(void* hFont) { return 0; } |
| 306 virtual void DeleteFont(void* hFont) = 0; | 315 virtual void DeleteFont(void* hFont) = 0; |
| 307 virtual void* RetainFont(void* hFont) { return NULL; } | 316 virtual void* RetainFont(void* hFont) { return NULL; } |
| 308 | 317 |
| 309 protected: | 318 protected: |
| 310 ~IFX_SystemFontInfo() {} | 319 virtual ~IFX_SystemFontInfo() {} |
| 311 }; | 320 }; |
| 321 | |
| 312 class CFX_FolderFontInfo : public IFX_SystemFontInfo { | 322 class CFX_FolderFontInfo : public IFX_SystemFontInfo { |
| 313 public: | 323 public: |
| 314 CFX_FolderFontInfo(); | 324 CFX_FolderFontInfo(); |
| 315 virtual ~CFX_FolderFontInfo(); | 325 virtual ~CFX_FolderFontInfo(); |
| 316 void AddPath(const CFX_ByteStringC& path); | 326 void AddPath(const CFX_ByteStringC& path); |
| 317 | 327 |
| 318 // IFX_SytemFontInfo: | 328 // IFX_SytemFontInfo: |
| 319 void Release() override; | 329 void Release() override; |
| 320 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; | 330 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; |
| 321 void* MapFont(int weight, | 331 void* MapFont(int weight, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 typedef struct { | 434 typedef struct { |
| 425 const CFX_GlyphBitmap* m_pGlyph; | 435 const CFX_GlyphBitmap* m_pGlyph; |
| 426 int m_OriginX, m_OriginY; | 436 int m_OriginX, m_OriginY; |
| 427 FX_FLOAT m_fOriginX, m_fOriginY; | 437 FX_FLOAT m_fOriginX, m_fOriginY; |
| 428 } FXTEXT_GLYPHPOS; | 438 } FXTEXT_GLYPHPOS; |
| 429 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, | 439 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, |
| 430 int nChars, | 440 int nChars, |
| 431 int anti_alias, | 441 int anti_alias, |
| 432 FX_FLOAT retinaScaleX = 1.0f, | 442 FX_FLOAT retinaScaleX = 1.0f, |
| 433 FX_FLOAT retinaScaleY = 1.0f); | 443 FX_FLOAT retinaScaleY = 1.0f); |
| 444 | |
| 434 class IFX_GSUBTable { | 445 class IFX_GSUBTable { |
| 435 public: | 446 public: |
| 436 static IFX_GSUBTable* Create(CFX_Font* pFont); | 447 static IFX_GSUBTable* Create(CFX_Font* pFont); |
| 448 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | |
| 449 | |
| 450 protected: | |
| 437 virtual ~IFX_GSUBTable() {} | 451 virtual ~IFX_GSUBTable() {} |
| 438 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | |
| 439 }; | 452 }; |
| 440 | 453 |
| 441 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 454 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
| OLD | NEW |