Replace CFX_Font::GetFaceRec() with HasFaceRec()
ALl the callers just want a bool. They do not actually use the returned
handle.
Change-Id: I7f851a7433c6a0b0b5306761315ebe49fd064411
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/135370
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 928747f..bd2fa82 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -63,7 +63,7 @@
}
void CPDF_SimpleFont::LoadCharMetrics(int charcode) {
- if (!font_.GetFaceRec()) {
+ if (!font_.HasFaceRec()) {
return;
}
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 43e4b16..465503a 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -73,7 +73,7 @@
bool force_vertical,
uint64_t object_tag);
RetainPtr<CFX_Face> GetFace() const { return face_; }
- FXFT_FaceRec* GetFaceRec() const { return face_ ? face_->GetRec() : nullptr; }
+ bool HasFaceRec() const { return face_ && face_->GetRec(); }
CFX_SubstFont* GetSubstFont() const { return subst_font_.get(); }
int GetSubstFontItalicAngle() const;
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 282eba6..d39c95d 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -1122,7 +1122,7 @@
// rendering options provided by |text_options|. No change needs to be
// done for |text_options| here.
anti_alias = FT_RENDER_MODE_LCD;
- normalize = !font->GetFaceRec() ||
+ normalize = !font->HasFaceRec() ||
options.aliasing_type != CFX_TextRenderOptions::kLcd;
}
}
@@ -1163,7 +1163,7 @@
CFX_Matrix text2Device = mtText2Device;
char2device.Scale(font_size, -font_size);
if (fabs(char2device.a) + fabs(char2device.b) > 50 * 1.0f || is_printer) {
- if (font->GetFaceRec()) {
+ if (font->HasFaceRec()) {
CFX_FillRenderOptions path_options;
path_options.aliased_path = !is_text_smooth;
return DrawTextPath(pCharPos, font, font_size, mtText2Device, nullptr,
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 90f4025..7b1cac7 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -929,7 +929,7 @@
skPaint.setColor(color);
SkFont font;
- if (pFont->GetFaceRec()) { // exclude placeholder test fonts
+ if (pFont->HasFaceRec()) { // exclude placeholder test fonts
font.setTypeface(sk_ref_sp(pFont->GetDeviceCache()));
}
font.setEmbolden(pFont->IsSubstFontBold());