summaryrefslogtreecommitdiff
path: root/xfa/src/fxfa/app/xfa_fontmgr.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-08 13:49:22 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-08 13:49:22 -0500
commit6cdf084fa40a62eb33185171622ad12d95c6009e (patch)
treedaeea24a81365ed27582f280b7f19add0cb7b0d7 /xfa/src/fxfa/app/xfa_fontmgr.h
parent653e0797debddb4e9aecbc6cde65748d43b18b79 (diff)
downloadpdfium-6cdf084fa40a62eb33185171622ad12d95c6009e.tar.xz
Remove xfa/src/fxfa/src/common and xfa/src/fxfa/src
This Cl moves the code in xfa/src/fxfa/src/common to the diretory which contains the respective implementations and removes the xfa/src/fxfa/src/common directory. It them moves all of the code in xfa/src/fxfa/src up one level and removes the xfa/src/fxfa/src directory. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1770073003 .
Diffstat (limited to 'xfa/src/fxfa/app/xfa_fontmgr.h')
-rw-r--r--xfa/src/fxfa/app/xfa_fontmgr.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/xfa/src/fxfa/app/xfa_fontmgr.h b/xfa/src/fxfa/app/xfa_fontmgr.h
new file mode 100644
index 0000000000..b8fa4ae31c
--- /dev/null
+++ b/xfa/src/fxfa/app/xfa_fontmgr.h
@@ -0,0 +1,98 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_SRC_FXFA_APP_XFA_FONTMGR_H_
+#define XFA_SRC_FXFA_APP_XFA_FONTMGR_H_
+
+#include <map>
+
+#include "core/include/fxcrt/fx_ext.h"
+#include "core/include/fxcrt/fx_system.h"
+#include "xfa/include/fxfa/fxfa.h"
+#include "xfa/src/fgas/include/fx_fnt.h"
+
+struct XFA_FONTINFO {
+ FX_DWORD dwFontNameHash;
+ const FX_WCHAR* pPsName;
+ const FX_WCHAR* pReplaceFont;
+ FX_WORD dwStyles;
+ FX_WORD wCodePage;
+};
+
+class CXFA_DefFontMgr : public IXFA_FontMgr {
+ public:
+ CXFA_DefFontMgr() {}
+ ~CXFA_DefFontMgr() override;
+
+ // IXFA_FontMgr:
+ IFX_Font* GetFont(IXFA_Doc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ FX_DWORD dwFontStyles,
+ FX_WORD wCodePage = 0xFFFF) override;
+ IFX_Font* GetDefaultFont(IXFA_Doc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ FX_DWORD dwFontStyles,
+ FX_WORD wCodePage = 0xFFFF) override;
+
+ protected:
+ CFX_PtrArray m_CacheFonts;
+};
+
+class CXFA_PDFFontMgr : public IFX_FontProvider {
+ public:
+ CXFA_PDFFontMgr(CXFA_FFDoc* pDoc);
+ ~CXFA_PDFFontMgr();
+ IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily,
+ FX_DWORD dwFontStyles,
+ CPDF_Font** pPDFFont,
+ FX_BOOL bStrictMatch = TRUE);
+ FX_BOOL GetCharWidth(IFX_Font* pFont,
+ FX_WCHAR wUnicode,
+ int32_t& iWidth,
+ FX_BOOL bCharCode);
+ CFX_MapPtrToPtr m_FDE2PDFFont;
+
+ protected:
+ IFX_Font* FindFont(CFX_ByteString strFamilyName,
+ FX_BOOL bBold,
+ FX_BOOL bItalic,
+ CPDF_Font** pPDFFont,
+ FX_BOOL bStrictMatch = TRUE);
+ CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName,
+ FX_BOOL bBold,
+ FX_BOOL bItalic);
+ FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName,
+ FX_BOOL bBold,
+ FX_BOOL bItalic,
+ const CFX_ByteString& bsDRFontName,
+ FX_BOOL bStrictMatch = TRUE);
+
+ CXFA_FFDoc* m_pDoc;
+ std::map<CFX_ByteString, IFX_Font*> m_FontMap;
+};
+
+class CXFA_FontMgr {
+ public:
+ CXFA_FontMgr();
+ ~CXFA_FontMgr();
+ IFX_Font* GetFont(IXFA_Doc* hDoc,
+ const CFX_WideStringC& wsFontFamily,
+ FX_DWORD dwFontStyles,
+ FX_WORD wCodePage = 0xFFFF);
+ void LoadDocFonts(IXFA_Doc* hDoc);
+ void ReleaseDocFonts(IXFA_Doc* hDoc);
+
+ void SetDefFontMgr(IXFA_FontMgr* pFontMgr);
+
+ protected:
+ void DelAllMgrMap();
+
+ CFX_MapPtrToPtr m_PDFFontMgrArray;
+ IXFA_FontMgr* m_pDefFontMgr;
+ std::map<CFX_ByteString, IFX_Font*> m_FontMap;
+};
+
+#endif // XFA_SRC_FXFA_APP_XFA_FONTMGR_H_