summaryrefslogtreecommitdiff
path: root/core/fxge/ge/cfx_folderfontinfo.h
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-07-27 13:54:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-27 13:54:25 -0700
commitf73893a6110f2d4960b372fb4fe38e4fd629ce8f (patch)
treee90128b1eb13a8d5c623fb91b30b07a5cf58eb86 /core/fxge/ge/cfx_folderfontinfo.h
parent461eeafe191068ac8c32f2717907fc6a22a667d2 (diff)
downloadpdfium-f73893a6110f2d4960b372fb4fe38e4fd629ce8f.tar.xz
Splitting fx_ge_fontmap.cpp
Move CFX_FolderFontInfo, CFX_FontMgr, and CFX_FontMapper into their own classes. There are namespaces in each of the new files, having methods from the original namespace in fx_ge_fontmap, according to what each class needs. Review-Url: https://codereview.chromium.org/2185533006
Diffstat (limited to 'core/fxge/ge/cfx_folderfontinfo.h')
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/core/fxge/ge/cfx_folderfontinfo.h b/core/fxge/ge/cfx_folderfontinfo.h
new file mode 100644
index 0000000000..c0ce01cd36
--- /dev/null
+++ b/core/fxge/ge/cfx_folderfontinfo.h
@@ -0,0 +1,67 @@
+// Copyright 2016 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 CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_
+#define CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_
+
+#include <map>
+#include <vector>
+
+#include "core/fxge/include/cfx_fontmapper.h"
+#include "core/fxge/include/ifx_systemfontinfo.h"
+#include "core/fxge/include/fx_font.h"
+
+class CFX_FolderFontInfo : public IFX_SystemFontInfo {
+ public:
+ CFX_FolderFontInfo();
+ ~CFX_FolderFontInfo() override;
+
+ void AddPath(const CFX_ByteStringC& path);
+
+ // IFX_SytemFontInfo:
+ FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override;
+ void* MapFont(int weight,
+ FX_BOOL bItalic,
+ int charset,
+ int pitch_family,
+ const FX_CHAR* face,
+ int& bExact) override;
+#ifdef PDF_ENABLE_XFA
+ void* MapFontByUnicode(uint32_t dwUnicode,
+ int weight,
+ FX_BOOL bItalic,
+ int pitch_family) override;
+#endif // PDF_ENABLE_XFA
+ void* GetFont(const FX_CHAR* face) override;
+ uint32_t GetFontData(void* hFont,
+ uint32_t table,
+ uint8_t* buffer,
+ uint32_t size) override;
+ void DeleteFont(void* hFont) override;
+ FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override;
+ FX_BOOL GetFontCharset(void* hFont, int& charset) override;
+
+ protected:
+ void ScanPath(const CFX_ByteString& path);
+ void ScanFile(const CFX_ByteString& path);
+ void ReportFace(const CFX_ByteString& path,
+ FXSYS_FILE* pFile,
+ uint32_t filesize,
+ uint32_t offset);
+ void* GetSubstFont(const CFX_ByteString& face);
+ void* FindFont(int weight,
+ FX_BOOL bItalic,
+ int charset,
+ int pitch_family,
+ const FX_CHAR* family,
+ FX_BOOL bMatchName);
+
+ std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList;
+ std::vector<CFX_ByteString> m_PathList;
+ CFX_FontMapper* m_pMapper;
+};
+
+#endif // CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_