1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "core/fxge/cfx_gemodule.h" 8 9 #include <memory> 10 #include <utility> 11 12 #include "core/fxge/android/cfpf_skiadevicemodule.h" 13 #include "core/fxge/android/cfx_androidfontinfo.h" 14 #include "core/fxge/cfx_fontmgr.h" 15 #include "third_party/base/ptr_util.h" 16 InitPlatform()17void CFX_GEModule::InitPlatform() { 18 CFPF_SkiaDeviceModule* pDeviceModule = CFPF_GetSkiaDeviceModule(); 19 if (!pDeviceModule) 20 return; 21 22 CFPF_SkiaFontMgr* pFontMgr = pDeviceModule->GetFontMgr(); 23 if (pFontMgr) { 24 auto pFontInfo = pdfium::MakeUnique<CFX_AndroidFontInfo>(); 25 pFontInfo->Init(pFontMgr); 26 m_pFontMgr->SetSystemFontInfo(std::move(pFontInfo)); 27 } 28 m_pPlatformData = pDeviceModule; 29 } 30 DestroyPlatform()31void CFX_GEModule::DestroyPlatform() { 32 if (m_pPlatformData) 33 static_cast<CFPF_SkiaDeviceModule*>(m_pPlatformData)->Destroy(); 34 } 35