xref: /aosp_15_r20/external/pdfium/xfa/fxfa/cxfa_fontmgr.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2014 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_FXFA_CXFA_FONTMGR_H_
8 #define XFA_FXFA_CXFA_FONTMGR_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 "fxjs/gc/heap.h"
16 #include "v8/include/cppgc/garbage-collected.h"
17 
18 class CFGAS_GEFont;
19 class CXFA_FFDoc;
20 
21 class CXFA_FontMgr final : public cppgc::GarbageCollected<CXFA_FontMgr> {
22  public:
23   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
24   ~CXFA_FontMgr();
25 
26   void Trace(cppgc::Visitor* visitor) const;
27   RetainPtr<CFGAS_GEFont> GetFont(CXFA_FFDoc* hDoc,
28                                   const WideString& wsFontFamily,
29                                   uint32_t dwFontStyles);
30 
31  private:
32   CXFA_FontMgr();
33 
34   std::map<std::pair<WideString, uint32_t>, RetainPtr<CFGAS_GEFont>> m_FontMap;
35 };
36 
37 #endif  //  XFA_FXFA_CXFA_FONTMGR_H_
38