Replace CFX_Font::SetSubData() with AllocSubData().
First step toward a DataVector someday.
-- Remove a stray 'G' from member name.
Change-Id: I78df09b830f543dfcfb3a77e93e0580e7e8af66b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/99391
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index b129a86..c15ca88 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -664,7 +664,7 @@
unsigned long length = 0;
int error = FT_Load_Sfnt_Table(face, kGsubTag, 0, nullptr, &length);
if (!error)
- m_Font.SetSubData(FX_Alloc(uint8_t, length));
+ m_Font.AllocSubData(length);
}
int error =
FT_Load_Sfnt_Table(face, kGsubTag, 0, m_Font.GetSubData(), nullptr);
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 9caec4c..3c87b46 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -630,6 +630,10 @@
return result;
}
+void CFX_Font::AllocSubData(size_t size) {
+ m_pSubData.reset(FX_Alloc(uint8_t, size));
+}
+
RetainPtr<CFX_GlyphCache> CFX_Font::GetOrCreateGlyphCache() const {
if (!m_GlyphCache)
m_GlyphCache = CFX_GEModule::Get()->GetFontCache()->GetGlyphCache(this);
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 9ec8748..34a2a4c 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -128,8 +128,8 @@
absl::optional<FX_RECT> GetBBox() const;
bool IsEmbedded() const { return m_bEmbedded; }
- uint8_t* GetSubData() const { return m_pGsubData.get(); }
- void SetSubData(uint8_t* data) { m_pGsubData.reset(data); }
+ void AllocSubData(size_t size);
+ uint8_t* GetSubData() const { return m_pSubData.get(); }
FontType GetFontType() const { return m_FontType; }
void SetFontType(FontType type) { m_FontType = type; }
uint64_t GetObjectTag() const { return m_ObjectTag; }
@@ -165,7 +165,7 @@
mutable RetainPtr<CFX_Face> m_Face;
mutable RetainPtr<CFX_GlyphCache> m_GlyphCache;
std::unique_ptr<CFX_SubstFont> m_pSubstFont;
- std::unique_ptr<uint8_t, FxFreeDeleter> m_pGsubData;
+ std::unique_ptr<uint8_t, FxFreeDeleter> m_pSubData;
DataVector<uint8_t> m_FontDataAllocation;
pdfium::span<uint8_t> m_FontData;
FontType m_FontType = FontType::kUnknown;