| 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_CFGAS_FONTMGR_H_ | 7 #ifndef XFA_FGAS_FONT_CFGAS_FONTMGR_H_ |
| 8 #define XFA_FGAS_FONT_CFGAS_FONTMGR_H_ | 8 #define XFA_FGAS_FONT_CFGAS_FONTMGR_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 ~CFX_FontDescriptor(); | 139 ~CFX_FontDescriptor(); |
| 140 | 140 |
| 141 int32_t m_nFaceIndex; | 141 int32_t m_nFaceIndex; |
| 142 CFX_WideString m_wsFaceName; | 142 CFX_WideString m_wsFaceName; |
| 143 std::vector<CFX_WideString> m_wsFamilyNames; | 143 std::vector<CFX_WideString> m_wsFamilyNames; |
| 144 uint32_t m_dwFontStyles; | 144 uint32_t m_dwFontStyles; |
| 145 uint32_t m_dwUsb[4]; | 145 uint32_t m_dwUsb[4]; |
| 146 uint32_t m_dwCsb[2]; | 146 uint32_t m_dwCsb[2]; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 typedef CFX_ArrayTemplate<CFX_FontDescriptor*> CFX_FontDescriptors; | 149 class CFX_FontDescriptorInfo { |
| 150 | |
| 151 struct FX_FontDescriptorInfo { | |
| 152 public: | 150 public: |
| 153 CFX_FontDescriptor* pFont; | 151 CFX_FontDescriptor* pFont; |
| 154 int32_t nPenalty; | 152 int32_t nPenalty; |
| 155 | 153 |
| 156 bool operator>(const FX_FontDescriptorInfo& other) const { | 154 bool operator>(const CFX_FontDescriptorInfo& other) const { |
| 157 return nPenalty > other.nPenalty; | 155 return nPenalty > other.nPenalty; |
| 158 } | 156 } |
| 159 bool operator<(const FX_FontDescriptorInfo& other) const { | 157 bool operator<(const CFX_FontDescriptorInfo& other) const { |
| 160 return nPenalty < other.nPenalty; | 158 return nPenalty < other.nPenalty; |
| 161 } | 159 } |
| 162 bool operator==(const FX_FontDescriptorInfo& other) const { | 160 bool operator==(const CFX_FontDescriptorInfo& other) const { |
| 163 return nPenalty == other.nPenalty; | 161 return nPenalty == other.nPenalty; |
| 164 } | 162 } |
| 165 }; | 163 }; |
| 166 | 164 |
| 167 typedef CFX_ArrayTemplate<FX_FontDescriptorInfo> CFX_FontDescriptorInfos; | |
| 168 | |
| 169 struct FX_HandleParentPath { | 165 struct FX_HandleParentPath { |
| 170 FX_HandleParentPath() {} | 166 FX_HandleParentPath() {} |
| 171 FX_HandleParentPath(const FX_HandleParentPath& x) { | 167 FX_HandleParentPath(const FX_HandleParentPath& x) { |
| 172 pFileHandle = x.pFileHandle; | 168 pFileHandle = x.pFileHandle; |
| 173 bsParentPath = x.bsParentPath; | 169 bsParentPath = x.bsParentPath; |
| 174 } | 170 } |
| 175 FX_FileHandle* pFileHandle; | 171 FX_FileHandle* pFileHandle; |
| 176 CFX_ByteString bsParentPath; | 172 CFX_ByteString bsParentPath; |
| 177 }; | 173 }; |
| 178 | 174 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, | 215 void RegisterFaces(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, |
| 220 const CFX_WideString* pFaceName); | 216 const CFX_WideString* pFaceName); |
| 221 void GetNames(const uint8_t* name_table, std::vector<CFX_WideString>& Names); | 217 void GetNames(const uint8_t* name_table, std::vector<CFX_WideString>& Names); |
| 222 std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; | 218 std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; |
| 223 void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); | 219 void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); |
| 224 uint32_t GetFlags(FXFT_Face pFace); | 220 uint32_t GetFlags(FXFT_Face pFace); |
| 225 bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); | 221 bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); |
| 226 bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, | 222 bool VerifyUnicode(const CFX_RetainPtr<CFGAS_GEFont>& pFont, |
| 227 FX_WCHAR wcUnicode); | 223 FX_WCHAR wcUnicode); |
| 228 int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); | 224 int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); |
| 229 int32_t MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, | 225 void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts, |
| 230 uint16_t wCodePage, | 226 uint16_t wCodePage, |
| 231 uint32_t dwFontStyles, | 227 uint32_t dwFontStyles, |
| 232 const CFX_WideString& FontName, | 228 const CFX_WideString& FontName, |
| 233 FX_WCHAR wcUnicode = 0xFFFE); | 229 FX_WCHAR wcUnicode = 0xFFFE); |
| 234 int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, | 230 int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, |
| 235 uint16_t wCodePage, | 231 uint16_t wCodePage, |
| 236 uint32_t dwFontStyles, | 232 uint32_t dwFontStyles, |
| 237 const CFX_WideString& FontName, | 233 const CFX_WideString& FontName, |
| 238 FX_WCHAR wcUnicode = 0xFFFE); | 234 FX_WCHAR wcUnicode = 0xFFFE); |
| 239 CFX_RetainPtr<CFGAS_GEFont> LoadFont(const CFX_WideString& wsFaceName, | 235 CFX_RetainPtr<CFGAS_GEFont> LoadFont(const CFX_WideString& wsFaceName, |
| 240 int32_t iFaceIndex, | 236 int32_t iFaceIndex, |
| 241 int32_t* pFaceCount); | 237 int32_t* pFaceCount); |
| 242 FXFT_Face LoadFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, | 238 FXFT_Face LoadFace(const CFX_RetainPtr<IFX_SeekableReadStream>& pFontStream, |
| 243 int32_t iFaceIndex); | 239 int32_t iFaceIndex); |
| 244 CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( | 240 CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( |
| 245 CFX_FontMapper* pFontMapper, | 241 CFX_FontMapper* pFontMapper, |
| 246 IFX_SystemFontInfo* pSystemFontInfo, | 242 IFX_SystemFontInfo* pSystemFontInfo, |
| 247 uint32_t index); | 243 uint32_t index); |
| 248 CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( | 244 CFX_RetainPtr<IFX_SeekableReadStream> CreateFontStream( |
| 249 const CFX_ByteString& bsFaceName); | 245 const CFX_ByteString& bsFaceName); |
| 250 | 246 |
| 251 CFX_FontDescriptors m_InstalledFonts; | 247 CFX_FontSourceEnum_File* const m_pFontSource; |
| 252 std::map<uint32_t, std::unique_ptr<CFX_FontDescriptorInfos>> | 248 std::vector<std::unique_ptr<CFX_FontDescriptor>> m_InstalledFonts; |
| 249 std::map<uint32_t, std::unique_ptr<std::vector<CFX_FontDescriptorInfo>>> |
| 253 m_Hash2CandidateList; | 250 m_Hash2CandidateList; |
| 254 std::map<uint32_t, std::vector<CFX_RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts; | 251 std::map<uint32_t, std::vector<CFX_RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts; |
| 255 std::map<CFX_RetainPtr<CFGAS_GEFont>, CFX_RetainPtr<IFX_SeekableReadStream>> | 252 std::map<CFX_RetainPtr<CFGAS_GEFont>, CFX_RetainPtr<IFX_SeekableReadStream>> |
| 256 m_IFXFont2FileRead; | 253 m_IFXFont2FileRead; |
| 257 std::set<FX_WCHAR> m_FailedUnicodesSet; | 254 std::set<FX_WCHAR> m_FailedUnicodesSet; |
| 258 CFX_FontSourceEnum_File* const m_pFontSource; | |
| 259 }; | 255 }; |
| 260 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 256 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 261 | 257 |
| 262 #endif // XFA_FGAS_FONT_CFGAS_FONTMGR_H_ | 258 #endif // XFA_FGAS_FONT_CFGAS_FONTMGR_H_ |
| OLD | NEW |