summaryrefslogtreecommitdiff
path: root/xfa/fgas/font
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fgas/font')
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp41
-rw-r--r--xfa/fgas/font/fgas_gefont.h10
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp4
3 files changed, 15 insertions, 40 deletions
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 33d17489fa..1507fa4840 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -34,21 +34,10 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const FX_WCHAR* pszFontFamily,
}
// static
-CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExternalFont,
+CFGAS_GEFont* CFGAS_GEFont::LoadFont(CFX_Font* pExtFont,
IFGAS_FontMgr* pFontMgr) {
CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
- if (!pFont->LoadFontInternal(pExternalFont)) {
- pFont->Release();
- return nullptr;
- }
- return pFont;
-}
-
-// static
-CFGAS_GEFont* CFGAS_GEFont::LoadFont(std::unique_ptr<CFX_Font> pInternalFont,
- IFGAS_FontMgr* pFontMgr) {
- CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
- if (!pFont->LoadFontInternal(std::move(pInternalFont))) {
+ if (!pFont->LoadFontInternal(pExtFont)) {
pFont->Release();
return nullptr;
}
@@ -90,7 +79,7 @@ CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr)
m_pFont(nullptr),
m_pFontMgr(pFontMgr),
m_iRefCount(1),
- m_bExternalFont(false),
+ m_bExtFont(FALSE),
m_pProvider(nullptr) {
}
@@ -103,7 +92,7 @@ CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles)
m_pFont(nullptr),
m_pFontMgr(src.m_pFontMgr),
m_iRefCount(1),
- m_bExternalFont(false),
+ m_bExtFont(FALSE),
m_pProvider(nullptr) {
ASSERT(src.m_pFont);
m_pFont = new CFX_Font;
@@ -128,7 +117,7 @@ CFGAS_GEFont::~CFGAS_GEFont() {
m_SubstFonts.RemoveAll();
m_FontMapper.clear();
- if (!m_bExternalFont)
+ if (!m_bExtFont)
delete m_pFont;
}
@@ -220,22 +209,12 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream,
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) {
- if (m_pFont || !pExternalFont)
- return FALSE;
-
- m_pFont = pExternalFont;
- m_bExternalFont = true;
- return InitFont();
-}
-
-FX_BOOL CFGAS_GEFont::LoadFontInternal(
- std::unique_ptr<CFX_Font> pInternalFont) {
- if (m_pFont || !pInternalFont)
+FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExtFont) {
+ if (m_pFont || !pExtFont) {
return FALSE;
-
- m_pFont = pInternalFont.release();
- m_bExternalFont = false;
+ }
+ m_pFont = pExtFont;
+ m_bExtFont = TRUE;
return InitFont();
}
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index 05c7640afb..cdb19338a2 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -24,10 +24,7 @@ class CFGAS_GEFont {
uint32_t dwFontStyles,
uint16_t wCodePage,
IFGAS_FontMgr* pFontMgr);
- static CFGAS_GEFont* LoadFont(CFX_Font* pExternalFont,
- IFGAS_FontMgr* pFontMgr);
- static CFGAS_GEFont* LoadFont(std::unique_ptr<CFX_Font> pInternalFont,
- IFGAS_FontMgr* pFontMgr);
+ static CFGAS_GEFont* LoadFont(CFX_Font* pExtFont, IFGAS_FontMgr* pFontMgr);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer,
int32_t iLength,
@@ -77,8 +74,7 @@ class CFGAS_GEFont {
FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length);
FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream);
#endif
- FX_BOOL LoadFontInternal(CFX_Font* pExternalFont);
- FX_BOOL LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont);
+ FX_BOOL LoadFontInternal(CFX_Font* pExtFont);
FX_BOOL InitFont();
FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode,
CFX_Rect& bbox,
@@ -100,7 +96,7 @@ class CFGAS_GEFont {
CFX_Font* m_pFont;
IFGAS_FontMgr* const m_pFontMgr;
int32_t m_iRefCount;
- bool m_bExternalFont;
+ FX_BOOL m_bExtFont;
std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream;
std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> m_pFileRead;
std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index f79ad46e5e..7e5cfbb796 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -850,13 +850,13 @@ CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName,
return nullptr;
}
- std::unique_ptr<CFX_Font> pInternalFont(new CFX_Font());
+ CFX_Font* pInternalFont = new CFX_Font();
if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) {
pFontStream->Release();
return nullptr;
}
- CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(std::move(pInternalFont), this);
+ CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this);
if (!pFont) {
pFontStream->Release();
return nullptr;