| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_FXGE_CFX_FONTMAPPER_H_ | 7 #ifndef CORE_FXGE_CFX_FONTMAPPER_H_ |
| 8 #define CORE_FXGE_CFX_FONTMAPPER_H_ | 8 #define CORE_FXGE_CFX_FONTMAPPER_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "core/fxge/cfx_fontmgr.h" | 13 #include "core/fxge/cfx_fontmgr.h" |
| 14 #include "core/fxge/fx_font.h" | 14 #include "core/fxge/fx_font.h" |
| 15 | 15 |
| 16 class CFX_SubstFont; | 16 class CFX_SubstFont; |
| 17 | 17 |
| 18 class CFX_FontMapper { | 18 class CFX_FontMapper { |
| 19 public: | 19 public: |
| 20 explicit CFX_FontMapper(CFX_FontMgr* mgr); | 20 explicit CFX_FontMapper(CFX_FontMgr* mgr); |
| 21 ~CFX_FontMapper(); | 21 ~CFX_FontMapper(); |
| 22 | 22 |
| 23 void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo); | 23 void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo); |
| 24 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo.get(); } | 24 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo.get(); } |
| 25 void AddInstalledFont(const CFX_ByteString& name, int charset); | 25 void AddInstalledFont(const CFX_ByteString& name, int charset); |
| 26 void LoadInstalledFonts(); | 26 void LoadInstalledFonts(); |
| 27 | 27 |
| 28 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, | 28 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, |
| 29 FX_BOOL bTrueType, | 29 bool bTrueType, |
| 30 uint32_t flags, | 30 uint32_t flags, |
| 31 int weight, | 31 int weight, |
| 32 int italic_angle, | 32 int italic_angle, |
| 33 int CharsetCP, | 33 int CharsetCP, |
| 34 CFX_SubstFont* pSubstFont); | 34 CFX_SubstFont* pSubstFont); |
| 35 #ifdef PDF_ENABLE_XFA | 35 #ifdef PDF_ENABLE_XFA |
| 36 FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, | 36 FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, |
| 37 uint32_t flags, | 37 uint32_t flags, |
| 38 int weight, | 38 int weight, |
| 39 int italic_angle); | 39 int italic_angle); |
| 40 #endif // PDF_ENABLE_XFA | 40 #endif // PDF_ENABLE_XFA |
| 41 FX_BOOL IsBuiltinFace(const FXFT_Face face) const; | 41 bool IsBuiltinFace(const FXFT_Face face) const; |
| 42 int GetFaceSize() const; | 42 int GetFaceSize() const; |
| 43 CFX_ByteString GetFaceName(int index) const { | 43 CFX_ByteString GetFaceName(int index) const { |
| 44 return m_FaceArray[index].name; | 44 return m_FaceArray[index].name; |
| 45 } | 45 } |
| 46 | 46 |
| 47 std::vector<CFX_ByteString> m_InstalledTTFonts; | 47 std::vector<CFX_ByteString> m_InstalledTTFonts; |
| 48 std::vector<std::pair<CFX_ByteString, CFX_ByteString>> m_LocalizedTTFonts; | 48 std::vector<std::pair<CFX_ByteString, CFX_ByteString>> m_LocalizedTTFonts; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 static const size_t MM_FACE_COUNT = 2; | 51 static const size_t MM_FACE_COUNT = 2; |
| 52 static const size_t FOXIT_FACE_COUNT = 14; | 52 static const size_t FOXIT_FACE_COUNT = 14; |
| 53 | 53 |
| 54 CFX_ByteString GetPSNameFromTT(void* hFont); | 54 CFX_ByteString GetPSNameFromTT(void* hFont); |
| 55 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); | 55 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); |
| 56 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, | 56 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, |
| 57 int iBaseFont, | 57 int iBaseFont, |
| 58 int italic_angle, | 58 int italic_angle, |
| 59 int weight, | 59 int weight, |
| 60 int picthfamily); | 60 int picthfamily); |
| 61 FXFT_Face GetCachedTTCFace(void* hFont, | 61 FXFT_Face GetCachedTTCFace(void* hFont, |
| 62 const uint32_t tableTTCF, | 62 const uint32_t tableTTCF, |
| 63 uint32_t ttc_size, | 63 uint32_t ttc_size, |
| 64 uint32_t font_size); | 64 uint32_t font_size); |
| 65 FXFT_Face GetCachedFace(void* hFont, | 65 FXFT_Face GetCachedFace(void* hFont, |
| 66 CFX_ByteString SubstName, | 66 CFX_ByteString SubstName, |
| 67 int weight, | 67 int weight, |
| 68 FX_BOOL bItalic, | 68 bool bItalic, |
| 69 uint32_t font_size); | 69 uint32_t font_size); |
| 70 | 70 |
| 71 struct FaceData { | 71 struct FaceData { |
| 72 CFX_ByteString name; | 72 CFX_ByteString name; |
| 73 uint32_t charset; | 73 uint32_t charset; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 FX_BOOL m_bListLoaded; | 76 bool m_bListLoaded; |
| 77 FXFT_Face m_MMFaces[MM_FACE_COUNT]; | 77 FXFT_Face m_MMFaces[MM_FACE_COUNT]; |
| 78 CFX_ByteString m_LastFamily; | 78 CFX_ByteString m_LastFamily; |
| 79 std::vector<FaceData> m_FaceArray; | 79 std::vector<FaceData> m_FaceArray; |
| 80 std::unique_ptr<IFX_SystemFontInfo> m_pFontInfo; | 80 std::unique_ptr<IFX_SystemFontInfo> m_pFontInfo; |
| 81 FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; | 81 FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; |
| 82 CFX_FontMgr* const m_pFontMgr; | 82 CFX_FontMgr* const m_pFontMgr; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 #endif // CORE_FXGE_CFX_FONTMAPPER_H_ | 85 #endif // CORE_FXGE_CFX_FONTMAPPER_H_ |
| OLD | NEW |