Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: core/fpdfdoc/doc_utils.cpp

Issue 1889863002: Make CPDF_Dictionary methods take CFX_ByteString arguments (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: One last caller. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfdoc/doc_tagged.cpp ('k') | fpdfsdk/formfiller/cba_fontmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 10 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 return NULL; 379 return NULL;
380 } 380 }
381 CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); 381 CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
382 if (!pDR) { 382 if (!pDR) {
383 return NULL; 383 return NULL;
384 } 384 }
385 CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); 385 CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
386 if (!pFonts) { 386 if (!pFonts) {
387 return NULL; 387 return NULL;
388 } 388 }
389 CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias.AsStringC()); 389 CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias);
390 if (!pElement) { 390 if (!pElement) {
391 return NULL; 391 return NULL;
392 } 392 }
393 if (pElement->GetStringBy("Type") == "Font") { 393 if (pElement->GetStringBy("Type") == "Font") {
394 return pDocument->LoadFont(pElement); 394 return pDocument->LoadFont(pElement);
395 } 395 }
396 return NULL; 396 return NULL;
397 } 397 }
398 CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, 398 CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
399 CPDF_Document* pDocument, 399 CPDF_Document* pDocument,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 if (!pFonts) { 598 if (!pFonts) {
599 pFonts = new CPDF_Dictionary; 599 pFonts = new CPDF_Dictionary;
600 pDR->SetAt("Font", pFonts); 600 pDR->SetAt("Font", pFonts);
601 } 601 }
602 if (csNameTag.IsEmpty()) { 602 if (csNameTag.IsEmpty()) {
603 csNameTag = pFont->GetBaseFont(); 603 csNameTag = pFont->GetBaseFont();
604 } 604 }
605 csNameTag.Remove(' '); 605 csNameTag.Remove(' ');
606 csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, 606 csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4,
607 csNameTag.c_str()); 607 csNameTag.c_str());
608 pFonts->SetAtReference(csNameTag.AsStringC(), pDocument, 608 pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict());
609 pFont->GetFontDict());
610 } 609 }
611 CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, 610 CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
612 CPDF_Document* pDocument, 611 CPDF_Document* pDocument,
613 uint8_t charSet, 612 uint8_t charSet,
614 CFX_ByteString& csNameTag) { 613 CFX_ByteString& csNameTag) {
615 if (!pFormDict) { 614 if (!pFormDict) {
616 InitInterFormDict(pFormDict, pDocument); 615 InitInterFormDict(pFormDict, pDocument);
617 } 616 }
618 CFX_ByteString csTemp; 617 CFX_ByteString csTemp;
619 CPDF_Font* pFont = 618 CPDF_Font* pFont =
(...skipping 23 matching lines...) Expand all
643 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) { 642 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) {
644 if (!pFormDict || !pFont) { 643 if (!pFormDict || !pFont) {
645 return; 644 return;
646 } 645 }
647 CFX_ByteString csTag; 646 CFX_ByteString csTag;
648 if (!FindInterFormFont(pFormDict, pFont, csTag)) { 647 if (!FindInterFormFont(pFormDict, pFont, csTag)) {
649 return; 648 return;
650 } 649 }
651 CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); 650 CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
652 CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); 651 CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
653 pFonts->RemoveAt(csTag.AsStringC()); 652 pFonts->RemoveAt(csTag);
654 } 653 }
655 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { 654 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) {
656 if (!pFormDict || csNameTag.IsEmpty()) { 655 if (!pFormDict || csNameTag.IsEmpty()) {
657 return; 656 return;
658 } 657 }
659 CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); 658 CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
660 if (!pDR) { 659 if (!pDR) {
661 return; 660 return;
662 } 661 }
663 CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); 662 CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
664 if (!pFonts) { 663 if (!pFonts) {
665 return; 664 return;
666 } 665 }
667 pFonts->RemoveAt(csNameTag.AsStringC()); 666 pFonts->RemoveAt(csNameTag);
668 } 667 }
669 668
670 CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, 669 CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict,
671 CPDF_Document* pDocument) { 670 CPDF_Document* pDocument) {
672 if (!pFormDict) { 671 if (!pFormDict) {
673 return NULL; 672 return NULL;
674 } 673 }
675 CPDF_DefaultAppearance cDA(pFormDict->GetStringBy("DA")); 674 CPDF_DefaultAppearance cDA(pFormDict->GetStringBy("DA"));
676 CFX_ByteString csFontNameTag; 675 CFX_ByteString csFontNameTag;
677 FX_FLOAT fFontSize; 676 FX_FLOAT fFontSize;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 CPDF_Object* pAttr = pFieldDict->GetDirectObjectBy(name); 745 CPDF_Object* pAttr = pFieldDict->GetDirectObjectBy(name);
747 if (pAttr) { 746 if (pAttr) {
748 return pAttr; 747 return pAttr;
749 } 748 }
750 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); 749 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent");
751 if (!pParent) { 750 if (!pParent) {
752 return NULL; 751 return NULL;
753 } 752 }
754 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); 753 return FPDF_GetFieldAttr(pParent, name, nLevel + 1);
755 } 754 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_tagged.cpp ('k') | fpdfsdk/formfiller/cba_fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698