diff options
author | tsepez <tsepez@chromium.org> | 2016-09-28 16:47:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-28 16:47:07 -0700 |
commit | 698c5716d005860360527e4cfe15b4a185589117 (patch) | |
tree | 7e82388a12f3de2b6fb179181d77b47d2c547df7 /core/fpdfapi/fpdf_font | |
parent | 4ba37c6f6964f6a24fc4b8b48bc82c02edb70370 (diff) | |
download | pdfium-698c5716d005860360527e4cfe15b4a185589117.tar.xz |
Use string pools in some dictionaries, names, and strings.
BUG=pdfium:597
Review-Url: https://codereview.chromium.org/2345063002
Diffstat (limited to 'core/fpdfapi/fpdf_font')
-rw-r--r-- | core/fpdfapi/fpdf_font/cpdf_font.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index e2eb2e567e..5d89752714 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -308,7 +308,7 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, if (pFont) return pFont; - CPDF_Dictionary* pDict = new CPDF_Dictionary; + CPDF_Dictionary* pDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); pDict->SetNameFor("Type", "Font"); pDict->SetNameFor("Subtype", "Type1"); pDict->SetNameFor("BaseFont", fontname); diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp index 29587927bc..d0e5f16aea 100644 --- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp @@ -1670,7 +1670,7 @@ FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { 0; } -CPDF_Object* CPDF_FontEncoding::Realize() { +CPDF_Object* CPDF_FontEncoding::Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool) { int predefined = 0; for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; cs++) { @@ -1689,13 +1689,13 @@ CPDF_Object* CPDF_FontEncoding::Realize() { } if (predefined) { if (predefined == PDFFONT_ENCODING_WINANSI) { - return new CPDF_Name("WinAnsiEncoding"); + return new CPDF_Name(pPool->Intern("WinAnsiEncoding")); } if (predefined == PDFFONT_ENCODING_MACROMAN) { - return new CPDF_Name("MacRomanEncoding"); + return new CPDF_Name(pPool->Intern("MacRomanEncoding")); } if (predefined == PDFFONT_ENCODING_MACEXPERT) { - return new CPDF_Name("MacExpertEncoding"); + return new CPDF_Name(pPool->Intern("MacExpertEncoding")); } return nullptr; } @@ -1710,7 +1710,7 @@ CPDF_Object* CPDF_FontEncoding::Realize() { pDiff->Add(new CPDF_Name(PDF_AdobeNameFromUnicode(m_Unicodes[i]))); } - CPDF_Dictionary* pDict = new CPDF_Dictionary; + CPDF_Dictionary* pDict = new CPDF_Dictionary(pPool); pDict->SetNameFor("BaseEncoding", "WinAnsiEncoding"); pDict->SetFor("Differences", pDiff); return pDict; diff --git a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h b/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h index 6d6ff43814..8ded0ac708 100644 --- a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h +++ b/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h @@ -7,6 +7,8 @@ #ifndef CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONTENCODING_H_ #define CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONTENCODING_H_ +#include "core/fxcrt/include/cfx_string_pool_template.h" +#include "core/fxcrt/include/cfx_weak_ptr.h" #include "core/fxcrt/include/fx_string.h" #define PDFFONT_ENCODING_BUILTIN 0 @@ -50,7 +52,7 @@ class CPDF_FontEncoding { m_Unicodes[charcode] = unicode; } - CPDF_Object* Realize(); + CPDF_Object* Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool); public: FX_WCHAR m_Unicodes[256]; |