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> |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 int size = end - start + 1; | 233 int size = end - start + 1; |
234 int* widths = FX_Alloc(int, size); | 234 int* widths = FX_Alloc(int, size); |
235 int i; | 235 int i; |
236 for (i = 0; i < size; i++) { | 236 for (i = 0; i < size; i++) { |
237 int glyph_index = pEncoding->GlyphFromCharCode(start + i); | 237 int glyph_index = pEncoding->GlyphFromCharCode(start + i); |
238 widths[i] = pFont->GetGlyphWidth(glyph_index); | 238 widths[i] = pFont->GetGlyphWidth(glyph_index); |
239 } | 239 } |
240 InsertWidthArrayImpl(widths, size, pWidthArray); | 240 InsertWidthArrayImpl(widths, size, pWidthArray); |
241 } | 241 } |
242 | 242 |
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, | 243 int CountPages(CPDF_Dictionary* pPages, |
321 std::set<CPDF_Dictionary*>* visited_pages) { | 244 std::set<CPDF_Dictionary*>* visited_pages) { |
322 int count = pPages->GetIntegerFor("Count"); | 245 int count = pPages->GetIntegerFor("Count"); |
323 if (count > 0 && count < FPDF_PAGE_MAX_NUM) | 246 if (count > 0 && count < FPDF_PAGE_MAX_NUM) |
324 return count; | 247 return count; |
325 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | 248 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
326 if (!pKidList) | 249 if (!pKidList) |
327 return 0; | 250 return 0; |
328 count = 0; | 251 count = 0; |
329 for (size_t i = 0; i < pKidList->GetCount(); i++) { | 252 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; | 329 return pFontDesc; |
407 } | 330 } |
408 | 331 |
409 } // namespace | 332 } // namespace |
410 | 333 |
411 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) | 334 CPDF_Document::CPDF_Document(std::unique_ptr<CPDF_Parser> pParser) |
412 : CPDF_IndirectObjectHolder(), | 335 : CPDF_IndirectObjectHolder(), |
413 m_pParser(std::move(pParser)), | 336 m_pParser(std::move(pParser)), |
414 m_pRootDict(nullptr), | 337 m_pRootDict(nullptr), |
415 m_pInfoDict(nullptr), | 338 m_pInfoDict(nullptr), |
339 m_iLastPageTraversed(-1), | |
Tom Sepez
2016/11/02 17:37:37
nit: without actually looking, my hunch is that it
npm
2016/11/03 00:18:25
If that makes the code clearer, I can do that. It
| |
416 m_bLinearized(false), | 340 m_bLinearized(false), |
417 m_iFirstPageNo(0), | 341 m_iFirstPageNo(0), |
418 m_dwFirstPageObjNum(0), | 342 m_dwFirstPageObjNum(0), |
419 m_pDocPage(new CPDF_DocPageData(this)), | 343 m_pDocPage(new CPDF_DocPageData(this)), |
420 m_pDocRender(new CPDF_DocRenderData(this)), | 344 m_pDocRender(new CPDF_DocRenderData(this)), |
421 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { | 345 m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) { |
422 if (pParser) | 346 if (pParser) |
423 SetLastObjNum(m_pParser->GetLastObjNum()); | 347 SetLastObjNum(m_pParser->GetLastObjNum()); |
424 } | 348 } |
425 | 349 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 | 394 |
471 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O"); | 395 CPDF_Object* pObjNum = pLinearizationParams->GetObjectFor("O"); |
472 if (ToNumber(pObjNum)) | 396 if (ToNumber(pObjNum)) |
473 m_dwFirstPageObjNum = pObjNum->GetInteger(); | 397 m_dwFirstPageObjNum = pObjNum->GetInteger(); |
474 } | 398 } |
475 | 399 |
476 void CPDF_Document::LoadPages() { | 400 void CPDF_Document::LoadPages() { |
477 m_PageList.SetSize(RetrievePageCount()); | 401 m_PageList.SetSize(RetrievePageCount()); |
478 } | 402 } |
479 | 403 |
480 CPDF_Dictionary* CPDF_Document::FindPDFPage(CPDF_Dictionary* pPages, | 404 // When this is called, m_pTreeTraversal[level] exists |
481 int iPage, | 405 CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, |
482 int nPagesToGo, | 406 int& nPagesToGo, |
Tom Sepez
2016/11/02 17:37:37
I can't help but think this might be easier if we
npm
2016/11/03 00:18:25
If I understand correctly what you mean by current
| |
483 int level) { | 407 int level) { |
408 CPDF_Dictionary* pPages = m_pTreeTraversal[level].first; | |
484 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | 409 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); |
485 if (!pKidList) | 410 if (!pKidList) { |
486 return nPagesToGo == 0 ? pPages : nullptr; | 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 (level >= FX_MAX_PAGE_LEVEL) { |
418 m_pTreeTraversal.pop_back(); | |
489 return nullptr; | 419 return nullptr; |
420 } | |
490 | 421 |
491 for (size_t i = 0; i < pKidList->GetCount(); i++) { | 422 CPDF_Dictionary* page = nullptr; |
423 for (size_t i = m_pTreeTraversal[level].second; i < pKidList->GetCount(); | |
424 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--; |
Tom Sepez
2016/11/02 17:37:37
I worry about this going negative here ...
npm
2016/11/03 00:18:25
Yes, this can go negative. This wouldn't be a prob
| |
428 m_pTreeTraversal[level].second++; | |
495 continue; | 429 continue; |
496 } | 430 } |
497 if (pKid == pPages) | 431 if (pKid == pPages) { |
432 m_pTreeTraversal[level].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 m_pTreeTraversal[level].second++; | |
439 if (nPagesToGo == 0) { | |
440 page = pKid; | |
441 break; | |
442 } | |
505 } else { | 443 } else { |
506 int nPages = pKid->GetIntegerFor("Count"); | 444 // If the vector has size level+1, the child is not in yet |
507 if (nPagesToGo < nPages) | 445 if (static_cast<int>(m_pTreeTraversal.size()) == level + 1) |
508 return FindPDFPage(pKid, iPage, nPagesToGo, level + 1); | 446 m_pTreeTraversal.push_back(std::make_pair(pKid, 0)); |
509 | 447 // Now m_pTreeTraversal[level+1] should exist and be equal to pKid. |
510 nPagesToGo -= nPages; | 448 CPDF_Dictionary* pageKid = TraversePDFPages(iPage, nPagesToGo, level + 1); |
449 // Check if child was completely processed, i.e. it popped itself out | |
450 if (static_cast<int>(m_pTreeTraversal.size()) == level + 1) | |
451 m_pTreeTraversal[level].second++; | |
452 // If child did not finish or if no pages to go, we are done | |
453 if (static_cast<int>(m_pTreeTraversal.size()) != level + 1 || | |
454 nPagesToGo <= 0) { | |
455 page = pageKid; | |
456 break; | |
457 } | |
511 } | 458 } |
512 } | 459 } |
513 return nullptr; | 460 if (m_pTreeTraversal[level].second == |
461 static_cast<int>(pKidList->GetCount())) { | |
462 m_pTreeTraversal.pop_back(); | |
463 } | |
464 return page; | |
514 } | 465 } |
515 | 466 |
516 CPDF_Dictionary* CPDF_Document::GetPagesDict() const { | 467 CPDF_Dictionary* CPDF_Document::GetPagesDict() const { |
517 CPDF_Dictionary* pRoot = GetRoot(); | 468 CPDF_Dictionary* pRoot = GetRoot(); |
518 return pRoot ? pRoot->GetDictFor("Pages") : nullptr; | 469 return pRoot ? pRoot->GetDictFor("Pages") : nullptr; |
519 } | 470 } |
520 | 471 |
521 bool CPDF_Document::IsPageLoaded(int iPage) const { | 472 bool CPDF_Document::IsPageLoaded(int iPage) const { |
522 return !!m_PageList.GetAt(iPage); | 473 return !!m_PageList.GetAt(iPage); |
523 } | 474 } |
524 | 475 |
525 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { | 476 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { |
526 if (iPage < 0 || iPage >= m_PageList.GetSize()) | 477 if (iPage < 0 || iPage >= m_PageList.GetSize()) |
527 return nullptr; | 478 return nullptr; |
528 | 479 |
529 if (m_bLinearized && (iPage == m_iFirstPageNo)) { | 480 if (m_bLinearized && (iPage == m_iFirstPageNo)) { |
530 if (CPDF_Dictionary* pDict = | 481 if (CPDF_Dictionary* pDict = |
531 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) { | 482 ToDictionary(GetOrParseIndirectObject(m_dwFirstPageObjNum))) { |
532 return pDict; | 483 return pDict; |
533 } | 484 } |
534 } | 485 } |
535 | 486 |
536 int objnum = m_PageList.GetAt(iPage); | 487 int objnum = m_PageList.GetAt(iPage); |
537 if (objnum) { | 488 if (objnum) { |
538 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum))) | 489 if (CPDF_Dictionary* pDict = ToDictionary(GetOrParseIndirectObject(objnum))) |
539 return pDict; | 490 return pDict; |
491 return nullptr; | |
540 } | 492 } |
541 | 493 |
542 CPDF_Dictionary* pPages = GetPagesDict(); | 494 CPDF_Dictionary* pPages = GetPagesDict(); |
543 if (!pPages) | 495 if (!pPages) |
544 return nullptr; | 496 return nullptr; |
545 | 497 |
546 CPDF_Dictionary* pPage = FindPDFPage(pPages, iPage, iPage, 0); | 498 if (m_pTreeTraversal.empty()) |
547 if (!pPage) | 499 m_pTreeTraversal.push_back(std::make_pair(pPages, 0)); |
548 return nullptr; | 500 int nPagesToGo = iPage - m_iLastPageTraversed; |
549 | 501 CPDF_Dictionary* pPage = TraversePDFPages(iPage, nPagesToGo, 0); |
550 m_PageList.SetAt(iPage, pPage->GetObjNum()); | 502 m_iLastPageTraversed = iPage; |
551 return pPage; | 503 return pPage; |
552 } | 504 } |
553 | 505 |
554 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) { | 506 void CPDF_Document::SetPageObjNum(int iPage, uint32_t objNum) { |
555 m_PageList.SetAt(iPage, objNum); | 507 m_PageList.SetAt(iPage, objNum); |
556 } | 508 } |
557 | 509 |
558 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, | 510 int CPDF_Document::FindPageIndex(CPDF_Dictionary* pNode, |
559 uint32_t& skip_count, | 511 uint32_t& skip_count, |
560 uint32_t objnum, | 512 uint32_t objnum, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
703 pPages->SetFor("Kids", new CPDF_Array); | 655 pPages->SetFor("Kids", new CPDF_Array); |
704 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); | 656 m_pRootDict->SetReferenceFor("Pages", this, AddIndirectObject(pPages)); |
705 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); | 657 m_pInfoDict = new CPDF_Dictionary(m_pByteStringPool); |
706 AddIndirectObject(m_pInfoDict); | 658 AddIndirectObject(m_pInfoDict); |
707 } | 659 } |
708 | 660 |
709 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { | 661 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { |
710 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); | 662 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pByteStringPool); |
711 pDict->SetNameFor("Type", "Page"); | 663 pDict->SetNameFor("Type", "Page"); |
712 uint32_t dwObjNum = AddIndirectObject(pDict); | 664 uint32_t dwObjNum = AddIndirectObject(pDict); |
713 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { | 665 if (InsertNewPage(iPage, pDict, m_PageList) < 0) { |
714 ReleaseIndirectObject(dwObjNum); | 666 ReleaseIndirectObject(dwObjNum); |
715 return nullptr; | 667 return nullptr; |
716 } | 668 } |
717 return pDict; | 669 return pDict; |
718 } | 670 } |
719 | 671 |
672 int CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages, | |
Tom Sepez
2016/11/02 17:37:37
can we do this refactoring first as a separate CL?
npm
2016/11/03 00:18:25
Sounds good, will do.
| |
673 int nPagesToGo, | |
674 CPDF_Dictionary* pPage, | |
675 FX_BOOL bInsert, | |
676 std::set<CPDF_Dictionary*>* pVisited) { | |
677 CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); | |
678 if (!pKidList) | |
679 return -1; | |
680 | |
681 for (size_t i = 0; i < pKidList->GetCount(); i++) { | |
682 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); | |
683 if (pKid->GetStringFor("Type") == "Page") { | |
684 if (nPagesToGo == 0) { | |
685 if (bInsert) { | |
686 pKidList->InsertAt(i, new CPDF_Reference(this, pPage->GetObjNum())); | |
687 pPage->SetReferenceFor("Parent", this, pPages->GetObjNum()); | |
688 } else { | |
689 pKidList->RemoveAt(i); | |
690 } | |
691 pPages->SetIntegerFor( | |
692 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); | |
693 // Tree will change, so reset tree transversal variables | |
694 m_iLastPageTraversed = -1; | |
695 m_pTreeTraversal.clear(); | |
696 return 1; | |
697 } | |
698 nPagesToGo--; | |
699 } else { | |
700 int nPages = pKid->GetIntegerFor("Count"); | |
701 if (nPagesToGo < nPages) { | |
702 if (pdfium::ContainsKey(*pVisited, pKid)) | |
703 return -1; | |
704 | |
705 pdfium::ScopedSetInsertion<CPDF_Dictionary*> insertion(pVisited, pKid); | |
706 if (InsertDeletePDFPage(pKid, nPagesToGo, pPage, bInsert, pVisited) < | |
707 0) { | |
708 return -1; | |
709 } | |
710 pPages->SetIntegerFor( | |
711 "Count", pPages->GetIntegerFor("Count") + (bInsert ? 1 : -1)); | |
712 return 1; | |
713 } | |
714 nPagesToGo -= nPages; | |
715 } | |
716 } | |
717 return 0; | |
718 } | |
719 | |
720 int CPDF_Document::InsertNewPage(int iPage, | |
721 CPDF_Dictionary* pPageDict, | |
722 CFX_ArrayTemplate<uint32_t>& pageList) { | |
723 CPDF_Dictionary* pRoot = GetRoot(); | |
724 CPDF_Dictionary* pPages = pRoot ? pRoot->GetDictFor("Pages") : nullptr; | |
725 if (!pPages) | |
726 return -1; | |
727 | |
728 int nPages = GetPageCount(); | |
729 if (iPage < 0 || iPage > nPages) | |
730 return -1; | |
731 | |
732 if (iPage == nPages) { | |
733 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids"); | |
734 if (!pPagesList) { | |
735 pPagesList = new CPDF_Array; | |
736 pPages->SetFor("Kids", pPagesList); | |
737 } | |
738 pPagesList->Add(new CPDF_Reference(this, pPageDict->GetObjNum())); | |
739 pPages->SetIntegerFor("Count", nPages + 1); | |
740 pPageDict->SetReferenceFor("Parent", this, pPages->GetObjNum()); | |
741 // Reset tree transversal variables | |
742 m_iLastPageTraversed = -1; | |
743 m_pTreeTraversal.clear(); | |
744 } else { | |
745 std::set<CPDF_Dictionary*> stack = {pPages}; | |
746 if (InsertDeletePDFPage(pPages, iPage, pPageDict, TRUE, &stack) < 0) | |
747 return -1; | |
748 } | |
749 pageList.InsertAt(iPage, pPageDict->GetObjNum()); | |
750 return iPage; | |
751 } | |
752 | |
720 void CPDF_Document::DeletePage(int iPage) { | 753 void CPDF_Document::DeletePage(int iPage) { |
721 CPDF_Dictionary* pPages = GetPagesDict(); | 754 CPDF_Dictionary* pPages = GetPagesDict(); |
722 if (!pPages) | 755 if (!pPages) |
723 return; | 756 return; |
724 | 757 |
725 int nPages = pPages->GetIntegerFor("Count"); | 758 int nPages = pPages->GetIntegerFor("Count"); |
726 if (iPage < 0 || iPage >= nPages) | 759 if (iPage < 0 || iPage >= nPages) |
727 return; | 760 return; |
728 | 761 |
729 std::set<CPDF_Dictionary*> stack = {pPages}; | 762 std::set<CPDF_Dictionary*> stack = {pPages}; |
730 if (InsertDeletePDFPage(this, pPages, iPage, nullptr, FALSE, &stack) < 0) | 763 if (InsertDeletePDFPage(pPages, iPage, nullptr, FALSE, &stack) < 0) |
731 return; | 764 return; |
732 | 765 |
733 m_PageList.RemoveAt(iPage); | 766 m_PageList.RemoveAt(iPage); |
734 } | 767 } |
735 | 768 |
736 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, | 769 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, |
737 CPDF_FontEncoding* pEncoding) { | 770 CPDF_FontEncoding* pEncoding) { |
738 CFX_ByteString name(font); | 771 CFX_ByteString name(font); |
739 if (PDF_GetStandardFontName(&name) < 0) | 772 if (PDF_GetStandardFontName(&name) < 0) |
740 return nullptr; | 773 return nullptr; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1013 pBBox, pLogFont->lfWeight / 5); | 1046 pBBox, pLogFont->lfWeight / 5); |
1014 pFontDesc->SetIntegerFor("CapHeight", capheight); | 1047 pFontDesc->SetIntegerFor("CapHeight", capheight); |
1015 pFontDict->SetReferenceFor("FontDescriptor", this, | 1048 pFontDict->SetReferenceFor("FontDescriptor", this, |
1016 AddIndirectObject(pFontDesc)); | 1049 AddIndirectObject(pFontDesc)); |
1017 hFont = SelectObject(hDC, hFont); | 1050 hFont = SelectObject(hDC, hFont); |
1018 DeleteObject(hFont); | 1051 DeleteObject(hFont); |
1019 DeleteDC(hDC); | 1052 DeleteDC(hDC); |
1020 return LoadFont(pBaseDict); | 1053 return LoadFont(pBaseDict); |
1021 } | 1054 } |
1022 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1055 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
OLD | NEW |