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