summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp10
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.h2
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_font.h4
-rw-r--r--core/fpdfapi/font/fpdf_font.cpp6
5 files changed, 13 insertions, 13 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 5aad5194cd..c309ac1d26 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -365,10 +365,10 @@ bool CPDF_CIDFont::Load() {
if (!m_pCMap)
return false;
} else if (CPDF_Stream* pStream = pEncoding->AsStream()) {
- CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, false);
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData(false);
m_pCMap = pdfium::MakeRetain<CPDF_CMap>();
- m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
+ m_pCMap->LoadEmbedded(pAcc->GetData(), pAcc->GetSize());
} else {
return false;
}
@@ -403,8 +403,8 @@ bool CPDF_CIDFont::Load() {
CPDF_Object* pmap = pCIDFontDict->GetDirectObjectFor("CIDToGIDMap");
if (pmap) {
if (CPDF_Stream* pStream = pmap->AsStream()) {
- m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
- m_pStreamAcc->LoadAllData(pStream, false);
+ m_pStreamAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ m_pStreamAcc->LoadAllData(false);
} else if (pmap->GetString() == "Identity") {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_pFontFile)
diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h
index 938b537b1b..cc9bec1612 100644
--- a/core/fpdfapi/font/cpdf_cidfont.h
+++ b/core/fpdfapi/font/cpdf_cidfont.h
@@ -78,7 +78,7 @@ class CPDF_CIDFont : public CPDF_Font {
bool m_bType1;
bool m_bCIDIsGID;
uint16_t m_DefaultWidth;
- std::unique_ptr<CPDF_StreamAcc> m_pStreamAcc;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
bool m_bAnsiWidthsFixed;
FX_RECT m_CharBBox[256];
std::vector<uint32_t> m_WidthList;
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index f0b5ac16b7..60eb1b361d 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -61,7 +61,7 @@ CPDF_Font::CPDF_Font()
CPDF_Font::~CPDF_Font() {
if (m_pFontFile) {
- m_pDocument->GetPageData()->ReleaseFontFileStreamAcc(
+ m_pDocument->GetPageData()->MaybePurgeFontFileStreamAcc(
m_pFontFile->GetStream()->AsStream());
}
}
@@ -219,7 +219,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
const uint8_t* pFontData = m_pFontFile->GetData();
uint32_t dwFontSize = m_pFontFile->GetSize();
if (!m_Font.LoadEmbedded(pFontData, dwFontSize)) {
- m_pDocument->GetPageData()->ReleaseFontFileStreamAcc(
+ m_pDocument->GetPageData()->MaybePurgeFontFileStreamAcc(
m_pFontFile->GetStream()->AsStream());
m_pFontFile = nullptr;
}
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 6dac3f2778..8ef68e6031 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_font.h"
@@ -19,7 +20,6 @@ class CPDF_CIDFont;
class CPDF_Dictionary;
class CPDF_Document;
class CPDF_Object;
-class CPDF_StreamAcc;
class CPDF_TrueTypeFont;
class CPDF_Type1Font;
class CPDF_Type3Font;
@@ -101,7 +101,7 @@ class CPDF_Font {
int charcode);
CFX_ByteString m_BaseFont;
- CPDF_StreamAcc* m_pFontFile;
+ CFX_RetainPtr<CPDF_StreamAcc> m_pFontFile;
CPDF_Dictionary* m_pFontDict;
mutable std::unique_ptr<CPDF_ToUnicodeMap> m_pToUnicodeMap;
mutable bool m_bToUnicodeLoaded;
diff --git a/core/fpdfapi/font/fpdf_font.cpp b/core/fpdfapi/font/fpdf_font.cpp
index 23b46759d8..a5616ea963 100644
--- a/core/fpdfapi/font/fpdf_font.cpp
+++ b/core/fpdfapi/font/fpdf_font.cpp
@@ -208,9 +208,9 @@ uint32_t CPDF_ToUnicodeMap::GetUnicode() {
void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
CIDSet cid_set = CIDSET_UNKNOWN;
- CPDF_StreamAcc stream;
- stream.LoadAllData(pStream, false);
- CPDF_SimpleParser parser(stream.GetData(), stream.GetSize());
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
+ pAcc->LoadAllData(false);
+ CPDF_SimpleParser parser(pAcc->GetData(), pAcc->GetSize());
while (1) {
CFX_ByteStringC word = parser.GetWord();
if (word.IsEmpty()) {