Removed GetRec() from CFPF_SkiaFontMgr
Edited the ReportFace() and ScanFile() in cfpf_skiafontmgr.cpp to avoid
the use of GetRec() function. by instead passing the argument face_index
to the function. This helps in removing the GetRec() call for the future
privatization of the method.
Bug: 460068801
Change-Id: I4cf26439e66c97e51691781847683e403dbd6ee6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/138230
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index a326fe2..7ef44f6 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -398,21 +398,22 @@
}
void CFPF_SkiaFontMgr::ScanFile(const ByteString& file) {
- RetainPtr<CFX_Face> face = GetFontFace(file.AsStringView(), 0);
+ constexpr int kFaceIndex = 0;
+ RetainPtr<CFX_Face> face = GetFontFace(file.AsStringView(), kFaceIndex);
if (!face) {
return;
}
-
- font_faces_.push_back(ReportFace(face, file));
+ font_faces_.push_back(ReportFace(face, file, kFaceIndex));
}
std::unique_ptr<CFPF_SkiaPathFont> CFPF_SkiaFontMgr::ReportFace(
RetainPtr<CFX_Face> face,
- const ByteString& file) {
+ const ByteString& file,
+ int face_index) {
CFX_Face::FontStyleInfo fontinfo = face->GetFontStyleInfo();
uint32_t charset =
SKIACHARSET_Default | SkiaGetFaceCharset(fontinfo.os2_codepage_mask);
- return std::make_unique<CFPF_SkiaPathFont>(
- file, face->GetFamilyName(), fontinfo.style, face->GetRec()->face_index,
- charset, face->GetGlyphCount());
+ return std::make_unique<CFPF_SkiaPathFont>(file, face->GetFamilyName(),
+ fontinfo.style, face_index,
+ charset, face->GetGlyphCount());
}
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
index 3958b52..5d45d75 100644
--- a/core/fxge/android/cfpf_skiafontmgr.h
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -37,7 +37,8 @@
void ScanPath(const ByteString& path);
void ScanFile(const ByteString& file);
std::unique_ptr<CFPF_SkiaPathFont> ReportFace(RetainPtr<CFX_Face> face,
- const ByteString& file);
+ const ByteString& file,
+ int face_index);
bool loaded_fonts_ = false;
ScopedFXFTLibraryRec ft_library_;