From d8b5e73d8609b74e6a995ee1768d20d47bd4b089 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 13 Aug 2015 11:22:54 -0700 Subject: Allow external font-path configuration from pdfium_test. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1268323004 . --- fpdfsdk/src/fpdf_sysfontinfo.cpp | 2 +- fpdfsdk/src/fpdfview.cpp | 7 ++++++- fpdfsdk/src/fpdfview_c_api_test.c | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp index a0fdb5083d..804efe3020 100644 --- a/fpdfsdk/src/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/src/fpdf_sysfontinfo.cpp @@ -168,7 +168,7 @@ static void DefaultDeleteFont(struct _FPDF_SYSFONTINFO* pThis, void* hFont) { } DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo() { - IFX_SystemFontInfo* pFontInfo = IFX_SystemFontInfo::CreateDefault(); + IFX_SystemFontInfo* pFontInfo = IFX_SystemFontInfo::CreateDefault(nullptr); if (pFontInfo == NULL) return NULL; diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 9ad3384803..2700aebddc 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -91,9 +91,14 @@ CFontMapper* g_pFontMapper = NULL; #endif // #if _FX_OS_ == _FX_LINUX_EMBEDDED_ DLLEXPORT void STDCALL FPDF_InitLibrary() { + FPDF_InitLibraryWithConfig(nullptr); +} + +DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( + const FPDF_LIBRARY_CONFIG* cfg) { g_pCodecModule = new CCodec_ModuleMgr(); - CFX_GEModule::Create(); + CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr); CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); CPDF_ModuleMgr::Create(); diff --git a/fpdfsdk/src/fpdfview_c_api_test.c b/fpdfsdk/src/fpdfview_c_api_test.c index 3fd682d394..a17f7b6c1e 100644 --- a/fpdfsdk/src/fpdfview_c_api_test.c +++ b/fpdfsdk/src/fpdfview_c_api_test.c @@ -172,6 +172,7 @@ int CheckPDFiumCApi() { // fpdfview.h CHK(FPDF_InitLibrary); + CHK(FPDF_InitLibraryWithConfig); CHK(FPDF_DestroyLibrary); CHK(FPDF_SetSandBoxPolicy); CHK(FPDF_LoadDocument); -- cgit v1.2.3