summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-10-25 14:26:39 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-25 14:26:39 -0700
commitcfcc11e53a60b3f56a9bbe13718ecb9b997384da (patch)
tree7ac6fc6f1bf8f180769021f51c7235db21da4eb1
parent4ee6139e8cfecab9e181115894b26131ad6de09a (diff)
downloadpdfium-cfcc11e53a60b3f56a9bbe13718ecb9b997384da.tar.xz
Name core/fxge/android files appropriately and use one file per class
- Rename files so that they correspond to class names. - Remove OS_Android ifs, since they are unneeded. - Split fpf_skiafontmgr.h into classes, one per file. Review-Url: https://codereview.chromium.org/2448293002
-rw-r--r--BUILD.gn18
-rw-r--r--core/fxge/android/cfpf_skiabufferfont.h25
-rw-r--r--core/fxge/android/cfpf_skiadevicemodule.cpp (renamed from core/fxge/android/fpf_skiamodule.cpp)11
-rw-r--r--core/fxge/android/cfpf_skiadevicemodule.h (renamed from core/fxge/android/fpf_skiamodule.h)16
-rw-r--r--core/fxge/android/cfpf_skiafilefont.h25
-rw-r--r--core/fxge/android/cfpf_skiafont.cpp (renamed from core/fxge/android/fpf_skiafont.cpp)10
-rw-r--r--core/fxge/android/cfpf_skiafont.h (renamed from core/fxge/android/fpf_skiafont.h)8
-rw-r--r--core/fxge/android/cfpf_skiafontdescriptor.h40
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.cpp10
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.h52
-rw-r--r--core/fxge/android/cfpf_skiapathfont.h33
-rw-r--r--core/fxge/android/cfx_androidfontinfo.cpp (renamed from core/fxge/android/fx_android_font.cpp)14
-rw-r--r--core/fxge/android/cfx_androidfontinfo.h (renamed from core/fxge/android/fx_android_font.h)13
-rw-r--r--core/fxge/android/fpf_skiafontmgr.h124
-rw-r--r--core/fxge/android/fx_android_imp.cpp11
15 files changed, 222 insertions, 188 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 05408e0712..a77ea4c6b2 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -746,14 +746,18 @@ static_library("fxcrt") {
static_library("fxge") {
sources = [
+ "core/fxge/android/cfpf_skiabufferfont.h",
+ "core/fxge/android/cfpf_skiadevicemodule.cpp",
+ "core/fxge/android/cfpf_skiadevicemodule.h",
+ "core/fxge/android/cfpf_skiafilefont.h",
+ "core/fxge/android/cfpf_skiafont.cpp",
+ "core/fxge/android/cfpf_skiafont.h",
+ "core/fxge/android/cfpf_skiafontdescriptor.h",
"core/fxge/android/cfpf_skiafontmgr.cpp",
- "core/fxge/android/fpf_skiafont.cpp",
- "core/fxge/android/fpf_skiafont.h",
- "core/fxge/android/fpf_skiafontmgr.h",
- "core/fxge/android/fpf_skiamodule.cpp",
- "core/fxge/android/fpf_skiamodule.h",
- "core/fxge/android/fx_android_font.cpp",
- "core/fxge/android/fx_android_font.h",
+ "core/fxge/android/cfpf_skiafontmgr.h",
+ "core/fxge/android/cfpf_skiapathfont.h",
+ "core/fxge/android/cfx_androidfontinfo.cpp",
+ "core/fxge/android/cfx_androidfontinfo.h",
"core/fxge/android/fx_android_imp.cpp",
"core/fxge/apple/apple_int.h",
"core/fxge/apple/cfx_quartzdevice.h",
diff --git a/core/fxge/android/cfpf_skiabufferfont.h b/core/fxge/android/cfpf_skiabufferfont.h
new file mode 100644
index 0000000000..02fdadea1e
--- /dev/null
+++ b/core/fxge/android/cfpf_skiabufferfont.h
@@ -0,0 +1,25 @@
+// 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_ANDROID_CFPF_SKIABUFFERFONT_H_
+#define CORE_FXGE_ANDROID_CFPF_SKIABUFFERFONT_H_
+
+#include "core/fxge/android/cfpf_skiafontdescriptor.h"
+
+#define FPF_SKIAFONTTYPE_Buffer 3
+
+class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor {
+ public:
+ CFPF_SkiaBufferFont() : m_pBuffer(nullptr), m_szBuffer(0) {}
+
+ // CFPF_SkiaFontDescriptor
+ int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; }
+
+ void* m_pBuffer;
+ size_t m_szBuffer;
+};
+
+#endif // CORE_FXGE_ANDROID_CFPF_SKIABUFFERFONT_H_
diff --git a/core/fxge/android/fpf_skiamodule.cpp b/core/fxge/android/cfpf_skiadevicemodule.cpp
index e541b2414f..7bdf64666f 100644
--- a/core/fxge/android/fpf_skiamodule.cpp
+++ b/core/fxge/android/cfpf_skiadevicemodule.cpp
@@ -1,15 +1,12 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// 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
-#include "core/fxcrt/fx_system.h"
+#include "core/fxge/android/cfpf_skiadevicemodule.h"
-#if _FX_OS_ == _FX_ANDROID_
-
-#include "core/fxge/android/fpf_skiafontmgr.h"
-#include "core/fxge/android/fpf_skiamodule.h"
+#include "core/fxge/android/cfpf_skiafontmgr.h"
namespace {
@@ -42,5 +39,3 @@ CFPF_SkiaFontMgr* CFPF_SkiaDeviceModule::GetFontMgr() {
}
return m_pFontMgr;
}
-
-#endif // _FX_OS_ == _FX_ANDROID_
diff --git a/core/fxge/android/fpf_skiamodule.h b/core/fxge/android/cfpf_skiadevicemodule.h
index a0fb5e0826..3261820039 100644
--- a/core/fxge/android/fpf_skiamodule.h
+++ b/core/fxge/android/cfpf_skiadevicemodule.h
@@ -1,17 +1,11 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// 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_ANDROID_FPF_SKIAMODULE_H_
-#define CORE_FXGE_ANDROID_FPF_SKIAMODULE_H_
-
-#include "core/fxcrt/fx_system.h"
-
-#if _FX_OS_ == _FX_ANDROID_
-
-#include "core/fxge/android/fpf_skiafontmgr.h"
+#ifndef CORE_FXGE_ANDROID_CFPF_SKIADEVICEMODULE_H_
+#define CORE_FXGE_ANDROID_CFPF_SKIADEVICEMODULE_H_
class CFPF_SkiaFontMgr;
@@ -29,6 +23,4 @@ class CFPF_SkiaDeviceModule {
CFPF_SkiaDeviceModule* CFPF_GetSkiaDeviceModule();
-#endif // _FX_OS_ == _FX_ANDROID_
-
-#endif // CORE_FXGE_ANDROID_FPF_SKIAMODULE_H_
+#endif // CORE_FXGE_ANDROID_CFPF_SKIADEVICEMODULE_H_
diff --git a/core/fxge/android/cfpf_skiafilefont.h b/core/fxge/android/cfpf_skiafilefont.h
new file mode 100644
index 0000000000..b6657bf978
--- /dev/null
+++ b/core/fxge/android/cfpf_skiafilefont.h
@@ -0,0 +1,25 @@
+// 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_ANDROID_CFPF_SKIAFILEFONT_H_
+#define CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_
+
+#include "core/fxge/android/cfpf_skiafontdescriptor.h"
+
+class IFX_SeekableReadStream;
+
+#define FPF_SKIAFONTTYPE_File 2
+
+class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor {
+ public:
+ CFPF_SkiaFileFont() : m_pFile(nullptr) {}
+
+ // CFPF_SkiaFontDescriptor
+ int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; }
+ IFX_SeekableReadStream* m_pFile;
+};
+
+#endif // CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_
diff --git a/core/fxge/android/fpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp
index 9c19697387..c7cfd4d324 100644
--- a/core/fxge/android/fpf_skiafont.cpp
+++ b/core/fxge/android/cfpf_skiafont.cpp
@@ -1,15 +1,19 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// 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
-#include "core/fxge/android/fpf_skiafont.h"
+#include "core/fxge/android/cfpf_skiafont.h"
#include <algorithm>
#include "core/fxcrt/fx_system.h"
-#include "core/fxge/android/fpf_skiafontmgr.h"
+#include "core/fxge/android/cfpf_skiabufferfont.h"
+#include "core/fxge/android/cfpf_skiafilefont.h"
+#include "core/fxge/android/cfpf_skiafontdescriptor.h"
+#include "core/fxge/android/cfpf_skiafontmgr.h"
+#include "core/fxge/android/cfpf_skiapathfont.h"
#include "core/fxge/fx_freetype.h"
#define FPF_EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em)
diff --git a/core/fxge/android/fpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h
index 3adf0c36cf..ad0245d5d6 100644
--- a/core/fxge/android/fpf_skiafont.h
+++ b/core/fxge/android/cfpf_skiafont.h
@@ -1,11 +1,11 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// 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_ANDROID_FPF_SKIAFONT_H_
-#define CORE_FXGE_ANDROID_FPF_SKIAFONT_H_
+#ifndef CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
+#define CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_font.h"
@@ -50,4 +50,4 @@ class CFPF_SkiaFont {
uint32_t m_dwRefCount;
};
-#endif // CORE_FXGE_ANDROID_FPF_SKIAFONT_H_
+#endif // CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
diff --git a/core/fxge/android/cfpf_skiafontdescriptor.h b/core/fxge/android/cfpf_skiafontdescriptor.h
new file mode 100644
index 0000000000..57b85404ad
--- /dev/null
+++ b/core/fxge/android/cfpf_skiafontdescriptor.h
@@ -0,0 +1,40 @@
+// 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_ANDROID_CFPF_SKIAFONTDESCRIPTOR_H_
+#define CORE_FXGE_ANDROID_CFPF_SKIAFONTDESCRIPTOR_H_
+
+#include "core/fxcrt/fx_system.h"
+
+#define FPF_SKIAFONTTYPE_Unknown 0
+
+class CFPF_SkiaFontDescriptor {
+ public:
+ CFPF_SkiaFontDescriptor()
+ : m_pFamily(nullptr),
+ m_dwStyle(0),
+ m_iFaceIndex(0),
+ m_dwCharsets(0),
+ m_iGlyphNum(0) {}
+ virtual ~CFPF_SkiaFontDescriptor() { FX_Free(m_pFamily); }
+
+ virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
+
+ void SetFamily(const FX_CHAR* pFamily) {
+ FX_Free(m_pFamily);
+ int32_t iSize = FXSYS_strlen(pFamily);
+ m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
+ FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
+ m_pFamily[iSize] = 0;
+ }
+ FX_CHAR* m_pFamily;
+ uint32_t m_dwStyle;
+ int32_t m_iFaceIndex;
+ uint32_t m_dwCharsets;
+ int32_t m_iGlyphNum;
+};
+
+#endif // CORE_FXGE_ANDROID_CFPF_SKIAFONTDESCRIPTOR_H_
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 2deb327392..6463e8b531 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -1,10 +1,10 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// 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
-#include "core/fxcrt/fx_system.h"
+#include "core/fxge/android/cfpf_skiafontmgr.h"
#define FPF_SKIAMATCHWEIGHT_NAME1 62
#define FPF_SKIAMATCHWEIGHT_NAME2 60
@@ -15,8 +15,10 @@
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_memory.h"
-#include "core/fxge/android/fpf_skiafont.h"
-#include "core/fxge/android/fpf_skiafontmgr.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/android/cfpf_skiafont.h"
+#include "core/fxge/android/cfpf_skiafontdescriptor.h"
+#include "core/fxge/android/cfpf_skiapathfont.h"
#include "core/fxge/fx_freetype.h"
#ifdef __cplusplus
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
new file mode 100644
index 0000000000..7d89c6edb8
--- /dev/null
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -0,0 +1,52 @@
+// 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_ANDROID_CFPF_SKIAFONTMGR_H_
+#define CORE_FXGE_ANDROID_CFPF_SKIAFONTMGR_H_
+
+#include <map>
+#include <vector>
+
+#include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/fx_string.h"
+#include "core/fxge/fx_font.h"
+
+#define FPF_MATCHFONT_REPLACEANSI 1
+
+class CFPF_SkiaFont;
+class CFPF_SkiaFontDescriptor;
+
+class CFPF_SkiaFontMgr {
+ public:
+ CFPF_SkiaFontMgr();
+ ~CFPF_SkiaFontMgr();
+
+ void LoadSystemFonts();
+ CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname,
+ uint8_t uCharset,
+ uint32_t dwStyle,
+ uint32_t dwMatch = 0);
+
+ bool InitFTLibrary();
+ FXFT_Face GetFontFace(IFX_SeekableReadStream* pFileRead,
+ int32_t iFaceIndex = 0);
+ FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0);
+ FXFT_Face GetFontFace(const uint8_t* pBuffer,
+ size_t szBuffer,
+ int32_t iFaceIndex = 0);
+
+ private:
+ void ScanPath(const CFX_ByteString& path);
+ void ScanFile(const CFX_ByteString& file);
+ void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
+
+ bool m_bLoaded;
+ FXFT_Library m_FTLibrary;
+ std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces;
+ std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts;
+};
+
+#endif // CORE_FXGE_ANDROID_CFPF_SKIAFONTMGR_H_
diff --git a/core/fxge/android/cfpf_skiapathfont.h b/core/fxge/android/cfpf_skiapathfont.h
new file mode 100644
index 0000000000..f1cff2574b
--- /dev/null
+++ b/core/fxge/android/cfpf_skiapathfont.h
@@ -0,0 +1,33 @@
+// 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_ANDROID_CFPF_SKIAPATHFONT_H_
+#define CORE_FXGE_ANDROID_CFPF_SKIAPATHFONT_H_
+
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/android/cfpf_skiafontdescriptor.h"
+
+#define FPF_SKIAFONTTYPE_Path 1
+
+class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
+ public:
+ CFPF_SkiaPathFont() : m_pPath(nullptr) {}
+ ~CFPF_SkiaPathFont() override { FX_Free(m_pPath); }
+
+ // CFPF_SkiaFontDescriptor
+ int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; }
+
+ void SetPath(const FX_CHAR* pPath) {
+ FX_Free(m_pPath);
+ int32_t iSize = FXSYS_strlen(pPath);
+ m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
+ FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR));
+ m_pPath[iSize] = 0;
+ }
+ FX_CHAR* m_pPath;
+};
+
+#endif // CORE_FXGE_ANDROID_CFPF_SKIAPATHFONT_H_
diff --git a/core/fxge/android/fx_android_font.cpp b/core/fxge/android/cfx_androidfontinfo.cpp
index 2ffc897332..6db46e2775 100644
--- a/core/fxge/android/fx_android_font.cpp
+++ b/core/fxge/android/cfx_androidfontinfo.cpp
@@ -1,16 +1,14 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// 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
-#include "core/fxcrt/fx_system.h"
-
-#if _FX_OS_ == _FX_ANDROID_
+#include "core/fxge/android/cfx_androidfontinfo.h"
-#include "core/fxge/android/fpf_skiafont.h"
-#include "core/fxge/android/fpf_skiafontmgr.h"
-#include "core/fxge/android/fx_android_font.h"
+#include "core/fxcrt/fx_system.h"
+#include "core/fxge/android/cfpf_skiafont.h"
+#include "core/fxge/android/cfpf_skiafontmgr.h"
#include "core/fxge/cfx_fontmapper.h"
CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(nullptr) {}
@@ -87,5 +85,3 @@ void CFX_AndroidFontInfo::DeleteFont(void* hFont) {
static_cast<CFPF_SkiaFont*>(hFont)->Release();
}
-
-#endif // _FX_OS_ == _FX_ANDROID_
diff --git a/core/fxge/android/fx_android_font.h b/core/fxge/android/cfx_androidfontinfo.h
index 5b75d9d06e..135a2cdae7 100644
--- a/core/fxge/android/fx_android_font.h
+++ b/core/fxge/android/cfx_androidfontinfo.h
@@ -1,16 +1,13 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// 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_ANDROID_FX_ANDROID_FONT_H_
-#define CORE_FXGE_ANDROID_FX_ANDROID_FONT_H_
+#ifndef CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
+#define CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
#include "core/fxcrt/fx_system.h"
-
-#if _FX_OS_ == _FX_ANDROID_
-
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/ifx_systemfontinfo.h"
@@ -45,6 +42,4 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
CFPF_SkiaFontMgr* m_pFontMgr;
};
-#endif // _FX_OS_ == _FX_ANDROID_
-
-#endif // CORE_FXGE_ANDROID_FX_ANDROID_FONT_H_
+#endif // CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
diff --git a/core/fxge/android/fpf_skiafontmgr.h b/core/fxge/android/fpf_skiafontmgr.h
deleted file mode 100644
index 74e7adeb5a..0000000000
--- a/core/fxge/android/fpf_skiafontmgr.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// 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 CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
-#define CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
-
-#include "core/fxcrt/fx_system.h"
-
-#if _FX_OS_ == _FX_ANDROID_
-
-#include <map>
-#include <vector>
-
-#include "core/fxge/fx_font.h"
-
-#define FPF_SKIAFONTTYPE_Unknown 0
-#define FPF_SKIAFONTTYPE_Path 1
-#define FPF_SKIAFONTTYPE_File 2
-#define FPF_SKIAFONTTYPE_Buffer 3
-
-#define FPF_MATCHFONT_REPLACEANSI 1
-
-class CFPF_SkiaFont;
-
-class CFPF_SkiaFontDescriptor {
- public:
- CFPF_SkiaFontDescriptor()
- : m_pFamily(nullptr),
- m_dwStyle(0),
- m_iFaceIndex(0),
- m_dwCharsets(0),
- m_iGlyphNum(0) {}
- virtual ~CFPF_SkiaFontDescriptor() { FX_Free(m_pFamily); }
-
- virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
-
- void SetFamily(const FX_CHAR* pFamily) {
- FX_Free(m_pFamily);
- int32_t iSize = FXSYS_strlen(pFamily);
- m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
- FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
- m_pFamily[iSize] = 0;
- }
- FX_CHAR* m_pFamily;
- uint32_t m_dwStyle;
- int32_t m_iFaceIndex;
- uint32_t m_dwCharsets;
- int32_t m_iGlyphNum;
-};
-
-class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
- public:
- CFPF_SkiaPathFont() : m_pPath(nullptr) {}
- ~CFPF_SkiaPathFont() override { FX_Free(m_pPath); }
-
- // CFPF_SkiaFontDescriptor
- int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; }
-
- void SetPath(const FX_CHAR* pPath) {
- FX_Free(m_pPath);
- int32_t iSize = FXSYS_strlen(pPath);
- m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
- FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR));
- m_pPath[iSize] = 0;
- }
- FX_CHAR* m_pPath;
-};
-
-class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor {
- public:
- CFPF_SkiaFileFont() : m_pFile(nullptr) {}
-
- // CFPF_SkiaFontDescriptor
- int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; }
- IFX_SeekableReadStream* m_pFile;
-};
-
-class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor {
- public:
- CFPF_SkiaBufferFont() : m_pBuffer(nullptr), m_szBuffer(0) {}
-
- // CFPF_SkiaFontDescriptor
- int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; }
-
- void* m_pBuffer;
- size_t m_szBuffer;
-};
-
-class CFPF_SkiaFontMgr {
- public:
- CFPF_SkiaFontMgr();
- ~CFPF_SkiaFontMgr();
-
- void LoadSystemFonts();
- CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname,
- uint8_t uCharset,
- uint32_t dwStyle,
- uint32_t dwMatch = 0);
-
- bool InitFTLibrary();
- FXFT_Face GetFontFace(IFX_SeekableReadStream* pFileRead,
- int32_t iFaceIndex = 0);
- FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0);
- FXFT_Face GetFontFace(const uint8_t* pBuffer,
- size_t szBuffer,
- int32_t iFaceIndex = 0);
-
- private:
- void ScanPath(const CFX_ByteString& path);
- void ScanFile(const CFX_ByteString& file);
- void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
-
- bool m_bLoaded;
- FXFT_Library m_FTLibrary;
- std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces;
- std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts;
-};
-
-#endif // _FX_OS_ == _FX_ANDROID_
-
-#endif // CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
diff --git a/core/fxge/android/fx_android_imp.cpp b/core/fxge/android/fx_android_imp.cpp
index 6e9dafc0e4..b8e7c5b218 100644
--- a/core/fxge/android/fx_android_imp.cpp
+++ b/core/fxge/android/fx_android_imp.cpp
@@ -4,16 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcrt/fx_system.h"
-
-#if _FX_OS_ == _FX_ANDROID_
+#include "core/fxge/cfx_gemodule.h"
#include <memory>
#include <utility>
-#include "core/fxge/android/fpf_skiamodule.h"
-#include "core/fxge/android/fx_android_font.h"
-#include "core/fxge/cfx_gemodule.h"
+#include "core/fxge/android/cfpf_skiadevicemodule.h"
+#include "core/fxge/android/cfx_androidfontinfo.h"
void CFX_GEModule::InitPlatform() {
CFPF_SkiaDeviceModule* pDeviceModule = CFPF_GetSkiaDeviceModule();
@@ -33,5 +30,3 @@ void CFX_GEModule::DestroyPlatform() {
if (m_pPlatformData)
static_cast<CFPF_SkiaDeviceModule*>(m_pPlatformData)->Destroy();
}
-
-#endif // _FX_OS_ == _FX_ANDROID_