summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-13 10:52:11 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-13 10:52:12 -0700
commit6d8e981b51458f0381031fe240f5215db9906622 (patch)
treef36b121dd552a16ef5d8aeba7417fd8f8edfa611 /core/fxge
parent65ffa4a4ee599194118a0ddf3c26fc3674120b4a (diff)
downloadpdfium-6d8e981b51458f0381031fe240f5215db9906622.tar.xz
Cleanup IFPF_* interfaces.
This CL removes the IFPF_DeviceModule, IFPF_FontMgr and IFPF_Font interfaces in favour of their concrete classes. BUG=pdfium:467 Review URL: https://codereview.chromium.org/1881043004
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/android/fpf_skiafont.cpp98
-rw-r--r--core/fxge/android/fpf_skiafont.h49
-rw-r--r--core/fxge/android/fpf_skiafontmgr.cpp8
-rw-r--r--core/fxge/android/fpf_skiafontmgr.h28
-rw-r--r--core/fxge/android/fpf_skiamodule.cpp28
-rw-r--r--core/fxge/android/fpf_skiamodule.h18
-rw-r--r--core/fxge/android/fx_android_font.cpp68
-rw-r--r--core/fxge/android/fx_android_font.h9
-rw-r--r--core/fxge/android/fx_android_imp.cpp18
-rw-r--r--core/fxge/include/fpf.h70
10 files changed, 174 insertions, 220 deletions
diff --git a/core/fxge/android/fpf_skiafont.cpp b/core/fxge/android/fpf_skiafont.cpp
index 0d2069cd99..332bfd0ca2 100644
--- a/core/fxge/android/fpf_skiafont.cpp
+++ b/core/fxge/android/fpf_skiafont.cpp
@@ -17,54 +17,55 @@
#define FPF_EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em)
CFPF_SkiaFont::CFPF_SkiaFont()
- : m_pFontMgr(NULL),
- m_pFontDes(NULL),
- m_Face(NULL),
+ : m_pFontMgr(nullptr),
+ m_pFontDes(nullptr),
+ m_Face(nullptr),
m_dwStyle(0),
m_uCharset(0),
m_dwRefCount(0) {}
+
CFPF_SkiaFont::~CFPF_SkiaFont() {
- if (m_Face) {
+ if (m_Face)
FXFT_Done_Face(m_Face);
- }
}
+
void CFPF_SkiaFont::Release() {
- if (--m_dwRefCount == 0) {
+ if (--m_dwRefCount == 0)
delete this;
- }
}
-IFPF_Font* CFPF_SkiaFont::Retain() {
+
+CFPF_SkiaFont* CFPF_SkiaFont::Retain() {
m_dwRefCount++;
- return (IFPF_Font*)this;
+ return this;
}
+
FPF_HFONT CFPF_SkiaFont::GetHandle() {
- return NULL;
+ return nullptr;
}
+
CFX_ByteString CFPF_SkiaFont::GetFamilyName() {
- if (!m_Face) {
+ if (!m_Face)
return CFX_ByteString();
- }
return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
}
+
CFX_WideString CFPF_SkiaFont::GetPsName() {
- if (!m_Face) {
+ if (!m_Face)
return CFX_WideString();
- }
return CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face));
}
+
int32_t CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) {
- if (!m_Face) {
+ if (!m_Face)
return wUnicode;
- }
- if (FXFT_Select_Charmap(m_Face, FXFT_ENCODING_UNICODE)) {
+ if (FXFT_Select_Charmap(m_Face, FXFT_ENCODING_UNICODE))
return 0;
- }
return FXFT_Get_Char_Index(m_Face, wUnicode);
}
+
int32_t CFPF_SkiaFont::GetGlyphWidth(int32_t iGlyphIndex) {
- if (!m_Face) {
+ if (!m_Face)
return 0;
- }
if (FXFT_Load_Glyph(
m_Face, iGlyphIndex,
FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
@@ -73,28 +74,27 @@ int32_t CFPF_SkiaFont::GetGlyphWidth(int32_t iGlyphIndex) {
return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Glyph_HoriAdvance(m_Face));
}
+
int32_t CFPF_SkiaFont::GetAscent() const {
- if (!m_Face) {
+ if (!m_Face)
return 0;
- }
return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Face_Ascender(m_Face));
}
+
int32_t CFPF_SkiaFont::GetDescent() const {
- if (!m_Face) {
+ if (!m_Face)
return 0;
- }
return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Face_Descender(m_Face));
}
+
FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) {
- if (!m_Face) {
+ if (!m_Face)
return FALSE;
- }
if (FXFT_Is_Face_Tricky(m_Face)) {
- if (FXFT_Set_Char_Size(m_Face, 0, 1000 * 64, 72, 72)) {
+ if (FXFT_Set_Char_Size(m_Face, 0, 1000 * 64, 72, 72))
return FALSE;
- }
if (FXFT_Load_Glyph(m_Face, iGlyphIndex,
FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
@@ -135,6 +135,7 @@ FX_BOOL CFPF_SkiaFont::GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) {
FXFT_Get_Glyph_HoriBearingY(m_Face) - FXFT_Get_Glyph_Height(m_Face));
return TRUE;
}
+
FX_BOOL CFPF_SkiaFont::GetBBox(FX_RECT& rtBBox) {
if (!m_Face) {
return FALSE;
@@ -149,64 +150,68 @@ FX_BOOL CFPF_SkiaFont::GetBBox(FX_RECT& rtBBox) {
FXFT_Get_Face_yMax(m_Face));
return TRUE;
}
+
int32_t CFPF_SkiaFont::GetHeight() const {
- if (!m_Face) {
+ if (!m_Face)
return 0;
- }
return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Face_Height(m_Face));
}
+
int32_t CFPF_SkiaFont::GetItalicAngle() const {
- if (!m_Face) {
+ if (!m_Face)
return 0;
- }
+
TT_Postscript* ttInfo =
(TT_Postscript*)FT_Get_Sfnt_Table(m_Face, ft_sfnt_post);
- if (ttInfo) {
+ if (ttInfo)
return ttInfo->italicAngle;
- }
return 0;
}
+
uint32_t CFPF_SkiaFont::GetFontData(uint32_t dwTable,
uint8_t* pBuffer,
uint32_t dwSize) {
- if (!m_Face) {
+ if (!m_Face)
return 0;
- }
+
FT_ULong ulSize = pdfium::base::checked_cast<FT_ULong>(dwSize);
- if (FXFT_Load_Sfnt_Table(m_Face, dwTable, 0, pBuffer, &ulSize)) {
+ if (FXFT_Load_Sfnt_Table(m_Face, dwTable, 0, pBuffer, &ulSize))
return 0;
- }
return pdfium::base::checked_cast<uint32_t>(ulSize);
}
+
FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
CFPF_SkiaFontDescriptor* pFontDes,
const CFX_ByteStringC& bsFamily,
uint32_t dwStyle,
uint8_t uCharset) {
- if (!pFontMgr || !pFontDes) {
+ if (!pFontMgr || !pFontDes)
return FALSE;
- }
+
switch (pFontDes->GetType()) {
case FPF_SKIAFONTTYPE_Path: {
CFPF_SkiaPathFont* pFont = (CFPF_SkiaPathFont*)pFontDes;
m_Face = pFontMgr->GetFontFace(pFont->m_pPath, pFont->m_iFaceIndex);
- } break;
+ break;
+ }
case FPF_SKIAFONTTYPE_File: {
CFPF_SkiaFileFont* pFont = (CFPF_SkiaFileFont*)pFontDes;
m_Face = pFontMgr->GetFontFace(pFont->m_pFile, pFont->m_iFaceIndex);
- } break;
+ break;
+ }
case FPF_SKIAFONTTYPE_Buffer: {
CFPF_SkiaBufferFont* pFont = (CFPF_SkiaBufferFont*)pFontDes;
m_Face = pFontMgr->GetFontFace((const uint8_t*)pFont->m_pBuffer,
pFont->m_szBuffer, pFont->m_iFaceIndex);
- } break;
+ break;
+ }
default:
return FALSE;
}
- if (!m_Face) {
+ if (!m_Face)
return FALSE;
- }
+
m_dwStyle = dwStyle;
m_uCharset = uCharset;
m_pFontMgr = pFontMgr;
@@ -214,4 +219,5 @@ FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr,
m_dwRefCount = 1;
return TRUE;
}
-#endif
+
+#endif // _FX_OS_ == _FX_ANDROID_
diff --git a/core/fxge/android/fpf_skiafont.h b/core/fxge/android/fpf_skiafont.h
index c21bdeadc4..59172a5385 100644
--- a/core/fxge/android/fpf_skiafont.h
+++ b/core/fxge/android/fpf_skiafont.h
@@ -11,35 +11,35 @@
#if _FX_OS_ == _FX_ANDROID_
-#include "core/fxge/include/fpf.h"
#include "core/fxge/include/fx_font.h"
class CFPF_SkiaFontDescriptor;
class CFPF_SkiaFontMgr;
-class CFPF_SkiaFont : public IFPF_Font {
+
+typedef struct FPF_HFONT_ { void* pData; } * FPF_HFONT;
+
+class CFPF_SkiaFont {
public:
CFPF_SkiaFont();
- ~CFPF_SkiaFont() override;
-
- // IFPF_Font
- void Release() override;
- IFPF_Font* Retain() override;
- FPF_HFONT GetHandle() override;
- CFX_ByteString GetFamilyName() override;
- CFX_WideString GetPsName() override;
- uint32_t GetFontStyle() const override { return m_dwStyle; }
- uint8_t GetCharset() const override { return m_uCharset; }
- int32_t GetGlyphIndex(FX_WCHAR wUnicode) override;
- int32_t GetGlyphWidth(int32_t iGlyphIndex) override;
- int32_t GetAscent() const override;
- int32_t GetDescent() const override;
- FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) override;
- FX_BOOL GetBBox(FX_RECT& rtBBox) override;
- int32_t GetHeight() const override;
- int32_t GetItalicAngle() const override;
- uint32_t GetFontData(uint32_t dwTable,
- uint8_t* pBuffer,
- uint32_t dwSize) override;
+ ~CFPF_SkiaFont();
+
+ void Release();
+ CFPF_SkiaFont* Retain();
+
+ FPF_HFONT GetHandle();
+ CFX_ByteString GetFamilyName();
+ CFX_WideString GetPsName();
+ uint32_t GetFontStyle() const { return m_dwStyle; }
+ uint8_t GetCharset() const { return m_uCharset; }
+ int32_t GetGlyphIndex(FX_WCHAR wUnicode);
+ int32_t GetGlyphWidth(int32_t iGlyphIndex);
+ int32_t GetAscent() const;
+ int32_t GetDescent() const;
+ FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox);
+ FX_BOOL GetBBox(FX_RECT& rtBBox);
+ int32_t GetHeight() const;
+ int32_t GetItalicAngle() const;
+ uint32_t GetFontData(uint32_t dwTable, uint8_t* pBuffer, uint32_t dwSize);
FX_BOOL InitFont(CFPF_SkiaFontMgr* pFontMgr,
CFPF_SkiaFontDescriptor* pFontDes,
@@ -55,6 +55,7 @@ class CFPF_SkiaFont : public IFPF_Font {
uint8_t m_uCharset;
uint32_t m_dwRefCount;
};
-#endif
+
+#endif // _FX_OS_ == _FX_ANDROID_
#endif // CORE_FXGE_ANDROID_FPF_SKIAFONT_H_
diff --git a/core/fxge/android/fpf_skiafontmgr.cpp b/core/fxge/android/fpf_skiafontmgr.cpp
index b7bc27acdf..3158f4ca52 100644
--- a/core/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/fxge/android/fpf_skiafontmgr.cpp
@@ -250,10 +250,10 @@ void CFPF_SkiaFontMgr::LoadSystemFonts() {
void CFPF_SkiaFontMgr::LoadPrivateFont(IFX_FileRead* pFontFile) {}
void CFPF_SkiaFontMgr::LoadPrivateFont(const CFX_ByteStringC& bsFileName) {}
void CFPF_SkiaFontMgr::LoadPrivateFont(void* pBuffer, size_t szBuffer) {}
-IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
- uint8_t uCharset,
- uint32_t dwStyle,
- uint32_t dwMatch) {
+CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
+ uint8_t uCharset,
+ uint32_t dwStyle,
+ uint32_t dwMatch) {
uint32_t dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset);
auto it = m_FamilyFonts.find(dwHash);
if (it != m_FamilyFonts.end() && it->second)
diff --git a/core/fxge/android/fpf_skiafontmgr.h b/core/fxge/android/fpf_skiafontmgr.h
index e939a55cb9..be3ea460da 100644
--- a/core/fxge/android/fpf_skiafontmgr.h
+++ b/core/fxge/android/fpf_skiafontmgr.h
@@ -14,7 +14,6 @@
#include <map>
#include <vector>
-#include "core/fxge/include/fpf.h"
#include "core/fxge/include/fx_font.h"
#define FPF_SKIAFONTTYPE_Unknown 0
@@ -22,6 +21,8 @@
#define FPF_SKIAFONTTYPE_File 2
#define FPF_SKIAFONTTYPE_Buffer 3
+#define FPF_MATCHFONT_REPLACEANSI 1
+
class CFPF_SkiaFont;
class CFPF_SkiaFontDescriptor {
@@ -88,20 +89,19 @@ class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor {
size_t m_szBuffer;
};
-class CFPF_SkiaFontMgr : public IFPF_FontMgr {
+class CFPF_SkiaFontMgr {
public:
CFPF_SkiaFontMgr();
- ~CFPF_SkiaFontMgr() override;
-
- // IFPF_FontMgr
- void LoadSystemFonts() override;
- void LoadPrivateFont(IFX_FileRead* pFontFile) override;
- void LoadPrivateFont(const CFX_ByteStringC& bsFileName) override;
- void LoadPrivateFont(void* pBuffer, size_t szBuffer) override;
- IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname,
- uint8_t uCharset,
- uint32_t dwStyle,
- uint32_t dwMatch = 0) override;
+ ~CFPF_SkiaFontMgr();
+
+ void LoadSystemFonts();
+ void LoadPrivateFont(IFX_FileRead* pFontFile);
+ void LoadPrivateFont(const CFX_ByteStringC& bsFileName);
+ void LoadPrivateFont(void* pBuffer, size_t szBuffer);
+ CFPF_SkiaFont* CreateFont(const CFX_ByteStringC& bsFamilyname,
+ uint8_t uCharset,
+ uint32_t dwStyle,
+ uint32_t dwMatch = 0);
FX_BOOL InitFTLibrary();
FXFT_Face GetFontFace(IFX_FileRead* pFileRead, int32_t iFaceIndex = 0);
@@ -122,6 +122,6 @@ class CFPF_SkiaFontMgr : public IFPF_FontMgr {
std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts;
};
-#endif
+#endif // _FX_OS_ == _FX_ANDROID_
#endif // CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
diff --git a/core/fxge/android/fpf_skiamodule.cpp b/core/fxge/android/fpf_skiamodule.cpp
index 0454524829..f219f12499 100644
--- a/core/fxge/android/fpf_skiamodule.cpp
+++ b/core/fxge/android/fpf_skiamodule.cpp
@@ -11,28 +11,36 @@
#include "core/fxge/android/fpf_skiafontmgr.h"
#include "core/fxge/android/fpf_skiamodule.h"
-static IFPF_DeviceModule* gs_pPFModule = NULL;
-IFPF_DeviceModule* FPF_GetDeviceModule() {
- if (!gs_pPFModule) {
+namespace {
+
+CFPF_SkiaDeviceModule* gs_pPFModule = nullptr;
+
+} // namespace
+
+CFPF_SkiaDeviceModule* CFPF_GetSkiaDeviceModule() {
+ if (!gs_pPFModule)
gs_pPFModule = new CFPF_SkiaDeviceModule;
- }
return gs_pPFModule;
}
+
CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule() {
delete m_pFontMgr;
}
+
void CFPF_SkiaDeviceModule::Destroy() {
- delete (CFPF_SkiaDeviceModule*)gs_pPFModule;
- gs_pPFModule = NULL;
+ delete gs_pPFModule;
+ gs_pPFModule = nullptr;
}
-IFPF_FontMgr* CFPF_SkiaDeviceModule::GetFontMgr() {
+
+CFPF_SkiaFontMgr* CFPF_SkiaDeviceModule::GetFontMgr() {
if (!m_pFontMgr) {
m_pFontMgr = new CFPF_SkiaFontMgr;
if (!m_pFontMgr->InitFTLibrary()) {
delete m_pFontMgr;
- return NULL;
+ return nullptr;
}
}
- return (IFPF_FontMgr*)m_pFontMgr;
+ return m_pFontMgr;
}
-#endif
+
+#endif // _FX_OS_ == _FX_ANDROID_
diff --git a/core/fxge/android/fpf_skiamodule.h b/core/fxge/android/fpf_skiamodule.h
index 95748493c7..8ad7549cf1 100644
--- a/core/fxge/android/fpf_skiamodule.h
+++ b/core/fxge/android/fpf_skiamodule.h
@@ -7,24 +7,28 @@
#ifndef CORE_FXGE_ANDROID_FPF_SKIAMODULE_H_
#define CORE_FXGE_ANDROID_FPF_SKIAMODULE_H_
+#include "core/fxcrt/include/fx_system.h'"
+
#if _FX_OS_ == _FX_ANDROID_
-#include "core/fxge/include/fpf.h"
+#include "core/fxge/android/fpf_skiafontmgr.h"
class CFPF_SkiaFontMgr;
-class CFPF_SkiaDeviceModule : public IFPF_DeviceModule {
+class CFPF_SkiaDeviceModule {
public:
CFPF_SkiaDeviceModule() : m_pFontMgr(nullptr) {}
- ~CFPF_SkiaDeviceModule() override;
+ ~CFPF_SkiaDeviceModule();
- // IFPF_DeviceModule
- void Destroy() override;
- IFPF_FontMgr* GetFontMgr() override;
+ void Destroy();
+ CFPF_SkiaFontMgr* GetFontMgr();
protected:
CFPF_SkiaFontMgr* m_pFontMgr;
};
-#endif
+
+CFPF_SkiaDeviceModule* CFPF_GetSkiaDeviceModule();
+
+#endif // _FX_OS_ == _FX_ANDROID_
#endif // CORE_FXGE_ANDROID_FPF_SKIAMODULE_H_
diff --git a/core/fxge/android/fx_android_font.cpp b/core/fxge/android/fx_android_font.cpp
index 6554c66a13..b1606bbd69 100644
--- a/core/fxge/android/fx_android_font.cpp
+++ b/core/fxge/android/fx_android_font.cpp
@@ -8,82 +8,86 @@
#if _FX_OS_ == _FX_ANDROID_
+#include "core/fxge/android/fpf_skiafont.h"
+#include "core/fxge/android/fpf_skiafontmgr.h"
#include "core/fxge/android/fx_android_font.h"
-#include "core/fxge/include/fpf.h"
CFX_AndroidFontInfo::CFX_AndroidFontInfo() : m_pFontMgr(NULL) {}
-FX_BOOL CFX_AndroidFontInfo::Init(IFPF_FontMgr* pFontMgr) {
- if (!pFontMgr) {
+FX_BOOL CFX_AndroidFontInfo::Init(CFPF_SkiaFontMgr* pFontMgr) {
+ if (!pFontMgr)
return FALSE;
- }
+
pFontMgr->LoadSystemFonts();
m_pFontMgr = pFontMgr;
return TRUE;
}
+
FX_BOOL CFX_AndroidFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
return FALSE;
}
+
void* CFX_AndroidFontInfo::MapFont(int weight,
FX_BOOL bItalic,
int charset,
int pitch_family,
const FX_CHAR* face,
int& iExact) {
- if (!m_pFontMgr) {
- return NULL;
- }
+ if (!m_pFontMgr)
+ return nullptr;
+
uint32_t dwStyle = 0;
- if (weight >= 700) {
+ if (weight >= 700)
dwStyle |= FXFONT_BOLD;
- }
- if (bItalic) {
+ if (bItalic)
dwStyle |= FXFONT_ITALIC;
- }
- if (pitch_family & FXFONT_FF_FIXEDPITCH) {
+ if (pitch_family & FXFONT_FF_FIXEDPITCH)
dwStyle |= FXFONT_FIXED_PITCH;
- }
- if (pitch_family & FXFONT_FF_SCRIPT) {
+ if (pitch_family & FXFONT_FF_SCRIPT)
dwStyle |= FXFONT_SCRIPT;
- }
- if (pitch_family & FXFONT_FF_ROMAN) {
+ if (pitch_family & FXFONT_FF_ROMAN)
dwStyle |= FXFONT_SERIF;
- }
return m_pFontMgr->CreateFont(face, charset, dwStyle,
FPF_MATCHFONT_REPLACEANSI);
}
+
void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) {
- return NULL;
+ return nullptr;
}
+
uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont,
uint32_t table,
uint8_t* buffer,
uint32_t size) {
- if (!hFont) {
+ if (!hFont)
return 0;
- }
- return ((IFPF_Font*)hFont)->GetFontData(table, buffer, size);
+ return static_cast<CFPF_SkiaFont*>(hFont)->GetFontData(table, buffer, size);
}
+
FX_BOOL CFX_AndroidFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
- if (!hFont) {
+ if (!hFont)
return FALSE;
- }
- name = ((IFPF_Font*)hFont)->GetFamilyName();
+
+ name = static_cast<CFPF_SkiaFont*>(hFont)->GetFamilyName();
return TRUE;
}
+
FX_BOOL CFX_AndroidFontInfo::GetFontCharset(void* hFont, int& charset) {
- if (!hFont) {
+ if (!hFont)
return FALSE;
- }
- charset = ((IFPF_Font*)hFont)->GetCharset();
+
+ charset = static_cast<CFPF_SkiaFont*>(hFont)->GetCharset();
return FALSE;
}
+
void CFX_AndroidFontInfo::DeleteFont(void* hFont) {
- if (!hFont) {
+ if (!hFont)
return;
- }
- ((IFPF_Font*)hFont)->Release();
+
+ static_cast<CFPF_SkiaFont*>(hFont)->Release();
}
+
void* CFX_AndroidFontInfo::RetainFont(void* hFont) {
- return NULL;
+ return nullptr;
}
-#endif
+
+#endif // _FX_OS_ == _FX_ANDROID_
diff --git a/core/fxge/android/fx_android_font.h b/core/fxge/android/fx_android_font.h
index 6268c3ed7b..07d5f5852b 100644
--- a/core/fxge/android/fx_android_font.h
+++ b/core/fxge/android/fx_android_font.h
@@ -13,7 +13,7 @@
#include "core/fxge/include/fx_font.h"
-class IFPF_FontMgr;
+class CFPF_SkiaFontMgr;
class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
public:
@@ -39,11 +39,12 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo {
virtual void DeleteFont(void* hFont);
virtual void* RetainFont(void* hFont);
- FX_BOOL Init(IFPF_FontMgr* pFontMgr);
+ FX_BOOL Init(CFPF_SkiaFontMgr* pFontMgr);
protected:
- IFPF_FontMgr* m_pFontMgr;
+ CFPF_SkiaFontMgr* m_pFontMgr;
};
-#endif
+
+#endif // _FX_OS_ == _FX_ANDROID_
#endif // CORE_FXGE_ANDROID_FX_ANDROID_FONT_H_
diff --git a/core/fxge/android/fx_android_imp.cpp b/core/fxge/android/fx_android_imp.cpp
index e508183fd8..bbaa2ba27a 100644
--- a/core/fxge/android/fx_android_imp.cpp
+++ b/core/fxge/android/fx_android_imp.cpp
@@ -8,16 +8,16 @@
#if _FX_OS_ == _FX_ANDROID_
+#include "core/fxge/android/fpf_skiamodule.h"
#include "core/fxge/android/fx_android_font.h"
-#include "core/fxge/include/fpf.h"
#include "core/fxge/include/fx_ge.h"
void CFX_GEModule::InitPlatform() {
- IFPF_DeviceModule* pDeviceModule = FPF_GetDeviceModule();
- if (!pDeviceModule) {
+ CFPF_SkiaDeviceModule* pDeviceModule = CFPF_GetSkiaDeviceModule();
+ if (!pDeviceModule)
return;
- }
- IFPF_FontMgr* pFontMgr = pDeviceModule->GetFontMgr();
+
+ CFPF_SkiaFontMgr* pFontMgr = pDeviceModule->GetFontMgr();
if (pFontMgr) {
CFX_AndroidFontInfo* pFontInfo = new CFX_AndroidFontInfo;
pFontInfo->Init(pFontMgr);
@@ -25,10 +25,10 @@ void CFX_GEModule::InitPlatform() {
}
m_pPlatformData = pDeviceModule;
}
+
void CFX_GEModule::DestroyPlatform() {
- if (m_pPlatformData) {
- ((IFPF_DeviceModule*)m_pPlatformData)->Destroy();
- }
+ if (m_pPlatformData)
+ static_cast<IFPF_DeviceModule*>(m_pPlatformData)->Destroy();
}
-#endif
+#endif // _FX_OS_ == _FX_ANDROID_
diff --git a/core/fxge/include/fpf.h b/core/fxge/include/fpf.h
deleted file mode 100644
index 2d43e8da6f..0000000000
--- a/core/fxge/include/fpf.h
+++ /dev/null
@@ -1,70 +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_INCLUDE_FPF_H_
-#define CORE_FXGE_INCLUDE_FPF_H_
-
-#include "core/fxcrt/include/fx_coordinates.h"
-
-class IFPF_FontMgr;
-
-class IFPF_DeviceModule {
- public:
- virtual ~IFPF_DeviceModule() {}
- virtual void Destroy() = 0;
- virtual IFPF_FontMgr* GetFontMgr() = 0;
-};
-
-IFPF_DeviceModule* FPF_GetDeviceModule();
-
-#define FPF_MATCHFONT_REPLACEANSI 1
-
-typedef struct FPF_HFONT_ { void* pData; } * FPF_HFONT;
-
-class IFPF_Font {
- public:
- virtual void Release() = 0;
- virtual IFPF_Font* Retain() = 0;
- virtual FPF_HFONT GetHandle() = 0;
- virtual CFX_ByteString GetFamilyName() = 0;
- virtual CFX_WideString GetPsName() = 0;
- virtual uint32_t GetFontStyle() const = 0;
- virtual uint8_t GetCharset() const = 0;
-
- virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode) = 0;
- virtual int32_t GetGlyphWidth(int32_t iGlyphIndex) = 0;
-
- virtual int32_t GetAscent() const = 0;
- virtual int32_t GetDescent() const = 0;
-
- virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) = 0;
- virtual FX_BOOL GetBBox(FX_RECT& rtBBox) = 0;
-
- virtual int32_t GetHeight() const = 0;
- virtual int32_t GetItalicAngle() const = 0;
- virtual uint32_t GetFontData(uint32_t dwTable,
- uint8_t* pBuffer,
- uint32_t dwSize) = 0;
-
- protected:
- virtual ~IFPF_Font() {}
-};
-
-class IFPF_FontMgr {
- public:
- virtual ~IFPF_FontMgr() {}
- virtual void LoadSystemFonts() = 0;
- virtual void LoadPrivateFont(IFX_FileRead* pFontFile) = 0;
- virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName) = 0;
- virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer) = 0;
-
- virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname,
- uint8_t charset,
- uint32_t dwStyle,
- uint32_t dwMatch = 0) = 0;
-};
-
-#endif // CORE_FXGE_INCLUDE_FPF_H_