OLD | NEW |
1 #ifndef __DEFINED__SkPdfCMapDictionary | 1 #ifndef __DEFINED__SkPdfCMapDictionary |
2 #define __DEFINED__SkPdfCMapDictionary | 2 #define __DEFINED__SkPdfCMapDictionary |
3 | 3 |
4 #include "SkPdfUtils.h" | 4 #include "SkPdfUtils.h" |
5 #include "SkPdfEnums_autogen.h" | 5 #include "SkPdfEnums_autogen.h" |
6 #include "SkPdfArray_autogen.h" | 6 #include "SkPdfArray_autogen.h" |
7 #include "SkPdfDictionary_autogen.h" | 7 #include "SkPdfDictionary_autogen.h" |
8 | 8 |
9 // Additional entries in a CMap dictionary | 9 // Additional entries in a CMap dictionary |
10 class SkPdfCMapDictionary : public SkPdfDictionary { | 10 class SkPdfCMapDictionary : public SkPdfDictionary { |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 SkPdfCMapDictionary& operator=(const SkPdfCMapDictionary& from) {this->fPodofo
Doc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} | 526 SkPdfCMapDictionary& operator=(const SkPdfCMapDictionary& from) {this->fPodofo
Doc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} |
527 | 527 |
528 /** (Required) The type of PDF object that this dictionary describes; must be | 528 /** (Required) The type of PDF object that this dictionary describes; must be |
529 * CMap for a CMap dictionary. (Note that although this object is the value of | 529 * CMap for a CMap dictionary. (Note that although this object is the value of |
530 * an entry named Encoding in a Type 0 font, its type is CMap.) | 530 * an entry named Encoding in a Type 0 font, its type is CMap.) |
531 **/ | 531 **/ |
532 bool has_Type() const { | 532 bool has_Type() const { |
533 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | 533 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
534 } | 534 } |
535 | 535 |
536 std::string Type() const { | 536 std::string Type() const; |
537 std::string ret; | |
538 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | |
539 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
540 return ""; | |
541 } | |
542 | |
543 /** (Required) The PostScript name of the CMap. This should be the same as the | 537 /** (Required) The PostScript name of the CMap. This should be the same as the |
544 * value of CMapName in the CMap file itself. | 538 * value of CMapName in the CMap file itself. |
545 **/ | 539 **/ |
546 bool has_CMapName() const { | 540 bool has_CMapName() const { |
547 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CMapN
ame", "", NULL)); | 541 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CMapN
ame", "", NULL)); |
548 } | 542 } |
549 | 543 |
550 std::string CMapName() const { | 544 std::string CMapName() const; |
551 std::string ret; | |
552 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CMapName",
"", &ret)) return ret; | |
553 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
554 return ""; | |
555 } | |
556 | |
557 /** (Required) A dictionary or array containing entries that define the characte
r | 545 /** (Required) A dictionary or array containing entries that define the characte
r |
558 * collection for the CIDFont or CIDFonts associated with the CMap. If the | 546 * collection for the CIDFont or CIDFonts associated with the CMap. If the |
559 * CMap selects only font number 0 and specifies character selectors that are | 547 * CMap selects only font number 0 and specifies character selectors that are |
560 * CIDs, this entry can be a dictionary identifying the character collection fo
r | 548 * CIDs, this entry can be a dictionary identifying the character collection fo
r |
561 * the associated CIDFont. Otherwise, it is an array indexed by the font num- | 549 * the associated CIDFont. Otherwise, it is an array indexed by the font num- |
562 * ber. If the character selectors for a given font number are CIDs, the corre- | 550 * ber. If the character selectors for a given font number are CIDs, the corre- |
563 * sponding array element is a dictionary identifying the character collection | 551 * sponding array element is a dictionary identifying the character collection |
564 * for the associated CIDFont. If the character selectors are names or codes (t
o | 552 * for the associated CIDFont. If the character selectors are names or codes (t
o |
565 * be used with an associated font, not a CIDFont), the array element should | 553 * be used with an associated font, not a CIDFont), the array element should |
566 * be null. For details of the CIDSystemInfo dictionaries, see Section 5.6.2, | 554 * be null. For details of the CIDSystemInfo dictionaries, see Section 5.6.2, |
567 * "CIDSystemInfo Dictionaries." | 555 * "CIDSystemInfo Dictionaries." |
568 * Note: In all PDF versions up to and including PDF 1.4, CIDSystemInfo must be | 556 * Note: In all PDF versions up to and including PDF 1.4, CIDSystemInfo must be |
569 * either a dictionary or a one-element array containing a dictionary. | 557 * either a dictionary or a one-element array containing a dictionary. |
570 * The value of this entry should be the same as the value of CIDSystemInfo in | 558 * The value of this entry should be the same as the value of CIDSystemInfo in |
571 * the CMap file itself. | 559 * the CMap file itself. |
572 **/ | 560 **/ |
573 bool has_CIDSystemInfo() const { | 561 bool has_CIDSystemInfo() const { |
574 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy
stemInfo", "", NULL)); | 562 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy
stemInfo", "", NULL)); |
575 } | 563 } |
576 | 564 |
577 bool isCIDSystemInfoADictionary() const { | 565 bool isCIDSystemInfoADictionary() const { |
578 SkPdfObject* ret = NULL; | 566 SkPdfObject* ret = NULL; |
579 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSyste
mInfo", "", &ret)) return false; | 567 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSyste
mInfo", "", &ret)) return false; |
580 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; | 568 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; |
581 } | 569 } |
582 | 570 |
583 SkPdfDictionary* getCIDSystemInfoAsDictionary() const { | 571 SkPdfDictionary* getCIDSystemInfoAsDictionary() const; |
584 SkPdfDictionary* ret = NULL; | |
585 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy
stemInfo", "", &ret)) return ret; | |
586 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
587 return NULL; | |
588 } | |
589 | |
590 bool isCIDSystemInfoAArray() const { | 572 bool isCIDSystemInfoAArray() const { |
591 SkPdfObject* ret = NULL; | 573 SkPdfObject* ret = NULL; |
592 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSyste
mInfo", "", &ret)) return false; | 574 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSyste
mInfo", "", &ret)) return false; |
593 return ret->podofo()->GetDataType() == ePdfDataType_Array; | 575 return ret->podofo()->GetDataType() == ePdfDataType_Array; |
594 } | 576 } |
595 | 577 |
596 SkPdfArray* getCIDSystemInfoAsArray() const { | 578 SkPdfArray* getCIDSystemInfoAsArray() const; |
597 SkPdfArray* ret = NULL; | |
598 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSystemI
nfo", "", &ret)) return ret; | |
599 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
600 return NULL; | |
601 } | |
602 | |
603 /** (Optional) A code that determines the writing mode for any CIDFont with | 579 /** (Optional) A code that determines the writing mode for any CIDFont with |
604 * which this CMap is combined: | 580 * which this CMap is combined: |
605 * 0 Horizontal | 581 * 0 Horizontal |
606 * 1 Vertical | 582 * 1 Vertical |
607 * Default value: 0. | 583 * Default value: 0. |
608 * The value of this entry should be the same as the value of WMode in the | 584 * The value of this entry should be the same as the value of WMode in the |
609 * CMap file itself. | 585 * CMap file itself. |
610 **/ | 586 **/ |
611 bool has_WMode() const { | 587 bool has_WMode() const { |
612 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "WMode
", "", NULL)); | 588 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "WMode
", "", NULL)); |
613 } | 589 } |
614 | 590 |
615 long WMode() const { | 591 long WMode() const; |
616 long ret; | |
617 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "WMode", "",
&ret)) return ret; | |
618 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
619 return 0; | |
620 } | |
621 | |
622 /** (Optional) The name of a predefined CMap, or a stream containing a CMap, | 592 /** (Optional) The name of a predefined CMap, or a stream containing a CMap, |
623 * that is to be used as the base for this CMap. This allows the CMap to be de- | 593 * that is to be used as the base for this CMap. This allows the CMap to be de- |
624 * fined differentially, specifying only the character mappings that differ fro
m | 594 * fined differentially, specifying only the character mappings that differ fro
m |
625 * the base CMap. | 595 * the base CMap. |
626 **/ | 596 **/ |
627 bool has_UseCMap() const { | 597 bool has_UseCMap() const { |
628 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCM
ap", "", NULL)); | 598 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCM
ap", "", NULL)); |
629 } | 599 } |
630 | 600 |
631 bool isUseCMapAName() const { | 601 bool isUseCMapAName() const { |
632 SkPdfObject* ret = NULL; | 602 SkPdfObject* ret = NULL; |
633 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCMap"
, "", &ret)) return false; | 603 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCMap"
, "", &ret)) return false; |
634 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 604 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
635 } | 605 } |
636 | 606 |
637 std::string getUseCMapAsName() const { | 607 std::string getUseCMapAsName() const; |
638 std::string ret = ""; | |
639 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCMap", "
", &ret)) return ret; | |
640 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
641 return ""; | |
642 } | |
643 | |
644 bool isUseCMapAStream() const { | 608 bool isUseCMapAStream() const { |
645 SkPdfObject* ret = NULL; | 609 SkPdfObject* ret = NULL; |
646 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCMap"
, "", &ret)) return false; | 610 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCMap"
, "", &ret)) return false; |
647 return ret->podofo()->HasStream(); | 611 return ret->podofo()->HasStream(); |
648 } | 612 } |
649 | 613 |
650 SkPdfStream* getUseCMapAsStream() const { | 614 SkPdfStream* getUseCMapAsStream() const; |
651 SkPdfStream* ret = NULL; | |
652 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UseCMap",
"", &ret)) return ret; | |
653 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
654 return NULL; | |
655 } | |
656 | |
657 }; | 615 }; |
658 | 616 |
659 #endif // __DEFINED__SkPdfCMapDictionary | 617 #endif // __DEFINED__SkPdfCMapDictionary |
OLD | NEW |