Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: xfa/fxfa/include/xfa_fontmgr.h

Issue 2383593002: Move xfa/fxfa/include to xfa/fxfa (Closed)
Patch Set: Rebase to master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/include/xfa_ffwidgethandler.h ('k') | xfa/fxfa/include/xfa_rendercontext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 XFA_FXFA_INCLUDE_XFA_FONTMGR_H_
8 #define XFA_FXFA_INCLUDE_XFA_FONTMGR_H_
9
10 #include <map>
11 #include <memory>
12
13 #include "core/fxcrt/fx_ext.h"
14 #include "core/fxcrt/fx_system.h"
15 #include "xfa/fgas/font/fgas_font.h"
16 #include "xfa/fxfa/include/fxfa.h"
17
18 class CPDF_Font;
19
20 struct XFA_FONTINFO {
21 uint32_t dwFontNameHash;
22 const FX_WCHAR* pPsName;
23 const FX_WCHAR* pReplaceFont;
24 uint16_t dwStyles;
25 uint16_t wCodePage;
26 };
27
28 class CXFA_DefFontMgr {
29 public:
30 CXFA_DefFontMgr();
31 ~CXFA_DefFontMgr();
32
33 CFGAS_GEFont* GetFont(CXFA_FFDoc* hDoc,
34 const CFX_WideStringC& wsFontFamily,
35 uint32_t dwFontStyles,
36 uint16_t wCodePage = 0xFFFF);
37 CFGAS_GEFont* GetDefaultFont(CXFA_FFDoc* hDoc,
38 const CFX_WideStringC& wsFontFamily,
39 uint32_t dwFontStyles,
40 uint16_t wCodePage = 0xFFFF);
41
42 protected:
43 CFX_ArrayTemplate<CFGAS_GEFont*> m_CacheFonts;
44 };
45
46 class CXFA_PDFFontMgr {
47 public:
48 explicit CXFA_PDFFontMgr(CXFA_FFDoc* pDoc);
49 ~CXFA_PDFFontMgr();
50
51 CFGAS_GEFont* GetFont(const CFX_WideStringC& wsFontFamily,
52 uint32_t dwFontStyles,
53 CPDF_Font** pPDFFont,
54 bool bStrictMatch);
55 bool GetCharWidth(const CFGAS_GEFont* pFont,
56 FX_WCHAR wUnicode,
57 bool bCharCode,
58 int32_t* pWidth);
59 void SetFont(const CFGAS_GEFont* pFont, CPDF_Font* pPDFFont);
60
61 protected:
62 CFGAS_GEFont* FindFont(const CFX_ByteString& strFamilyName,
63 bool bBold,
64 bool bItalic,
65 CPDF_Font** pPDFFont,
66 bool bStrictMatch);
67 CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName,
68 bool bBold,
69 bool bItalic);
70 bool PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
71 bool bBold,
72 bool bItalic,
73 const CFX_ByteString& bsDRFontName,
74 bool bStrictMatch);
75
76 CXFA_FFDoc* const m_pDoc;
77 std::map<const CFGAS_GEFont*, CPDF_Font*> m_FDE2PDFFont;
78 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap;
79 };
80
81 class CXFA_FontMgr {
82 public:
83 CXFA_FontMgr();
84 ~CXFA_FontMgr();
85
86 CFGAS_GEFont* GetFont(CXFA_FFDoc* hDoc,
87 const CFX_WideStringC& wsFontFamily,
88 uint32_t dwFontStyles,
89 uint16_t wCodePage = 0xFFFF);
90 void LoadDocFonts(CXFA_FFDoc* hDoc);
91 void ReleaseDocFonts(CXFA_FFDoc* hDoc);
92 void SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr);
93
94 protected:
95 std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr;
96 std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap;
97 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap;
98 };
99
100 #endif // XFA_FXFA_INCLUDE_XFA_FONTMGR_H_
OLDNEW
« no previous file with comments | « xfa/fxfa/include/xfa_ffwidgethandler.h ('k') | xfa/fxfa/include/xfa_rendercontext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698