Make CFX_FolderFontInfo file-reading helpers static methods. Doing so will allow CFX_AndroidFontInfo to re-use this code in a subsequent CL. No functional change. Change-Id: I3ed34ed91581bf46165e3dca215a88b7bc316191 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/149711 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp index 8c4af5f..3660000 100644 --- a/core/fxge/cfx_folderfontinfo.cpp +++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -57,8 +57,12 @@ } }; -bool FindFamilyNameMatch(ByteStringView family_name, - const ByteString& installed_font_name) { +} // namespace + +// static +bool CFX_FolderFontInfo::FindFamilyNameMatch( + ByteStringView family_name, + const ByteString& installed_font_name) { std::optional<size_t> result = installed_font_name.Find(family_name, 0); if (!result.has_value()) { return false; @@ -77,7 +81,8 @@ return true; } -ByteString ReadStringFromFile(FILE* pFile, uint32_t size) { +// static +ByteString CFX_FolderFontInfo::ReadStringFromFile(FILE* pFile, uint32_t size) { ByteString result; { // Span's lifetime must end before ReleaseBuffer() below. @@ -91,11 +96,12 @@ return result; } -ByteString LoadTableFromTT(FILE* pFile, - const uint8_t* pTables, - uint32_t nTables, - uint32_t tag, - FX_FILESIZE fileSize) { +// static +ByteString CFX_FolderFontInfo::LoadTableFromTT(FILE* pFile, + const uint8_t* pTables, + uint32_t nTables, + uint32_t tag, + FX_FILESIZE fileSize) { UNSAFE_TODO({ for (uint32_t i = 0; i < nTables; i++) { // TODO(tsepez): use actual span. @@ -115,8 +121,6 @@ return ByteString(); } -} // namespace - CFX_FolderFontInfo::CFX_FolderFontInfo() = default; CFX_FolderFontInfo::~CFX_FolderFontInfo() = default;
diff --git a/core/fxge/cfx_folderfontinfo.h b/core/fxge/cfx_folderfontinfo.h index 98831fa..e2d6371 100644 --- a/core/fxge/cfx_folderfontinfo.h +++ b/core/fxge/cfx_folderfontinfo.h
@@ -19,6 +19,15 @@ class CFX_FolderFontInfo : public SystemFontInfoIface { public: + static bool FindFamilyNameMatch(ByteStringView family_name, + const ByteString& installed_font_name); + static ByteString ReadStringFromFile(FILE* pFile, uint32_t size); + static ByteString LoadTableFromTT(FILE* pFile, + const uint8_t* pTables, + uint32_t nTables, + uint32_t tag, + FX_FILESIZE fileSize); + CFX_FolderFontInfo(); ~CFX_FolderFontInfo() override;