| 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_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ | 7 #ifndef CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ |
| 8 #define CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ | 8 #define CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/fx_system.h" | 10 #include "core/fxcrt/fx_system.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 FX_CHAR* m_pPath; | 69 FX_CHAR* m_pPath; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { | 72 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { |
| 73 public: | 73 public: |
| 74 CFPF_SkiaFileFont() : m_pFile(nullptr) {} | 74 CFPF_SkiaFileFont() : m_pFile(nullptr) {} |
| 75 | 75 |
| 76 // CFPF_SkiaFontDescriptor | 76 // CFPF_SkiaFontDescriptor |
| 77 int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; } | 77 int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; } |
| 78 IFX_FileRead* m_pFile; | 78 IFX_SeekableReadStream* m_pFile; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { | 81 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { |
| 82 public: | 82 public: |
| 83 CFPF_SkiaBufferFont() : m_pBuffer(nullptr), m_szBuffer(0) {} | 83 CFPF_SkiaBufferFont() : m_pBuffer(nullptr), m_szBuffer(0) {} |
| 84 | 84 |
| 85 // CFPF_SkiaFontDescriptor | 85 // CFPF_SkiaFontDescriptor |
| 86 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; } | 86 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; } |
| 87 | 87 |
| 88 void* m_pBuffer; | 88 void* m_pBuffer; |
| 89 size_t m_szBuffer; | 89 size_t m_szBuffer; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 class CFPF_SkiaFontMgr { | 92 class CFPF_SkiaFontMgr { |
| 93 public: | 93 public: |
| 94 CFPF_SkiaFontMgr(); | 94 CFPF_SkiaFontMgr(); |
| 95 ~CFPF_SkiaFontMgr(); | 95 ~CFPF_SkiaFontMgr(); |
| 96 | 96 |
| 97 void LoadSystemFonts(); | 97 void LoadSystemFonts(); |
| 98 CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname, | 98 CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname, |
| 99 uint8_t uCharset, | 99 uint8_t uCharset, |
| 100 uint32_t dwStyle, | 100 uint32_t dwStyle, |
| 101 uint32_t dwMatch = 0); | 101 uint32_t dwMatch = 0); |
| 102 | 102 |
| 103 bool InitFTLibrary(); | 103 bool InitFTLibrary(); |
| 104 FXFT_Face GetFontFace(IFX_FileRead* pFileRead, int32_t iFaceIndex = 0); | 104 FXFT_Face GetFontFace(IFX_SeekableReadStream* pFileRead, |
| 105 int32_t iFaceIndex = 0); |
| 105 FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0); | 106 FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0); |
| 106 FXFT_Face GetFontFace(const uint8_t* pBuffer, | 107 FXFT_Face GetFontFace(const uint8_t* pBuffer, |
| 107 size_t szBuffer, | 108 size_t szBuffer, |
| 108 int32_t iFaceIndex = 0); | 109 int32_t iFaceIndex = 0); |
| 109 | 110 |
| 110 private: | 111 private: |
| 111 void ScanPath(const CFX_ByteString& path); | 112 void ScanPath(const CFX_ByteString& path); |
| 112 void ScanFile(const CFX_ByteString& file); | 113 void ScanFile(const CFX_ByteString& file); |
| 113 void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc); | 114 void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc); |
| 114 | 115 |
| 115 bool m_bLoaded; | 116 bool m_bLoaded; |
| 116 FXFT_Library m_FTLibrary; | 117 FXFT_Library m_FTLibrary; |
| 117 std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces; | 118 std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces; |
| 118 std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts; | 119 std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts; |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 #endif // _FX_OS_ == _FX_ANDROID_ | 122 #endif // _FX_OS_ == _FX_ANDROID_ |
| 122 | 123 |
| 123 #endif // CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ | 124 #endif // CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ |
| OLD | NEW |