From 60830ae5a056601dec5eb3c9a9589e29cfc9e041 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 27 Sep 2017 13:33:57 -0400 Subject: Hide FaceFontInfo inside CFX_FolderFontInfo This CL moves CFX_FaceFontInfo to be a protected inner class of CFX_FolderFontInfo. Change-Id: I3674c36d5295307be253e04337c22d6d0608fefe Reviewed-on: https://pdfium-review.googlesource.com/14952 Commit-Queue: dsinclair Reviewed-by: Ryan Harrison --- core/fxge/cfx_folderfontinfo.cpp | 25 +++++++++++++++++++------ core/fxge/cfx_folderfontinfo.h | 19 ++++++++++++++++++- core/fxge/fx_font.h | 17 ----------------- core/fxge/fx_ge_fontmap.cpp | 13 ------------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp index f2a19a4c4f..3087552fb8 100644 --- a/core/fxge/cfx_folderfontinfo.cpp +++ b/core/fxge/cfx_folderfontinfo.cpp @@ -220,8 +220,8 @@ void CFX_FolderFontInfo::ReportFace(const ByteString& path, if (pdfium::ContainsKey(m_FontList, facename)) return; - auto pInfo = pdfium::MakeUnique(path, facename, tables, - offset, filesize); + auto pInfo = pdfium::MakeUnique(path, facename, tables, offset, + filesize); ByteString os2 = FPDF_LoadTableFromTT(pFile, tables.raw_str(), nTables, 0x4f532f32); if (os2.GetLength() >= 86) { @@ -276,7 +276,7 @@ void* CFX_FolderFontInfo::FindFont(int weight, int pitch_family, const char* family, bool bMatchName) { - CFX_FontFaceInfo* pFind = nullptr; + FontFaceInfo* pFind = nullptr; if (charset == FX_CHARSET_ANSI && (pitch_family & FXFONT_FF_FIXEDPITCH)) return GetFont("Courier New"); @@ -284,7 +284,7 @@ void* CFX_FolderFontInfo::FindFont(int weight, int32_t iBestSimilar = 0; for (const auto& it : m_FontList) { const ByteString& bsName = it.first; - CFX_FontFaceInfo* pFont = it.second.get(); + FontFaceInfo* pFont = it.second.get(); if (!(pFont->m_Charsets & charset_flag) && charset != FX_CHARSET_Default) continue; @@ -331,7 +331,7 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont, if (!hFont) return 0; - const CFX_FontFaceInfo* pFont = static_cast(hFont); + const FontFaceInfo* pFont = static_cast(hFont); uint32_t datasize = 0; uint32_t offset = 0; if (table == 0) { @@ -369,10 +369,23 @@ void CFX_FolderFontInfo::DeleteFont(void* hFont) {} bool CFX_FolderFontInfo::GetFaceName(void* hFont, ByteString* name) { if (!hFont) return false; - *name = static_cast(hFont)->m_FaceName; + *name = static_cast(hFont)->m_FaceName; return true; } bool CFX_FolderFontInfo::GetFontCharset(void* hFont, int* charset) { return false; } + +CFX_FolderFontInfo::FontFaceInfo::FontFaceInfo(ByteString filePath, + ByteString faceName, + ByteString fontTables, + uint32_t fontOffset, + uint32_t fileSize) + : m_FilePath(filePath), + m_FaceName(faceName), + m_FontTables(fontTables), + m_FontOffset(fontOffset), + m_FileSize(fileSize), + m_Styles(0), + m_Charsets(0) {} diff --git a/core/fxge/cfx_folderfontinfo.h b/core/fxge/cfx_folderfontinfo.h index 1123185d69..23c20d52d2 100644 --- a/core/fxge/cfx_folderfontinfo.h +++ b/core/fxge/cfx_folderfontinfo.h @@ -47,6 +47,23 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { bool GetFontCharset(void* hFont, int* charset) override; protected: + class FontFaceInfo { + public: + FontFaceInfo(ByteString filePath, + ByteString faceName, + ByteString fontTables, + uint32_t fontOffset, + uint32_t fileSize); + + const ByteString m_FilePath; + const ByteString m_FaceName; + const ByteString m_FontTables; + const uint32_t m_FontOffset; + const uint32_t m_FileSize; + uint32_t m_Styles; + uint32_t m_Charsets; + }; + void ScanPath(const ByteString& path); void ScanFile(const ByteString& path); void ReportFace(const ByteString& path, @@ -61,7 +78,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { const char* family, bool bMatchName); - std::map> m_FontList; + std::map> m_FontList; std::vector m_PathList; UnownedPtr m_pMapper; }; diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h index 634429e2f6..d55160aef5 100644 --- a/core/fxge/fx_font.h +++ b/core/fxge/fx_font.h @@ -78,23 +78,6 @@ class ScopedFontTransform { FT_Face m_Face; }; -class CFX_FontFaceInfo { - public: - CFX_FontFaceInfo(ByteString filePath, - ByteString faceName, - ByteString fontTables, - uint32_t fontOffset, - uint32_t fileSize); - - const ByteString m_FilePath; - const ByteString m_FaceName; - const ByteString m_FontTables; - const uint32_t m_FontOffset; - const uint32_t m_FileSize; - uint32_t m_Styles; - uint32_t m_Charsets; -}; - class CFX_GlyphBitmap { public: CFX_GlyphBitmap(); diff --git a/core/fxge/fx_ge_fontmap.cpp b/core/fxge/fx_ge_fontmap.cpp index b11ee9c6f3..6e3d8abea3 100644 --- a/core/fxge/fx_ge_fontmap.cpp +++ b/core/fxge/fx_ge_fontmap.cpp @@ -78,16 +78,3 @@ std::unique_ptr IFX_SystemFontInfo::CreateDefault( return nullptr; } #endif - -CFX_FontFaceInfo::CFX_FontFaceInfo(ByteString filePath, - ByteString faceName, - ByteString fontTables, - uint32_t fontOffset, - uint32_t fileSize) - : m_FilePath(filePath), - m_FaceName(faceName), - m_FontTables(fontTables), - m_FontOffset(fontOffset), - m_FileSize(fileSize), - m_Styles(0), - m_Charsets(0) {} -- cgit v1.2.3