• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The PDFium Authors
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 XFA_FGAS_FONT_CFGAS_PDFFONTMGR_H_
8 #define XFA_FGAS_FONT_CFGAS_PDFFONTMGR_H_
9 
10 #include <map>
11 #include <utility>
12 
13 #include "core/fxcrt/fx_string.h"
14 #include "core/fxcrt/retain_ptr.h"
15 #include "core/fxcrt/unowned_ptr.h"
16 #include "xfa/fgas/font/cfgas_fontmgr.h"
17 
18 class CFGAS_GEFont;
19 class CPDF_Document;
20 
21 class CFGAS_PDFFontMgr final {
22  public:
23   explicit CFGAS_PDFFontMgr(const CPDF_Document* pDoc);
24   ~CFGAS_PDFFontMgr();
25 
26   RetainPtr<CFGAS_GEFont> GetFont(const WideString& wsFontFamily,
27                                   uint32_t dwFontStyles,
28                                   bool bStrictMatch);
29 
30  private:
31   RetainPtr<CFGAS_GEFont> FindFont(const ByteString& strFamilyName,
32                                    bool bBold,
33                                    bool bItalic,
34                                    bool bStrictMatch);
35 
36   UnownedPtr<const CPDF_Document> const m_pDoc;
37   std::map<std::pair<WideString, uint32_t>, RetainPtr<CFGAS_GEFont>> m_FontMap;
38 };
39 
40 #endif  // XFA_FGAS_FONT_CFGAS_PDFFONTMGR_H_
41