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/parser/cpdf_document.h" | 7 #include "core/fpdfapi/parser/cpdf_document.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
| 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "core/fpdfapi/cpdf_modulemgr.h" | 14 #include "core/fpdfapi/cpdf_modulemgr.h" |
14 #include "core/fpdfapi/font/cpdf_fontencoding.h" | 15 #include "core/fpdfapi/font/cpdf_fontencoding.h" |
15 #include "core/fpdfapi/page/cpdf_docpagedata.h" | 16 #include "core/fpdfapi/page/cpdf_docpagedata.h" |
16 #include "core/fpdfapi/page/cpdf_pagemodule.h" | 17 #include "core/fpdfapi/page/cpdf_pagemodule.h" |
17 #include "core/fpdfapi/page/pageint.h" | 18 #include "core/fpdfapi/page/pageint.h" |
18 #include "core/fpdfapi/parser/cpdf_array.h" | 19 #include "core/fpdfapi/parser/cpdf_array.h" |
19 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 20 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
20 #include "core/fpdfapi/parser/cpdf_number.h" | 21 #include "core/fpdfapi/parser/cpdf_number.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 int size = end - start + 1; | 234 int size = end - start + 1; |
234 int* widths = FX_Alloc(int, size); | 235 int* widths = FX_Alloc(int, size); |
235 int i; | 236 int i; |
236 for (i = 0; i < size; i++) { | 237 for (i = 0; i < size; i++) { |
237 int glyph_index = pEncoding->GlyphFromCharCode(start + i); | 238 int glyph_index = pEncoding->GlyphFromCharCode(start + i); |
238 widths[i] = pFont->GetGlyphWidth(glyph_index); | 239 widths[i] = pFont->GetGlyphWidth(glyph_index); |
239 } | 240 } |
240 InsertWidthArrayImpl(widths, size, pWidthArray); | 241 InsertWidthArrayImpl(widths, size, pWidthArray); |
241 } | 242 } |
242 | 243 |
243 int InsertDeletePDFPage(CPDF_Document* pDoc, | |
244 CPDF_Dictionary* pPages, | |
245 int nPagesToGo, | |
246 CPDF_Dictionary* pPage, | |
247 FX_BOOL bInsert, | |
248 std::set<CPDF_Dictionary*>* pVisited) { | |
249 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | |
250 if (!pKidList) | |
251 return -1; | |
252 | |
253 for (size_t i = 0; i < pKidList->GetCount(); i++) { | |
254 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); | |
255 if (pKid->GetStringFor("Type") == "Page") { | |
256 if (nPagesToGo == 0) { | |
257 if (bInsert) { | |
258 pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum())); | |
259 pPage->SetReferenceFor("Parent", pDoc, pPages->GetObjNum()); | |
260 } else { | |
261 pKidList->RemoveAt(i); | |
262 } | |
263 pPages->SetIntegerFor( | |
264 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); | |
265 return 1; | |
266 } | |
267 nPagesToGo--; | |
268 } else { | |
269 int nPages = pKid->GetIntegerFor("Count"); | |
270 if (nPagesToGo < nPages) { | |
271 if (pdfium::ContainsKey(*pVisited, pKid)) | |
272 return -1; | |
273 | |
274 pdfium::ScopedSetInsertion<CPDF_Dictionary*> insertion(pVisited, pKid); | |
275 if (InsertDeletePDFPage(pDoc, pKid, nPagesToGo, pPage, bInsert, | |
276 pVisited) < 0) { | |
277 return -1; | |
278 } | |
279 pPages->SetIntegerFor( | |
280 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); | |
281 return 1; | |
282 } | |
283 nPagesToGo -= nPages; | |
284 } | |
285 } | |
286 return 0; | |
287 } | |
288 | |
289 int InsertNewPage(CPDF_Document* pDoc, | |
290 int iPage, | |
291 CPDF_Dictionary* pPageDict, | |
292 CFX_ArrayTemplate<uint32_t>& pageList) { | |
293 CPDF_Dictionary* pRoot = pDoc->GetRoot(); | |
294 CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr; | |
295 if (!pPages) | |
296 return -1; | |
297 | |
298 int nPages = pDoc->GetPageCount(); | |
299 if (iPage < 0 || iPage > nPages) | |
300 return -1; | |
301 | |
302 if (iPage == nPages) { | |
303 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids"); | |
304 if (!pPagesList) { | |
305 pPagesList = new CPDF_Array; | |
306 pPages->SetFor("Kids", pPagesList); | |
307 } | |
308 pPagesList->Add(new CPDF_Reference(pDoc, pPageDict->GetObjNum())); | |
309 pPages->SetIntegerFor("Count", nPages + 1); | |
310 pPageDict->SetReferenceFor("Parent", pDoc, pPages->GetObjNum()); | |
311 } else { | |
312 std::set<CPDF_Dictionary*> stack = {pPages}; | |
313 if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, &stack) < 0) | |
314 return -1; | |
315 } | |
316 pageList.InsertAt(iPage, pPageDict->GetObjNum()); | |
317 return iPage; | |
318 } | |
319 | |
320 int CountPages(CPDF_Dictionary* pPages, | 244 int CountPages(CPDF_Dictionary* pPages, |
321 std::set<CPDF_Dictionary*>* visited_pages) { | 245 std::set<CPDF_Dictionary*>* visited_pages) { |
322 int count = pPages->GetIntegerFor("Count"); | 246 int count = pPages->GetIntegerFor("Count"); |
323 if (count > 0 && count < FPDF_PAGE_MAX_NUM) | 247 if (count > 0 && count < FPDF_PAGE_MAX_NUM) |
324 return count; | 248 return count; |
325 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | 249 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
326 if (!pKidList) | 250 if (!pKidList) |
327 return 0; | 251 return 0; |
328 count = 0; | 252 count = 0; |
329 for (size_t i = 0; i < pKidList->GetCount(); i++) { | 253 for (size_t i = 0; i < pKidList->GetCount(); i++) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 return pFontDesc; | 330 return pFontDesc; |
407 } | 331 } |
408 | 332 |
409 } // namespace | 333 } // namespace |
410 | 334 |
411 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) | 335 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) |
412 : CPDF_IndirectObjectHolder(), | 336 : CPDF_IndirectObjectHolder(), |
413 m_pParser(std::move(pParser)), | 337 m_pParser(std::move(pParser)), |
414 m_pRootDict(nullptr), | 338 m_pRootDict(nullptr), |
415 m_pInfoDict(nullptr), | 339 m_pInfoDict(nullptr), |
| 340 m_iLastPageTraversed(-1), |
416 m_bLinearized(false), | 341 m_bLinearized(false), |
417 m_iFirstPageNo(0), | 342 m_iFirstPageNo(0), |
418 m_dwFirstPageObjNum(0), | 343 m_dwFirstPageObjNum(0), |
419 m_pDocPage(new CPDF_DocPageData(this)), | 344 m_pDocPage(new CPDF_DocPageData(this)), |
420 m_pDocRender(new CPDF_DocRenderData(this)), | 345 m_pDocRender(new CPDF_DocRenderData(this)), |
421 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { | 346 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { |
422 if (pParser) | 347 if (pParser) |
423 SetLastObjNum(m_pParser->GetLastObjNum()); | 348 SetLastObjNum(m_pParser->GetLastObjNum()); |
424 } | 349 } |
425 | 350 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 395 |
471 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O"); | 396 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O"); |
472 if (ToNumber(pObjNum)) | 397 if (ToNumber(pObjNum)) |
473 m_dwFirstPageObjNum = pObjNum->GetInteger(); | 398 m_dwFirstPageObjNum = pObjNum->GetInteger(); |
474 } | 399 } |
475 | 400 |
476 void CPDF_Document::LoadPages() { | 401 void CPDF_Document::LoadPages() { |
477 m_PageList.SetSize(RetrievePageCount()); | 402 m_PageList.SetSize(RetrievePageCount()); |
478 } | 403 } |
479 | 404 |
480 CPDF_Dictionary* CPDF_Document::FindPDFPage(CPDF_Dictionary* pPages, | 405 CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, int nPagesToGo) { |
481 int iPage, | 406 std::pair<CPDF_Dictionary*, int>* lastProc = &m_pTreeTraversal.top(); |
482 int nPagesToGo, | 407 CPDF_Dictionary* pPages = lastProc->first; |
483 int level) { | |
484 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | 408 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
485 if (!pKidList) | 409 if (!pKidList) { |
486 return nPagesToGo == 0 ? pPages : nullptr; | 410 m_pTreeTraversal.pop(); |
| 411 if (nPagesToGo != 1) |
| 412 return nullptr; |
| 413 m_PageList.SetAt(iPage, pPages->GetObjNum()); |
| 414 return pPages; |
| 415 } |
487 | 416 |
488 if (level >= FX_MAX_PAGE_LEVEL) | 417 if (m_pTreeTraversal.size() >= FX_MAX_PAGE_LEVEL) { |
| 418 m_pTreeTraversal.pop(); |
489 return nullptr; | 419 return nullptr; |
| 420 } |
490 | 421 |
491 for (size_t i = 0; i < pKidList->GetCount(); i++) { | 422 bool shouldFinish = pPages->GetIntegerFor("Count") <= nPagesToGo; |
| 423 CPDF_Dictionary* page = nullptr; |
| 424 for (size_t i = lastProc->second + 1; i < pKidList->GetCount(); i++) { |
492 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); | 425 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); |
493 if (!pKid) { | 426 if (!pKid) { |
494 nPagesToGo--; | 427 nPagesToGo--; |
| 428 lastProc->second++; |
495 continue; | 429 continue; |
496 } | 430 } |
497 if (pKid == pPages) | 431 if (pKid == pPages) { |
| 432 lastProc->second++; |
498 continue; | 433 continue; |
| 434 } |
499 if (!pKid->KeyExist("Kids")) { | 435 if (!pKid->KeyExist("Kids")) { |
500 if (nPagesToGo == 0) | 436 m_PageList.SetAt(iPage - nPagesToGo + 1, pKid->GetObjNum()); |
501 return pKid; | |
502 | |
503 m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum()); | |
504 nPagesToGo--; | 437 nPagesToGo--; |
| 438 lastProc->second++; |
| 439 if (nPagesToGo == 0) { |
| 440 page = pKid; |
| 441 break; |
| 442 } |
505 } else { | 443 } else { |
506 int nPages = pKid->GetIntegerFor("Count"); | 444 int nPages = pKid->GetIntegerFor("Count"); |
507 if (nPagesToGo < nPages) | 445 m_pTreeTraversal.push(std::make_pair(pKid, -1)); |
508 return FindPDFPage(pKid, iPage, nPagesToGo, level + 1); | 446 CPDF_Dictionary* pageKid = TraversePDFPages(iPage, nPagesToGo); |
509 | 447 // If the stack top is current element, kid was completely processed. |
| 448 if (lastProc == &m_pTreeTraversal.top()) |
| 449 lastProc->second++; |
| 450 if (nPagesToGo <= nPages) { |
| 451 page = pageKid; |
| 452 break; |
| 453 } |
510 nPagesToGo -= nPages; | 454 nPagesToGo -= nPages; |
511 } | 455 } |
512 } | 456 } |
513 return nullptr; | 457 if (shouldFinish || |
| 458 lastProc->second == static_cast<int>(pKidList->GetCount() - 1)) { |
| 459 m_pTreeTraversal.pop(); |
| 460 } |
| 461 return page; |
514 } | 462 } |
515 | 463 |
516 CPDF_Dictionary* CPDF_Document::GetPagesDict() const { | 464 CPDF_Dictionary* CPDF_Document::GetPagesDict() const { |
517 CPDF_Dictionary* pRoot = GetRoot(); | 465 CPDF_Dictionary* pRoot = GetRoot(); |
518 return pRoot ? pRoot->GetDictFor("Pages") : nullptr; | 466 return pRoot ? pRoot->GetDictFor("Pages") : nullptr; |
519 } | 467 } |
520 | 468 |
521 bool CPDF_Document::IsPageLoaded(int iPage) const { | 469 bool CPDF_Document::IsPageLoaded(int iPage) const { |
522 return !!m_PageList.GetAt(iPage); | 470 return !!m_PageList.GetAt(iPage); |
523 } | 471 } |
524 | 472 |
525 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { | 473 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { |
526 if (iPage < 0 || iPage >= m_PageList.GetSize()) | 474 if (iPage < 0 || iPage >= m_PageList.GetSize()) |
527 return nullptr; | 475 return nullptr; |
528 | 476 |
529 if (m_bLinearized && (iPage == m_iFirstPageNo)) { | 477 if (m_bLinearized && (iPage == m_iFirstPageNo)) { |
530 if (CPDF_Dictionary* pDict = | 478 if (CPDF_Dictionary* pDict = |
531 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) { | 479 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) { |
532 return pDict; | 480 return pDict; |
533 } | 481 } |
534 } | 482 } |
535 | 483 |
536 int objnum = m_PageList.GetAt(iPage); | 484 int objnum = m_PageList.GetAt(iPage); |
537 if (objnum) { | 485 if (!objnum || m_iLastPageTraversed < iPage) { |
538 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum))) | 486 CPDF_Dictionary* pPages = GetPagesDict(); |
539 return pDict; | 487 if (!pPages) |
| 488 return nullptr; |
| 489 if (m_pTreeTraversal.empty()) |
| 490 m_pTreeTraversal.push(std::make_pair(pPages, -1)); |
| 491 CPDF_Dictionary* page = TraversePDFPages(m_iLastPageTraversed + 1, |
| 492 iPage - m_iLastPageTraversed); |
| 493 m_iLastPageTraversed = iPage; |
| 494 return page; |
540 } | 495 } |
541 | 496 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum))) |
542 CPDF_Dictionary* pPages = GetPagesDict(); | 497 return pDict; |
543 if (!pPages) | 498 return nullptr; |
544 return nullptr; | |
545 | |
546 CPDF_Dictionary* pPage = FindPDFPage(pPages, iPage, iPage, 0); | |
547 if (!pPage) | |
548 return nullptr; | |
549 | |
550 m_PageList.SetAt(iPage, pPage->GetObjNum()); | |
551 return pPage; | |
552 } | 499 } |
553 | 500 |
554 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) { | 501 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) { |
555 m_PageList.SetAt(iPage, objNum); | 502 m_PageList.SetAt(iPage, objNum); |
556 } | 503 } |
557 | 504 |
558 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, | 505 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, |
559 uint32_t& skip_count, | 506 uint32_t& skip_count, |
560 uint32_t objnum, | 507 uint32_t objnum, |
561 int& index, | 508 int& index, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 pPages->SetFor("Kids", new CPDF_Array); | 650 pPages->SetFor("Kids", new CPDF_Array); |
704 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); | 651 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); |
705 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); | 652 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); |
706 AddIndirectObject(m_pInfoDict); | 653 AddIndirectObject(m_pInfoDict); |
707 } | 654 } |
708 | 655 |
709 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { | 656 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { |
710 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); | 657 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); |
711 pDict->SetNameFor("Type", "Page"); | 658 pDict->SetNameFor("Type", "Page"); |
712 uint32_t dwObjNum = AddIndirectObject(pDict); | 659 uint32_t dwObjNum = AddIndirectObject(pDict); |
713 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { | 660 if (InsertNewPage(iPage, pDict, m_PageList) < 0) { |
714 ReleaseIndirectObject(dwObjNum); | 661 ReleaseIndirectObject(dwObjNum); |
715 return nullptr; | 662 return nullptr; |
716 } | 663 } |
717 return pDict; | 664 return pDict; |
718 } | 665 } |
719 | 666 |
| 667 int CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages, |
| 668 int nPagesToGo, |
| 669 CPDF_Dictionary* pPage, |
| 670 FX_BOOL bInsert, |
| 671 std::set<CPDF_Dictionary*>* pVisited) { |
| 672 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
| 673 if (!pKidList) |
| 674 return -1; |
| 675 |
| 676 for (size_t i = 0; i < pKidList->GetCount(); i++) { |
| 677 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); |
| 678 if (pKid->GetStringFor("Type") == "Page") { |
| 679 if (nPagesToGo == 0) { |
| 680 if (bInsert) { |
| 681 pKidList->InsertAt(i, new CPDF_Reference(this, pPage->GetObjNum())); |
| 682 pPage->SetReferenceFor("Parent", this, pPages->GetObjNum()); |
| 683 } else { |
| 684 pKidList->RemoveAt(i); |
| 685 } |
| 686 pPages->SetIntegerFor( |
| 687 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); |
| 688 // Tree will change, so reset tree transversal variables |
| 689 m_iLastPageTraversed = -1; |
| 690 m_pTreeTraversal = std::stack<std::pair<CPDF_Dictionary*, int>>(); |
| 691 return 1; |
| 692 } |
| 693 nPagesToGo--; |
| 694 } else { |
| 695 int nPages = pKid->GetIntegerFor("Count"); |
| 696 if (nPagesToGo < nPages) { |
| 697 if (pdfium::ContainsKey(*pVisited, pKid)) |
| 698 return -1; |
| 699 |
| 700 pdfium::ScopedSetInsertion<CPDF_Dictionary*> insertion(pVisited, pKid); |
| 701 if (InsertDeletePDFPage(pKid, nPagesToGo, pPage, bInsert, pVisited) < |
| 702 0) { |
| 703 return -1; |
| 704 } |
| 705 pPages->SetIntegerFor( |
| 706 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); |
| 707 return 1; |
| 708 } |
| 709 nPagesToGo -= nPages; |
| 710 } |
| 711 } |
| 712 return 0; |
| 713 } |
| 714 |
| 715 int CPDF_Document::InsertNewPage(int iPage, |
| 716 CPDF_Dictionary* pPageDict, |
| 717 CFX_ArrayTemplate<uint32_t>& pageList) { |
| 718 CPDF_Dictionary* pRoot = GetRoot(); |
| 719 CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr; |
| 720 if (!pPages) |
| 721 return -1; |
| 722 |
| 723 int nPages = GetPageCount(); |
| 724 if (iPage < 0 || iPage > nPages) |
| 725 return -1; |
| 726 |
| 727 if (iPage == nPages) { |
| 728 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids"); |
| 729 if (!pPagesList) { |
| 730 pPagesList = new CPDF_Array; |
| 731 pPages->SetFor("Kids", pPagesList); |
| 732 } |
| 733 pPagesList->Add(new CPDF_Reference(this, pPageDict->GetObjNum())); |
| 734 pPages->SetIntegerFor("Count", nPages + 1); |
| 735 pPageDict->SetReferenceFor("Parent", this, pPages->GetObjNum()); |
| 736 } else { |
| 737 std::set<CPDF_Dictionary*> stack = {pPages}; |
| 738 if (InsertDeletePDFPage(pPages, iPage, pPageDict, TRUE, &stack) < 0) |
| 739 return -1; |
| 740 } |
| 741 pageList.InsertAt(iPage, pPageDict->GetObjNum()); |
| 742 return iPage; |
| 743 } |
| 744 |
720 void CPDF_Document::DeletePage(int iPage) { | 745 void CPDF_Document::DeletePage(int iPage) { |
721 CPDF_Dictionary* pPages = GetPagesDict(); | 746 CPDF_Dictionary* pPages = GetPagesDict(); |
722 if (!pPages) | 747 if (!pPages) |
723 return; | 748 return; |
724 | 749 |
725 int nPages = pPages->GetIntegerFor("Count"); | 750 int nPages = pPages->GetIntegerFor("Count"); |
726 if (iPage < 0 || iPage >= nPages) | 751 if (iPage < 0 || iPage >= nPages) |
727 return; | 752 return; |
728 | 753 |
729 std::set<CPDF_Dictionary*> stack = {pPages}; | 754 std::set<CPDF_Dictionary*> stack = {pPages}; |
730 if (InsertDeletePDFPage(this, pPages, iPage, nullptr, FALSE, &stack) < 0) | 755 if (InsertDeletePDFPage(pPages, iPage, nullptr, FALSE, &stack) < 0) |
731 return; | 756 return; |
732 | 757 |
733 m_PageList.RemoveAt(iPage); | 758 m_PageList.RemoveAt(iPage); |
734 } | 759 } |
735 | 760 |
736 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, | 761 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, |
737 CPDF_FontEncoding* pEncoding) { | 762 CPDF_FontEncoding* pEncoding) { |
738 CFX_ByteString name(font); | 763 CFX_ByteString name(font); |
739 if (PDF_GetStandardFontName(&name) < 0) | 764 if (PDF_GetStandardFontName(&name) < 0) |
740 return nullptr; | 765 return nullptr; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 pBBox, pLogFont->lfWeight / 5); | 1038 pBBox, pLogFont->lfWeight / 5); |
1014 pFontDesc->SetIntegerFor("CapHeight", capheight); | 1039 pFontDesc->SetIntegerFor("CapHeight", capheight); |
1015 pFontDict->SetReferenceFor("FontDescriptor", this, | 1040 pFontDict->SetReferenceFor("FontDescriptor", this, |
1016 AddIndirectObject(pFontDesc)); | 1041 AddIndirectObject(pFontDesc)); |
1017 hFont = SelectObject(hDC, hFont); | 1042 hFont = SelectObject(hDC, hFont); |
1018 DeleteObject(hFont); | 1043 DeleteObject(hFont); |
1019 DeleteDC(hDC); | 1044 DeleteDC(hDC); |
1020 return LoadFont(pBaseDict); | 1045 return LoadFont(pBaseDict); |
1021 } | 1046 } |
1022 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1047 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
OLD | NEW |