OLD | NEW |
1 #ifndef __DEFINED__SkPdfFontDescriptorDictionary | 1 #ifndef __DEFINED__SkPdfFontDescriptorDictionary |
2 #define __DEFINED__SkPdfFontDescriptorDictionary | 2 #define __DEFINED__SkPdfFontDescriptorDictionary |
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 // Entries common to all font descriptors |
8 class SkPdfFontDescriptorDictionary : public SkPdfDictionary { | 9 class SkPdfFontDescriptorDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kFontDescriptorDictionary_SkP
dfObjectType;} | 11 virtual SkPdfObjectType getType() const { return kFontDescriptorDictionary_SkP
dfObjectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kFontDes
criptorDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kFontDes
criptorDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfFontDescriptorDictionary* asFontDescriptorDictionary() {return th
is;} | 14 virtual SkPdfFontDescriptorDictionary* asFontDescriptorDictionary() {return th
is;} |
14 virtual const SkPdfFontDescriptorDictionary* asFontDescriptorDictionary() cons
t {return this;} | 15 virtual const SkPdfFontDescriptorDictionary* asFontDescriptorDictionary() cons
t {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 SkPdfFontDescriptorDictionary(const PdfMemDocument* podofoDoc = NULL, const Pd
fObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfFontDescriptorDictionary(const PdfMemDocument* podofoDoc = NULL, const Pd
fObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfFontDescriptorDictionary& operator=(const SkPdfFontDescriptorDictionary&
from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; r
eturn *this;} | 523 SkPdfFontDescriptorDictionary& operator=(const SkPdfFontDescriptorDictionary&
from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; r
eturn *this;} |
523 | 524 |
| 525 /** (Required) The type of PDF object that this dictionary describes; must be |
| 526 * FontDescriptor for a font descriptor. |
| 527 **/ |
| 528 bool has_Type() const { |
| 529 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
| 530 } |
| 531 |
524 std::string Type() const { | 532 std::string Type() const { |
525 std::string ret; | 533 std::string ret; |
526 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | 534 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; |
527 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 535 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
528 return ""; | 536 return ""; |
529 } | 537 } |
530 | 538 |
| 539 /** (Required) The PostScript name of the font. This should be the same as the |
| 540 * value of BaseFont in the font or CIDFont dictionary that refers to this font |
| 541 * descriptor. |
| 542 **/ |
| 543 bool has_FontName() const { |
| 544 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontN
ame", "", NULL)); |
| 545 } |
| 546 |
531 std::string FontName() const { | 547 std::string FontName() const { |
532 std::string ret; | 548 std::string ret; |
533 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontName",
"", &ret)) return ret; | 549 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontName",
"", &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 collection of flags defining various characteristics of the fon
t |
| 555 * (see Section 5.7.1, "Font Descriptor Flags"). |
| 556 **/ |
| 557 bool has_Flags() const { |
| 558 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Flags
", "", NULL)); |
| 559 } |
| 560 |
538 long Flags() const { | 561 long Flags() const { |
539 long ret; | 562 long ret; |
540 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Flags", "",
&ret)) return ret; | 563 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Flags", "",
&ret)) return ret; |
541 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 564 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
542 return 0; | 565 return 0; |
543 } | 566 } |
544 | 567 |
| 568 /** (Required) A rectangle (see Section 3.8.3, "Rectangles"), expressed in the |
| 569 * glyph coordinate system, specifying the font bounding box. This is the small
- |
| 570 * est rectangle enclosing the shape that would result if all of the glyphs of
the |
| 571 * font were placed with their origins coincident and then filled. |
| 572 **/ |
| 573 bool has_FontBBox() const { |
| 574 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontB
Box", "", NULL)); |
| 575 } |
| 576 |
545 SkRect FontBBox() const { | 577 SkRect FontBBox() const { |
546 SkRect ret; | 578 SkRect ret; |
547 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontBBox"
, "", &ret)) return ret; | 579 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontBBox"
, "", &ret)) return ret; |
548 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 580 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
549 return SkRect(); | 581 return SkRect(); |
550 } | 582 } |
551 | 583 |
| 584 /** (Required) The angle, expressed in degrees counterclockwise from the verti- |
| 585 * cal, of the dominant vertical strokes of the font. (For example, the 9-o'clo
ck |
| 586 * position is 90 degrees, and the 3-o'clock position is '90 degrees.) The valu
e is |
| 587 * negative for fonts that slope to the right, as almost all italic fonts do. |
| 588 **/ |
| 589 bool has_ItalicAngle() const { |
| 590 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Itali
cAngle", "", NULL)); |
| 591 } |
| 592 |
552 double ItalicAngle() const { | 593 double ItalicAngle() const { |
553 double ret; | 594 double ret; |
554 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ItalicAng
le", "", &ret)) return ret; | 595 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ItalicAng
le", "", &ret)) return ret; |
555 // 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 |
556 return 0; | 597 return 0; |
557 } | 598 } |
558 | 599 |
| 600 /** (Required) The maximum height above the baseline reached by glyphs in this |
| 601 * font, excluding the height of glyphs for accented characters. |
| 602 **/ |
| 603 bool has_Ascent() const { |
| 604 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ascen
t", "", NULL)); |
| 605 } |
| 606 |
559 double Ascent() const { | 607 double Ascent() const { |
560 double ret; | 608 double ret; |
561 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ascent",
"", &ret)) return ret; | 609 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ascent",
"", &ret)) return ret; |
562 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 610 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
563 return 0; | 611 return 0; |
564 } | 612 } |
565 | 613 |
| 614 /** (Required) The maximum depth below the baseline reached by glyphs in this |
| 615 * font. The value is a negative number. |
| 616 **/ |
| 617 bool has_Descent() const { |
| 618 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Desce
nt", "", NULL)); |
| 619 } |
| 620 |
566 double Descent() const { | 621 double Descent() const { |
567 double ret; | 622 double ret; |
568 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Descent",
"", &ret)) return ret; | 623 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Descent",
"", &ret)) return ret; |
569 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 624 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
570 return 0; | 625 return 0; |
571 } | 626 } |
572 | 627 |
| 628 /** (Optional) The desired spacing between baselines of consecutive lines of tex
t. |
| 629 * Default value: 0. |
| 630 **/ |
| 631 bool has_Leading() const { |
| 632 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Leadi
ng", "", NULL)); |
| 633 } |
| 634 |
573 double Leading() const { | 635 double Leading() const { |
574 double ret; | 636 double ret; |
575 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Leading",
"", &ret)) return ret; | 637 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Leading",
"", &ret)) return ret; |
576 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 638 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
577 return 0; | 639 return 0; |
578 } | 640 } |
579 | 641 |
| 642 /** (Required) The vertical coordinate of the top of flat capital letters, measu
red |
| 643 * from the baseline. |
| 644 **/ |
| 645 bool has_CapHeight() const { |
| 646 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CapHe
ight", "", NULL)); |
| 647 } |
| 648 |
580 double CapHeight() const { | 649 double CapHeight() const { |
581 double ret; | 650 double ret; |
582 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CapHeight
", "", &ret)) return ret; | 651 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CapHeight
", "", &ret)) return ret; |
583 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 652 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
584 return 0; | 653 return 0; |
585 } | 654 } |
586 | 655 |
| 656 /** (Optional) The font's x height: the vertical coordinate of the top of flat n
on- |
| 657 * ascending lowercase letters (like the letter x), measured from the baseline. |
| 658 * Default value: 0. |
| 659 **/ |
| 660 bool has_XHeight() const { |
| 661 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "XHeig
ht", "", NULL)); |
| 662 } |
| 663 |
587 double XHeight() const { | 664 double XHeight() const { |
588 double ret; | 665 double ret; |
589 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "XHeight",
"", &ret)) return ret; | 666 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "XHeight",
"", &ret)) return ret; |
590 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 667 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
591 return 0; | 668 return 0; |
592 } | 669 } |
593 | 670 |
| 671 /** (Required) The thickness, measured horizontally, of the dominant vertical |
| 672 * stems of glyphs in the font. |
| 673 **/ |
| 674 bool has_StemV() const { |
| 675 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StemV
", "", NULL)); |
| 676 } |
| 677 |
594 double StemV() const { | 678 double StemV() const { |
595 double ret; | 679 double ret; |
596 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StemV", "
", &ret)) return ret; | 680 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StemV", "
", &ret)) return ret; |
597 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 681 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
598 return 0; | 682 return 0; |
599 } | 683 } |
600 | 684 |
| 685 /** (Optional) The thickness, measured invertically, of the dominant horizontal |
| 686 * stems of glyphs in the font. Default value: 0. |
| 687 **/ |
| 688 bool has_StemH() const { |
| 689 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StemH
", "", NULL)); |
| 690 } |
| 691 |
601 double StemH() const { | 692 double StemH() const { |
602 double ret; | 693 double ret; |
603 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StemH", "
", &ret)) return ret; | 694 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StemH", "
", &ret)) return ret; |
604 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 695 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
605 return 0; | 696 return 0; |
606 } | 697 } |
607 | 698 |
| 699 /** (Optional) The average width of glyphs in the font. Default value: 0. |
| 700 **/ |
| 701 bool has_AvgWidth() const { |
| 702 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AvgWi
dth", "", NULL)); |
| 703 } |
| 704 |
608 double AvgWidth() const { | 705 double AvgWidth() const { |
609 double ret; | 706 double ret; |
610 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AvgWidth"
, "", &ret)) return ret; | 707 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AvgWidth"
, "", &ret)) return ret; |
611 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 708 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
612 return 0; | 709 return 0; |
613 } | 710 } |
614 | 711 |
| 712 /** (Optional) The maximum width of glyphs in the font. Default value: 0. |
| 713 **/ |
| 714 bool has_MaxWidth() const { |
| 715 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "MaxWi
dth", "", NULL)); |
| 716 } |
| 717 |
615 double MaxWidth() const { | 718 double MaxWidth() const { |
616 double ret; | 719 double ret; |
617 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "MaxWidth"
, "", &ret)) return ret; | 720 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "MaxWidth"
, "", &ret)) return ret; |
618 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 721 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
619 return 0; | 722 return 0; |
620 } | 723 } |
621 | 724 |
| 725 /** (Optional) The width to use for character codes whose widths are not speci- |
| 726 * fied in a font dictionary's Widths array. This has a predictable effect only
if all |
| 727 * such codes map to glyphs whose actual widths are the same as the Missing- |
| 728 * Width value. Default value: 0. |
| 729 **/ |
| 730 bool has_MissingWidth() const { |
| 731 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Missi
ngWidth", "", NULL)); |
| 732 } |
| 733 |
622 double MissingWidth() const { | 734 double MissingWidth() const { |
623 double ret; | 735 double ret; |
624 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "MissingWi
dth", "", &ret)) return ret; | 736 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "MissingWi
dth", "", &ret)) return ret; |
625 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 737 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
626 return 0; | 738 return 0; |
627 } | 739 } |
628 | 740 |
| 741 /** (Optional) A stream containing a Type 1 font program (see Section 5.8, |
| 742 * "Embedded Font Programs"). |
| 743 **/ |
| 744 bool has_FontFile() const { |
| 745 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontF
ile", "", NULL)); |
| 746 } |
| 747 |
629 SkPdfStream FontFile() const { | 748 SkPdfStream FontFile() const { |
630 SkPdfStream ret; | 749 SkPdfStream ret; |
631 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontFile"
, "", &ret)) return ret; | 750 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontFile"
, "", &ret)) return ret; |
632 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 751 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
633 return SkPdfStream(); | 752 return SkPdfStream(); |
634 } | 753 } |
635 | 754 |
| 755 /** (Optional; PDF 1.1) A stream containing a TrueType font program (see Sec- |
| 756 * tion 5.8, "Embedded Font Programs"). |
| 757 **/ |
| 758 bool has_FontFile2() const { |
| 759 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontF
ile2", "", NULL)); |
| 760 } |
| 761 |
636 SkPdfStream FontFile2() const { | 762 SkPdfStream FontFile2() const { |
637 SkPdfStream ret; | 763 SkPdfStream ret; |
638 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontFile2
", "", &ret)) return ret; | 764 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontFile2
", "", &ret)) return ret; |
639 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 765 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
640 return SkPdfStream(); | 766 return SkPdfStream(); |
641 } | 767 } |
642 | 768 |
| 769 /** (Optional; PDF 1.2) A stream containing a font program other than Type 1 or |
| 770 * TrueType. The format of the font program is specified by the Subtype entry |
| 771 * in the stream dictionary (see Section 5.8, "Embedded Font Programs," and |
| 772 * implementation note 49 in Appendix H). |
| 773 * At most, only one of the FontFile, FontFile2, and FontFile3 entries may be |
| 774 * present. |
| 775 **/ |
| 776 bool has_FontFile3() const { |
| 777 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontF
ile3", "", NULL)); |
| 778 } |
| 779 |
643 SkPdfStream FontFile3() const { | 780 SkPdfStream FontFile3() const { |
644 SkPdfStream ret; | 781 SkPdfStream ret; |
645 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontFile3
", "", &ret)) return ret; | 782 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontFile3
", "", &ret)) return ret; |
646 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 783 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
647 return SkPdfStream(); | 784 return SkPdfStream(); |
648 } | 785 } |
649 | 786 |
| 787 /** (Optional; meaningful only in Type 1 fonts; PDF 1.1) A string listing the ch
ar- |
| 788 * acter names defined in a font subset. The names in this string must be in PD
F |
| 789 * syntax-that is, each name preceded by a slash (/). The names can appear in |
| 790 * any order. The name .notdef should be omitted; it is assumed to exist in the |
| 791 * font subset. If this entry is absent, the only indication of a font subset i
s the |
| 792 * subset tag in the FontName entry (see Section 5.5.3, "Font Subsets"). |
| 793 **/ |
| 794 bool has_CharSet() const { |
| 795 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CharS
et", "", NULL)); |
| 796 } |
| 797 |
650 std::string CharSet() const { | 798 std::string CharSet() const { |
651 std::string ret; | 799 std::string ret; |
652 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CharSet",
"", &ret)) return ret; | 800 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CharSet",
"", &ret)) return ret; |
653 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 801 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
654 return ""; | 802 return ""; |
655 } | 803 } |
656 | 804 |
657 }; | 805 }; |
658 | 806 |
659 #endif // __DEFINED__SkPdfFontDescriptorDictionary | 807 #endif // __DEFINED__SkPdfFontDescriptorDictionary |
OLD | NEW |