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 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pPDFDoc->GetByteStringPool()); |
188 pDict->SetNameFor("Type", "Font"); | 188 pDict->SetNameFor("Type", "Font"); |
189 pDict->SetNameFor("Subtype", "Type1"); | 189 pDict->SetNameFor("Subtype", "Type1"); |
190 pDict->SetNameFor("BaseFont", fontName); | 190 pDict->SetNameFor("BaseFont", fontName); |
191 if (pEncoding) { | 191 if (pEncoding) { |
192 pDict->SetFor("Encoding", pEncoding->Realize()); | 192 pDict->SetFor("Encoding", |
| 193 pEncoding->Realize(m_pPDFDoc->GetByteStringPool())); |
193 } | 194 } |
194 m_pPDFDoc->AddIndirectObject(pDict); | 195 m_pPDFDoc->AddIndirectObject(pDict); |
195 std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict); | 196 std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(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.release()); | 200 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont.release()); |
200 m_FontMap[pDict] = fontData; | 201 m_FontMap[pDict] = fontData; |
201 return fontData->AddRef(); | 202 return fontData->AddRef(); |
202 } | 203 } |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } | 545 } |
545 | 546 |
546 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 547 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
547 CPDF_Object* pPatternObj) const { | 548 CPDF_Object* pPatternObj) const { |
548 if (!pPatternObj) | 549 if (!pPatternObj) |
549 return nullptr; | 550 return nullptr; |
550 | 551 |
551 auto it = m_PatternMap.find(pPatternObj); | 552 auto it = m_PatternMap.find(pPatternObj); |
552 return it != m_PatternMap.end() ? it->second : nullptr; | 553 return it != m_PatternMap.end() ? it->second : nullptr; |
553 } | 554 } |
OLD | NEW |