summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-11-28 11:27:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-28 11:27:14 -0800
commit80ddd61fa9bbb76cbebaa0c28fb166ae7a75a828 (patch)
tree7120dec126e81f78aa233f8e7e5af40a15118cff
parente44b7e3e10c3b5afb73ecdcc77e60d4046c27a71 (diff)
downloadpdfium-80ddd61fa9bbb76cbebaa0c28fb166ae7a75a828.tar.xz
Nits in fx_ge_linux
Moved all CFX_LinuxFontInfo to the namespace. Added its constructor and destructor. And fixed includes and {}s. Review-Url: https://codereview.chromium.org/2529013002
-rw-r--r--core/fxge/ge/fx_ge_linux.cpp66
1 files changed, 30 insertions, 36 deletions
diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp
index 0319dd8ef5..e7086bb4e0 100644
--- a/core/fxge/ge/fx_ge_linux.cpp
+++ b/core/fxge/ge/fx_ge_linux.cpp
@@ -4,31 +4,15 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef _SKIA_SUPPORT_
-#include "core/fxge/agg/fx_agg_driver.h"
-#endif
-
#include <memory>
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/ge/cfx_folderfontinfo.h"
-#include "core/fxge/ge/fx_text_int.h"
#include "core/fxge/ifx_systemfontinfo.h"
#if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_
namespace {
-class CFX_LinuxFontInfo : public CFX_FolderFontInfo {
- public:
- void* MapFont(int weight,
- bool bItalic,
- int charset,
- int pitch_family,
- const FX_CHAR* family,
- int& iExact) override;
- bool ParseFontCfg(const char** pUserPaths);
-};
-
const size_t kLinuxGpNameSize = 6;
const FX_CHAR* const g_LinuxGpFontList[][kLinuxGpNameSize] = {
@@ -73,13 +57,25 @@ size_t GetJapanesePreference(const FX_CHAR* facearr,
}
return 3;
}
- if (!(pitch_family & FXFONT_FF_ROMAN) && weight > 400) {
+ if (!(pitch_family & FXFONT_FF_ROMAN) && weight > 400)
return 0;
- }
+
return 2;
}
-} // namespace
+class CFX_LinuxFontInfo : public CFX_FolderFontInfo {
+ public:
+ CFX_LinuxFontInfo() {}
+ ~CFX_LinuxFontInfo() override {}
+
+ void* MapFont(int weight,
+ bool bItalic,
+ int charset,
+ int pitch_family,
+ const FX_CHAR* family,
+ int& iExact) override;
+ bool ParseFontCfg(const char** pUserPaths);
+};
void* CFX_LinuxFontInfo::MapFont(int weight,
bool bItalic,
@@ -99,36 +95,32 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
ASSERT(index < FX_ArraySize(g_LinuxGpFontList));
for (size_t i = 0; i < kLinuxGpNameSize; i++) {
auto it = m_FontList.find(g_LinuxGpFontList[index][i]);
- if (it != m_FontList.end()) {
+ if (it != m_FontList.end())
return it->second;
- }
}
break;
}
case FXFONT_GB2312_CHARSET: {
for (size_t i = 0; i < FX_ArraySize(g_LinuxGbFontList); ++i) {
auto it = m_FontList.find(g_LinuxGbFontList[i]);
- if (it != m_FontList.end()) {
+ if (it != m_FontList.end())
return it->second;
- }
}
break;
}
case FXFONT_CHINESEBIG5_CHARSET: {
for (size_t i = 0; i < FX_ArraySize(g_LinuxB5FontList); ++i) {
auto it = m_FontList.find(g_LinuxB5FontList[i]);
- if (it != m_FontList.end()) {
+ if (it != m_FontList.end())
return it->second;
- }
}
break;
}
case FXFONT_HANGUL_CHARSET: {
for (size_t i = 0; i < FX_ArraySize(g_LinuxHGFontList); ++i) {
auto it = m_FontList.find(g_LinuxHGFontList[i]);
- if (it != m_FontList.end()) {
+ if (it != m_FontList.end())
return it->second;
- }
}
break;
}
@@ -139,6 +131,17 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
return FindFont(weight, bItalic, charset, pitch_family, cstr_face, !bCJK);
}
+bool CFX_LinuxFontInfo::ParseFontCfg(const char** pUserPaths) {
+ if (!pUserPaths)
+ return false;
+
+ for (const char** pPath = pUserPaths; *pPath; ++pPath)
+ AddPath(*pPath);
+ return true;
+}
+
+} // namespace
+
std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
const char** pUserPaths) {
CFX_LinuxFontInfo* pInfo = new CFX_LinuxFontInfo;
@@ -151,15 +154,6 @@ std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
return std::unique_ptr<IFX_SystemFontInfo>(pInfo);
}
-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_pUserFontPaths));