summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-08-06 11:57:04 -0700
committerTom Sepez <tsepez@chromium.org>2015-08-06 11:57:04 -0700
commit792d55cfe3cf046125fd69d8914ae459216a68ab (patch)
tree1883b08e786516529c9a1a8b0cdee7d4eba90aa8 /core/src
parentb14283e6b7f2521070106b070eb74219dfd97e1b (diff)
downloadpdfium-792d55cfe3cf046125fd69d8914ae459216a68ab.tar.xz
Merge to XFA: Add CFX_FontFaceInfo constructor.
(cherry picked from commit 905cc10ecd06bcacfefb747cc3370c72772f0e15) Original Review URL: https://codereview.chromium.org/1277883004 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1279873002 .
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp27
-rw-r--r--core/src/fxge/ge/fx_ge_linux.cpp4
-rw-r--r--core/src/fxge/ge/text_int.h26
3 files changed, 32 insertions, 25 deletions
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 2e591cd986..eefeb5d618 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -467,12 +467,13 @@ FX_BOOL CFX_FontMgr::GetStandardFont(const uint8_t*& pFontData,
return TRUE;
}
CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr)
- : m_pFontInfo(nullptr),
- m_bListLoaded(FALSE),
+ : m_bListLoaded(FALSE),
+ m_pFontInfo(nullptr),
m_pFontEnumerator(nullptr),
m_pFontMgr(mgr) {
- FXSYS_memset(m_FoxitFaces, 0, sizeof m_FoxitFaces);
- m_MMFaces[0] = m_MMFaces[1] = NULL;
+ m_MMFaces[0] = nullptr;
+ m_MMFaces[1] = nullptr;
+ FXSYS_memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces));
}
CFX_FontMapper::~CFX_FontMapper() {
for (int i = 0; i < 14; i++)
@@ -1379,7 +1380,7 @@ CFX_FolderFontInfo::~CFX_FolderFontInfo() {
CFX_ByteString key;
void* value;
m_FontList.GetNextAssoc(pos, key, value);
- delete (CFontFaceInfo*)value;
+ delete (CFX_FontFaceInfo*)value;
}
}
void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) {
@@ -1493,16 +1494,8 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path,
if (m_FontList.Lookup(facename, p)) {
return;
}
- CFontFaceInfo* pInfo = new CFontFaceInfo;
- if (!pInfo) {
- return;
- }
- pInfo->m_FilePath = path;
- pInfo->m_FaceName = facename;
- pInfo->m_FontTables = tables;
- pInfo->m_FontOffset = offset;
- pInfo->m_FileSize = filesize;
- pInfo->m_Charsets = 0;
+ CFX_FontFaceInfo* pInfo =
+ new CFX_FontFaceInfo(path, facename, tables, offset, filesize);
CFX_ByteString os2 =
_FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32);
if (os2.GetLength() >= 86) {
@@ -1572,7 +1565,7 @@ FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont,
if (hFont == NULL) {
return 0;
}
- CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
+ CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
FXSYS_FILE* pFile = NULL;
if (size > 0) {
pFile = FXSYS_fopen(pFont->m_FilePath, "rb");
@@ -1612,7 +1605,7 @@ FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
if (hFont == NULL) {
return FALSE;
}
- CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
+ CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
name = pFont->m_FaceName;
return TRUE;
}
diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp
index cb8a0add76..bad3854afe 100644
--- a/core/src/fxge/ge/fx_ge_linux.cpp
+++ b/core/src/fxge/ge/fx_ge_linux.cpp
@@ -198,13 +198,13 @@ void* CFX_LinuxFontInfo::FindFont(int weight,
int pitch_family,
const FX_CHAR* family,
FX_BOOL bMatchName) {
- CFontFaceInfo* pFind = NULL;
+ CFX_FontFaceInfo* pFind = NULL;
FX_DWORD charset_flag = _LinuxGetCharset(charset);
int32_t iBestSimilar = 0;
FX_POSITION pos = m_FontList.GetStartPosition();
while (pos) {
CFX_ByteString bsName;
- CFontFaceInfo* pFont = NULL;
+ CFX_FontFaceInfo* pFont = NULL;
m_FontList.GetNextAssoc(pos, bsName, (void*&)pFont);
if (!(pFont->m_Charsets & charset_flag) &&
charset != FXFONT_DEFAULT_CHARSET) {
diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h
index 7cc31fe936..3ebd9aef3f 100644
--- a/core/src/fxge/ge/text_int.h
+++ b/core/src/fxge/ge/text_int.h
@@ -64,20 +64,34 @@ class CFX_UnicodeEncoding : public IFX_FontEncoding {
#define CHARSET_FLAG_BIG5 8
#define CHARSET_FLAG_GB 16
#define CHARSET_FLAG_KOREAN 32
-class CFontFaceInfo {
+
+class CFX_FontFaceInfo {
public:
- CFX_ByteString m_FilePath;
- CFX_ByteString m_FaceName;
+ CFX_FontFaceInfo(CFX_ByteString filePath, CFX_ByteString faceName,
+ CFX_ByteString fontTables, FX_DWORD fontOffset,
+ FX_DWORD fileSize)
+ : m_FilePath(filePath),
+ m_FaceName(faceName),
+ m_FontTables(fontTables),
+ m_FontOffset(fontOffset),
+ m_FileSize(fileSize),
+ m_Styles(0),
+ m_Charsets(0) {}
+
+ const CFX_ByteString m_FilePath;
+ const CFX_ByteString m_FaceName;
+ const CFX_ByteString m_FontTables;
+ const FX_DWORD m_FontOffset;
+ const FX_DWORD m_FileSize;
FX_DWORD m_Styles;
FX_DWORD m_Charsets;
- FX_DWORD m_FontOffset;
- FX_DWORD m_FileSize;
- CFX_ByteString m_FontTables;
};
+
class CFontFileFaceInfo {
public:
CFontFileFaceInfo();
~CFontFileFaceInfo();
+
IFX_FileStream* m_pFile;
FXFT_Face m_Face;
CFX_ByteString m_FaceName;