| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fpdfapi/fpdf_page/pageint.h" | 7 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (pFont->GetFontDict()->KeyExist("Widths")) | 177 if (pFont->GetFontDict()->KeyExist("Widths")) |
| 178 continue; | 178 continue; |
| 179 | 179 |
| 180 CPDF_Type1Font* pT1Font = pFont->AsType1Font(); | 180 CPDF_Type1Font* pT1Font = pFont->AsType1Font(); |
| 181 if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding)) | 181 if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding)) |
| 182 continue; | 182 continue; |
| 183 | 183 |
| 184 return fontData->AddRef(); | 184 return fontData->AddRef(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 CPDF_Dictionary* pDict = new CPDF_Dictionary; | 187 CFX_ByteStringPool* pPool = m_pPDFDoc->GetByteStringPool(); |
| 188 CPDF_Dictionary* pDict = new CPDF_Dictionary(pPool); |
| 188 pDict->SetNameFor("Type", "Font"); | 189 pDict->SetNameFor("Type", "Font"); |
| 189 pDict->SetNameFor("Subtype", "Type1"); | 190 pDict->SetNameFor("Subtype", "Type1"); |
| 190 pDict->SetNameFor("BaseFont", fontName); | 191 pDict->SetNameFor("BaseFont", fontName); |
| 191 if (pEncoding) { | 192 if (pEncoding) { |
| 192 pDict->SetFor("Encoding", pEncoding->Realize()); | 193 pDict->SetFor("Encoding", pEncoding->Realize(pPool)); |
| 193 } | 194 } |
| 194 m_pPDFDoc->AddIndirectObject(pDict); | 195 m_pPDFDoc->AddIndirectObject(pDict); |
| 195 CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict); | 196 CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict); |
| 196 if (!pFont) { | 197 if (!pFont) { |
| 197 return nullptr; | 198 return nullptr; |
| 198 } | 199 } |
| 199 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont); | 200 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont); |
| 200 m_FontMap[pDict] = fontData; | 201 m_FontMap[pDict] = fontData; |
| 201 return fontData->AddRef(); | 202 return fontData->AddRef(); |
| 202 } | 203 } |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 } | 544 } |
| 544 | 545 |
| 545 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 546 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
| 546 CPDF_Object* pPatternObj) const { | 547 CPDF_Object* pPatternObj) const { |
| 547 if (!pPatternObj) | 548 if (!pPatternObj) |
| 548 return nullptr; | 549 return nullptr; |
| 549 | 550 |
| 550 auto it = m_PatternMap.find(pPatternObj); | 551 auto it = m_PatternMap.find(pPatternObj); |
| 551 return it != m_PatternMap.end() ? it->second : nullptr; | 552 return it != m_PatternMap.end() ? it->second : nullptr; |
| 552 } | 553 } |
| OLD | NEW |