From 24508dff1636d80be01497e30fccd21533fc0bde Mon Sep 17 00:00:00 2001 From: thestig Date: Fri, 27 May 2016 15:14:20 -0700 Subject: Clean up some Android/Windows code. Review-Url: https://codereview.chromium.org/2004313007 --- core/fxge/ge/fx_ge_linux.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'core/fxge/ge/fx_ge_linux.cpp') diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp index 0d5aff75fa..46d7146026 100644 --- a/core/fxge/ge/fx_ge_linux.cpp +++ b/core/fxge/ge/fx_ge_linux.cpp @@ -123,7 +123,9 @@ void* CFX_LinuxFontInfo::MapFont(int weight, } return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK); } -IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUserPaths) { + +std::unique_ptr IFX_SystemFontInfo::CreateDefault( + const char** pUserPaths) { CFX_LinuxFontInfo* pInfo = new CFX_LinuxFontInfo; if (!pInfo->ParseFontCfg(pUserPaths)) { pInfo->AddPath("/usr/share/fonts"); @@ -131,17 +133,18 @@ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUserPaths) { pInfo->AddPath("/usr/share/X11/fonts/TTF"); pInfo->AddPath("/usr/local/share/fonts"); } - return pInfo; + return std::unique_ptr(pInfo); } + FX_BOOL CFX_LinuxFontInfo::ParseFontCfg(const char** pUserPaths) { - if (!pUserPaths) { + if (!pUserPaths) return FALSE; - } - for (const char** pPath = pUserPaths; *pPath; ++pPath) { + + for (const char** pPath = pUserPaths; *pPath; ++pPath) AddPath(*pPath); - } return TRUE; } + void CFX_GEModule::InitPlatform() { m_pFontMgr->SetSystemFontInfo( IFX_SystemFontInfo::CreateDefault(m_pUserFontPaths)); -- cgit v1.2.3