Index: core/fpdfapi/fpdf_parser/cpdf_document.cpp |
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp |
index b2a3cd4ef246fa6890d8d013d41f42aeffc3c350..c8f40a6fa239eb017b41c7df5f838a4b64d7bb41 100644 |
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp |
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp |
@@ -384,14 +384,15 @@ void ProcessNonbCJK(CPDF_Dictionary* pBaseDict, |
pBaseDict->SetFor("Widths", pWidths); |
} |
-CPDF_Dictionary* CalculateFontDesc(CFX_ByteString basefont, |
+CPDF_Dictionary* CalculateFontDesc(CPDF_Document* pDoc, |
+ CFX_ByteString basefont, |
int flags, |
int italicangle, |
int ascend, |
int descend, |
CPDF_Array* bbox, |
int32_t stemV) { |
- CPDF_Dictionary* pFontDesc = new CPDF_Dictionary; |
+ CPDF_Dictionary* pFontDesc = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pFontDesc->SetNameFor("Type", "FontDescriptor"); |
pFontDesc->SetNameFor("FontName", basefont); |
pFontDesc->SetIntegerFor("Flags", flags); |
@@ -680,21 +681,21 @@ CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) { |
void CPDF_Document::CreateNewDoc() { |
ASSERT(!m_pRootDict && !m_pInfoDict); |
- m_pRootDict = new CPDF_Dictionary; |
+ m_pRootDict = new CPDF_Dictionary(&m_ByteStringPool); |
m_pRootDict->SetNameFor("Type", "Catalog"); |
int objnum = AddIndirectObject(m_pRootDict); |
- CPDF_Dictionary* pPages = new CPDF_Dictionary; |
+ CPDF_Dictionary* pPages = new CPDF_Dictionary(&m_ByteStringPool); |
pPages->SetNameFor("Type", "Pages"); |
pPages->SetNumberFor("Count", 0); |
pPages->SetFor("Kids", new CPDF_Array); |
objnum = AddIndirectObject(pPages); |
m_pRootDict->SetReferenceFor("Pages", this, objnum); |
- m_pInfoDict = new CPDF_Dictionary; |
+ m_pInfoDict = new CPDF_Dictionary(&m_ByteStringPool); |
AddIndirectObject(m_pInfoDict); |
} |
CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { |
- CPDF_Dictionary* pDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pDict = new CPDF_Dictionary(&m_ByteStringPool); |
pDict->SetNameFor("Type", "Page"); |
uint32_t dwObjNum = AddIndirectObject(pDict); |
if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { |
@@ -737,7 +738,7 @@ size_t CPDF_Document::CalculateEncodingDict(int charset, |
} |
if (i == FX_ArraySize(g_FX_CharsetUnicodes)) |
return i; |
- CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary(&m_ByteStringPool); |
pEncodingDict->SetNameFor("BaseEncoding", "WinAnsiEncoding"); |
CPDF_Array* pArray = new CPDF_Array; |
pArray->AddInteger(128); |
@@ -758,7 +759,7 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK( |
FX_BOOL bVert, |
CFX_ByteString basefont, |
std::function<void(FX_WCHAR, FX_WCHAR, CPDF_Array*)> Insert) { |
- CPDF_Dictionary* pFontDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pFontDict = new CPDF_Dictionary(&m_ByteStringPool); |
CFX_ByteString cmap; |
CFX_ByteString ordering; |
int supplement = 0; |
@@ -808,7 +809,7 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK( |
pFontDict->SetNameFor("Type", "Font"); |
pFontDict->SetNameFor("Subtype", "CIDFontType2"); |
pFontDict->SetNameFor("BaseFont", basefont); |
- CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary; |
+ CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary(&m_ByteStringPool); |
pCIDSysInfo->SetStringFor("Registry", "Adobe"); |
pCIDSysInfo->SetStringFor("Ordering", ordering); |
pCIDSysInfo->SetIntegerFor("Supplement", supplement); |
@@ -834,7 +835,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { |
CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(), |
false, false, charset == FXFONT_SYMBOL_CHARSET); |
- CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pBaseDict = new CPDF_Dictionary(&m_ByteStringPool); |
pBaseDict->SetNameFor("Type", "Font"); |
std::unique_ptr<CFX_UnicodeEncoding> pEncoding( |
new CFX_UnicodeEncoding(pFont)); |
@@ -901,7 +902,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { |
} |
} |
CPDF_Dictionary* pFontDesc = |
- CalculateFontDesc(basefont, flags, italicangle, pFont->GetAscent(), |
+ CalculateFontDesc(this, basefont, flags, italicangle, pFont->GetAscent(), |
pFont->GetDescent(), pBBox, nStemV); |
AddIndirectObject(pFontDesc); |
pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc); |
@@ -966,7 +967,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, |
ptm->otmrcFontBox.right, ptm->otmrcFontBox.top}; |
FX_Free(tm_buf); |
basefont.Replace(" ", ""); |
- CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pBaseDict = new CPDF_Dictionary(&m_ByteStringPool); |
pBaseDict->SetNameFor("Type", "Font"); |
CPDF_Dictionary* pFontDict = pBaseDict; |
if (!bCJK) { |
@@ -996,8 +997,8 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, |
for (int i = 0; i < 4; i++) |
pBBox->AddInteger(bbox[i]); |
CPDF_Dictionary* pFontDesc = |
- CalculateFontDesc(basefont, flags, italicangle, ascend, descend, pBBox, |
- pLogFont->lfWeight / 5); |
+ CalculateFontDesc(this, basefont, flags, italicangle, ascend, descend, |
+ pBBox, pLogFont->lfWeight / 5); |
pFontDesc->SetIntegerFor("CapHeight", capheight); |
AddIndirectObject(pFontDesc); |
pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc); |