summaryrefslogtreecommitdiff
path: root/core/src/fxge/ge/fx_ge_linux.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-09-23 15:31:44 -0700
committerLei Zhang <thestig@chromium.org>2015-09-23 15:31:44 -0700
commit6f62d53b7650311afc490bfdaa48f5e8536b8b4e (patch)
tree9b1e1cc17f3d75d6f9bd2413281d5b29450f1fcd /core/src/fxge/ge/fx_ge_linux.cpp
parent5377ebf967ea860eec4b3cfa3877ed30b84509dc (diff)
downloadpdfium-6f62d53b7650311afc490bfdaa48f5e8536b8b4e.tar.xz
Merge to XFA: Allow external font-path configuration from pdfium_test.
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1268323004 . (cherry picked from commit 9311163b564785a3a3ccdcb09bd3b7d0b2976d1a) Review URL: https://codereview.chromium.org/1368513002 .
Diffstat (limited to 'core/src/fxge/ge/fx_ge_linux.cpp')
-rw-r--r--core/src/fxge/ge/fx_ge_linux.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp
index 4e713dc412..065fd124bb 100644
--- a/core/src/fxge/ge/fx_ge_linux.cpp
+++ b/core/src/fxge/ge/fx_ge_linux.cpp
@@ -34,7 +34,7 @@ class CFX_LinuxFontInfo : public CFX_FolderFontInfo {
int pitch_family,
const FX_CHAR* family,
int& iExact) override;
- FX_BOOL ParseFontCfg();
+ FX_BOOL ParseFontCfg(const char** pUserPaths);
void* FindFont(int weight,
FX_BOOL bItalic,
int charset,
@@ -226,12 +226,9 @@ void* CFX_LinuxFontInfo::FindFont(int weight,
}
return pFind;
}
-IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() {
+IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUserPaths) {
CFX_LinuxFontInfo* pInfo = new CFX_LinuxFontInfo;
- if (!pInfo) {
- return NULL;
- }
- if (!pInfo->ParseFontCfg()) {
+ if (!pInfo->ParseFontCfg(pUserPaths)) {
pInfo->AddPath("/usr/share/fonts");
pInfo->AddPath("/usr/share/X11/fonts/Type1");
pInfo->AddPath("/usr/share/X11/fonts/TTF");
@@ -239,11 +236,18 @@ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() {
}
return pInfo;
}
-FX_BOOL CFX_LinuxFontInfo::ParseFontCfg() {
- return FALSE;
+FX_BOOL CFX_LinuxFontInfo::ParseFontCfg(const char** pUserPaths) {
+ if (!pUserPaths) {
+ return FALSE;
+ }
+ for (const char** pPath = pUserPaths; *pPath; ++pPath) {
+ AddPath(*pPath);
+ }
+ return TRUE;
}
void CFX_GEModule::InitPlatform() {
- m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault());
+ m_pFontMgr->SetSystemFontInfo(
+ IFX_SystemFontInfo::CreateDefault(m_pUserFontPaths));
}
void CFX_GEModule::DestroyPlatform() {}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_