OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 |
| 7 #ifndef CORE_FXGE_INCLUDE_CFX_FONTMAPPER_H_ |
| 8 #define CORE_FXGE_INCLUDE_CFX_FONTMAPPER_H_ |
| 9 |
| 10 #include <memory> |
| 11 #include <vector> |
| 12 |
| 13 #include "core/fxge/include/cfx_fontmgr.h" |
| 14 #include "core/fxge/include/fx_font.h" |
| 15 |
| 16 class CFX_FontMapper { |
| 17 public: |
| 18 explicit CFX_FontMapper(CFX_FontMgr* mgr); |
| 19 ~CFX_FontMapper(); |
| 20 |
| 21 void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo); |
| 22 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo.get(); } |
| 23 void AddInstalledFont(const CFX_ByteString& name, int charset); |
| 24 void LoadInstalledFonts(); |
| 25 |
| 26 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, |
| 27 FX_BOOL bTrueType, |
| 28 uint32_t flags, |
| 29 int weight, |
| 30 int italic_angle, |
| 31 int CharsetCP, |
| 32 CFX_SubstFont* pSubstFont); |
| 33 #ifdef PDF_ENABLE_XFA |
| 34 FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, |
| 35 uint32_t flags, |
| 36 int weight, |
| 37 int italic_angle); |
| 38 #endif // PDF_ENABLE_XFA |
| 39 FX_BOOL IsBuiltinFace(const FXFT_Face face) const; |
| 40 int GetFaceSize() const; |
| 41 CFX_ByteString GetFaceName(int index) const { |
| 42 return m_FaceArray[index].name; |
| 43 } |
| 44 |
| 45 std::vector<CFX_ByteString> m_InstalledTTFonts; |
| 46 |
| 47 private: |
| 48 static const size_t MM_FACE_COUNT = 2; |
| 49 static const size_t FOXIT_FACE_COUNT = 14; |
| 50 |
| 51 CFX_ByteString GetPSNameFromTT(void* hFont); |
| 52 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); |
| 53 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, |
| 54 int iBaseFont, |
| 55 int italic_angle, |
| 56 int weight, |
| 57 int picthfamily); |
| 58 |
| 59 struct FaceData { |
| 60 CFX_ByteString name; |
| 61 uint32_t charset; |
| 62 }; |
| 63 |
| 64 FX_BOOL m_bListLoaded; |
| 65 FXFT_Face m_MMFaces[MM_FACE_COUNT]; |
| 66 CFX_ByteString m_LastFamily; |
| 67 std::vector<FaceData> m_FaceArray; |
| 68 std::unique_ptr<IFX_SystemFontInfo> m_pFontInfo; |
| 69 FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; |
| 70 CFX_FontMgr* const m_pFontMgr; |
| 71 }; |
| 72 |
| 73 #endif // CORE_FXGE_INCLUDE_CFX_FONTMAPPER_H_ |
OLD | NEW |