summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edittext.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2018-06-11 18:19:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-11 18:19:57 +0000
commitfb72726e51bfd0c7bfc61c9b354e2b60f46adac5 (patch)
treeb2a763c74a07b081a4b176c18c42569e377d6fc8 /fpdfsdk/fpdf_edittext.cpp
parent5e873f5ce8e407c97e966b9708d2560e908112d3 (diff)
downloadpdfium-fb72726e51bfd0c7bfc61c9b354e2b60f46adac5.tar.xz
Implement CPDF_Object::MakeReference method.chromium/3456
Change-Id: I153747ef587a184eaef58ff09dbf8f214c9ddfb3 Reviewed-on: https://pdfium-review.googlesource.com/17230 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'fpdfsdk/fpdf_edittext.cpp')
-rw-r--r--fpdfsdk/fpdf_edittext.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index 2996a505ee..2ead789204 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -74,7 +74,7 @@ CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
static_cast<int>(size));
}
ByteString fontFile = font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2";
- pFontDesc->SetNewFor<CPDF_Reference>(fontFile, pDoc, pStream->GetObjNum());
+ pFontDesc->SetFor(fontFile, pStream->MakeReference(pDoc));
return pFontDesc;
}
@@ -270,12 +270,11 @@ CPDF_Font* LoadSimpleFont(CPDF_Document* pDoc,
currentChar = nextChar;
}
fontDict->SetNewFor<CPDF_Number>("LastChar", static_cast<int>(currentChar));
- fontDict->SetNewFor<CPDF_Reference>("Widths", pDoc, widthsArray->GetObjNum());
+ fontDict->SetFor("Widths", widthsArray->MakeReference(pDoc));
CPDF_Dictionary* pFontDesc =
LoadFontDesc(pDoc, name, pFont.get(), data, size, font_type);
- fontDict->SetNewFor<CPDF_Reference>("FontDescriptor", pDoc,
- pFontDesc->GetObjNum());
+ fontDict->SetFor("FontDescriptor", pFontDesc->MakeReference(pDoc));
return pDoc->LoadFont(fontDict);
}
@@ -311,13 +310,11 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc,
pCIDSystemInfo->SetNewFor<CPDF_Name>("Registry", "Adobe");
pCIDSystemInfo->SetNewFor<CPDF_Name>("Ordering", "Identity");
pCIDSystemInfo->SetNewFor<CPDF_Number>("Supplement", 0);
- pCIDFont->SetNewFor<CPDF_Reference>("CIDSystemInfo", pDoc,
- pCIDSystemInfo->GetObjNum());
+ pCIDFont->SetFor("CIDSystemInfo", pCIDSystemInfo->MakeReference(pDoc));
CPDF_Dictionary* pFontDesc =
LoadFontDesc(pDoc, name, pFont.get(), data, size, font_type);
- pCIDFont->SetNewFor<CPDF_Reference>("FontDescriptor", pDoc,
- pFontDesc->GetObjNum());
+ pCIDFont->SetFor("FontDescriptor", pFontDesc->MakeReference(pDoc));
uint32_t glyphIndex;
uint32_t currentChar = FXFT_Get_First_Char(pFont->GetFace(), &glyphIndex);
@@ -386,15 +383,14 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc,
}
widthsArray->Add(std::move(curWidthArray));
}
- pCIDFont->SetNewFor<CPDF_Reference>("W", pDoc, widthsArray->GetObjNum());
+ pCIDFont->SetFor("W", widthsArray->MakeReference(pDoc));
// TODO(npm): Support vertical writing
auto pDescendant = pdfium::MakeUnique<CPDF_Array>();
- pDescendant->AddNew<CPDF_Reference>(pDoc, pCIDFont->GetObjNum());
+ pDescendant->Add(pCIDFont->MakeReference(pDoc));
fontDict->SetFor("DescendantFonts", std::move(pDescendant));
CPDF_Stream* toUnicodeStream = LoadUnicode(pDoc, to_unicode);
- fontDict->SetNewFor<CPDF_Reference>("ToUnicode", pDoc,
- toUnicodeStream->GetObjNum());
+ fontDict->SetFor("ToUnicode", toUnicodeStream->MakeReference(pDoc));
return pDoc->LoadFont(fontDict);
}