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

Unified Diff: core/fxge/include/cfx_folderfontinfo.h

Issue 2185533006: Splitting fx_ge_fontmap.cpp (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits and added header files Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: core/fxge/include/cfx_folderfontinfo.h
diff --git a/core/fxge/include/cfx_folderfontinfo.h b/core/fxge/include/cfx_folderfontinfo.h
new file mode 100644
index 0000000000000000000000000000000000000000..881b74f3a33766f97fdf4ba91ac1707a48ced371
--- /dev/null
+++ b/core/fxge/include/cfx_folderfontinfo.h
@@ -0,0 +1,97 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
dsinclair 2016/07/27 17:36:01 nit: 2016
npm 2016/07/27 18:51:57 Done.
+// 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_INCLUDE_CFX_FOLDERFONTINFO_H_
+#define CORE_FXGE_INCLUDE_CFX_FOLDERFONTINFO_H_
+
+#include "core/fxge/include/cfx_fontmapper.h"
+#include "core/fxge/include/fx_font.h"
+
+class IFX_SystemFontInfo {
dsinclair 2016/07/27 17:36:01 Can you move this to it's own .h file as well? Loo
npm 2016/07/27 18:51:57 Done.
+ public:
+ static std::unique_ptr<IFX_SystemFontInfo> CreateDefault(
+ const char** pUserPaths);
+
+ virtual ~IFX_SystemFontInfo() {}
+
+ virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0;
+ virtual void* MapFont(int weight,
+ FX_BOOL bItalic,
+ int charset,
+ int pitch_family,
+ const FX_CHAR* face,
+ int& iExact) = 0;
+
+#ifdef PDF_ENABLE_XFA
+ virtual void* MapFontByUnicode(uint32_t dwUnicode,
+ int weight,
+ FX_BOOL bItalic,
+ int pitch_family);
+#endif // PDF_ENABLE_XFA
+
+ virtual void* GetFont(const FX_CHAR* face) = 0;
+ virtual uint32_t GetFontData(void* hFont,
+ uint32_t table,
+ uint8_t* buffer,
+ uint32_t size) = 0;
+ virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0;
+ virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0;
+ virtual int GetFaceIndex(void* hFont);
+ virtual void DeleteFont(void* hFont) = 0;
+ virtual void* RetainFont(void* hFont);
+};
+
+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_INCLUDE_CFX_FOLDERFONTINFO_H_

Powered by Google App Engine
This is Rietveld 408576698