From 01fa1efb228acdcf5250804c670107133668e4b2 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 31 Jul 2015 14:00:39 -0700 Subject: Kill IFX_FontMapper The design envisioned two kinds of font mappers: internal (of type CFX_FontMapper), and external, both of which implement a common interface. But there isn't any means of making an external one, so the interface is redundant. IFX_FontMapper also appears in an apple-specific struct, but was never non-null or used in any way. The CFX_FontMapper class provides its own mechanism to include platform-specific features, as it turns out. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1259123005 . --- core/src/fxge/ge/fx_ge_fontmap.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'core/src/fxge/ge/fx_ge_fontmap.cpp') diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 9bbebd9917..495d95c8d7 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -61,12 +61,9 @@ FX_BOOL CTTFontDesc::ReleaseFace(FXFT_Face face) delete this; return TRUE; } -CFX_FontMgr::CFX_FontMgr() +CFX_FontMgr::CFX_FontMgr() : m_FTLibrary(nullptr) { - m_pBuiltinMapper = new CFX_FontMapper; - m_pBuiltinMapper->m_pFontMgr = this; - m_pExtMapper = NULL; - m_FTLibrary = NULL; + m_pBuiltinMapper = new CFX_FontMapper(this); FXSYS_memset(m_ExternalFonts, 0, sizeof m_ExternalFonts); } CFX_FontMgr::~CFX_FontMgr() @@ -101,18 +98,10 @@ void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, int weight, int italic_angle, int CharsetCP, CFX_SubstFont* pSubstFont) { - if (m_FTLibrary == NULL) { + if (!m_FTLibrary) { FXFT_Init_FreeType(&m_FTLibrary); } - if (m_pExtMapper) { - FXFT_Face face = m_pExtMapper->FindSubstFont(face_name, bTrueType, flags, weight, italic_angle, - CharsetCP, pSubstFont); - if (face) { - return face; - } - } - return m_pBuiltinMapper->FindSubstFont(face_name, bTrueType, flags, weight, italic_angle, - CharsetCP, pSubstFont); + return m_pBuiltinMapper->FindSubstFont(face_name, bTrueType, flags, weight, italic_angle, CharsetCP, pSubstFont); } FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, int weight, FX_BOOL bItalic, uint8_t*& pFontData) @@ -454,13 +443,14 @@ FX_BOOL CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, } return TRUE; } -CFX_FontMapper::CFX_FontMapper() +CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr) + : m_pFontInfo(nullptr), + m_bListLoaded(FALSE), + m_pFontEnumerator(nullptr), + m_pFontMgr(mgr) { FXSYS_memset(m_FoxitFaces, 0, sizeof m_FoxitFaces); m_MMFaces[0] = m_MMFaces[1] = NULL; - m_pFontInfo = NULL; - m_bListLoaded = FALSE; - m_pFontEnumerator = NULL; } CFX_FontMapper::~CFX_FontMapper() { -- cgit v1.2.3