summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font/cpdf_font.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-07 23:36:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-07 23:36:56 +0000
commitf90277e7f4bd99bba419b53341c6c7bdca478eed (patch)
treedeee5f1b80610ef68440dd4924a44a75c1cdab50 /core/fpdfapi/font/cpdf_font.cpp
parent52c0fcbaf99940a51a1179f035949eab7fc67352 (diff)
downloadpdfium-f90277e7f4bd99bba419b53341c6c7bdca478eed.tar.xz
Move CPDF_Font::LoadPDFEncoding() to CPDF_SimpleFont.
It is not used in the CPDF_Font base class. Change-Id: I6033a5dd422179eb95f19a2f2ecf06d007f3223f Reviewed-on: https://pdfium-review.googlesource.com/39493 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/font/cpdf_font.cpp')
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp78
1 files changed, 0 insertions, 78 deletions
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 110770a604..a243ceb334 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -39,17 +39,6 @@ const uint8_t kChineseFontNames[][kChineseFontNameSize] = {
{0xB7, 0xC2, 0xCB, 0xCE},
{0xD0, 0xC2, 0xCB, 0xCE}};
-void GetPredefinedEncoding(const ByteString& value, int* basemap) {
- if (value == "WinAnsiEncoding")
- *basemap = PDFFONT_ENCODING_WINANSI;
- else if (value == "MacRomanEncoding")
- *basemap = PDFFONT_ENCODING_MACROMAN;
- else if (value == "MacExpertEncoding")
- *basemap = PDFFONT_ENCODING_MACEXPERT;
- else if (value == "PDFDocEncoding")
- *basemap = PDFFONT_ENCODING_PDFDOC;
-}
-
} // namespace
CPDF_Font::CPDF_Font(CPDF_Document* pDocument, CPDF_Dictionary* pFontDict)
@@ -350,73 +339,6 @@ uint32_t CPDF_Font::GetNextChar(const ByteStringView& pString,
return static_cast<uint32_t>(ch);
}
-void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
- int& iBaseEncoding,
- std::vector<ByteString>* pCharNames,
- bool bEmbedded,
- bool bTrueType) {
- if (!pEncoding) {
- if (m_BaseFont == "Symbol") {
- iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL
- : PDFFONT_ENCODING_ADOBE_SYMBOL;
- } else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) {
- iBaseEncoding = PDFFONT_ENCODING_WINANSI;
- }
- return;
- }
- if (pEncoding->IsName()) {
- if (iBaseEncoding == PDFFONT_ENCODING_ADOBE_SYMBOL ||
- iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) {
- return;
- }
- if (FontStyleIsSymbolic(m_Flags) && m_BaseFont == "Symbol") {
- if (!bTrueType)
- iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
- return;
- }
- ByteString bsEncoding = pEncoding->GetString();
- if (bsEncoding.Compare("MacExpertEncoding") == 0) {
- bsEncoding = "WinAnsiEncoding";
- }
- GetPredefinedEncoding(bsEncoding, &iBaseEncoding);
- return;
- }
-
- CPDF_Dictionary* pDict = pEncoding->AsDictionary();
- if (!pDict)
- return;
-
- if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
- iBaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS) {
- ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
- if (bTrueType && bsEncoding.Compare("MacExpertEncoding") == 0)
- bsEncoding = "WinAnsiEncoding";
- GetPredefinedEncoding(bsEncoding, &iBaseEncoding);
- }
- if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN)
- iBaseEncoding = PDFFONT_ENCODING_STANDARD;
-
- CPDF_Array* pDiffs = pDict->GetArrayFor("Differences");
- if (!pDiffs)
- return;
-
- pCharNames->resize(256);
- uint32_t cur_code = 0;
- for (uint32_t i = 0; i < pDiffs->GetCount(); i++) {
- CPDF_Object* pElement = pDiffs->GetDirectObjectAt(i);
- if (!pElement)
- continue;
-
- if (CPDF_Name* pName = pElement->AsName()) {
- if (cur_code < 256)
- (*pCharNames)[cur_code] = pName->GetString();
- cur_code++;
- } else {
- cur_code = pElement->GetInteger();
- }
- }
-}
-
bool CPDF_Font::IsStandardFont() const {
if (!IsType1Font())
return false;