OLD | NEW |
1 #ifndef __DEFINED__SkPdfType0FontDictionary | 1 #ifndef __DEFINED__SkPdfType0FontDictionary |
2 #define __DEFINED__SkPdfType0FontDictionary | 2 #define __DEFINED__SkPdfType0FontDictionary |
3 | 3 |
4 #include "SkPdfEnums_autogen.h" | 4 #include "SkPdfEnums_autogen.h" |
5 #include "SkPdfArray_autogen.h" | 5 #include "SkPdfArray_autogen.h" |
6 #include "SkPdfFontDictionary_autogen.h" | 6 #include "SkPdfFontDictionary_autogen.h" |
7 | 7 |
| 8 // Entries in a Type 0 font dictionary |
8 class SkPdfType0FontDictionary : public SkPdfFontDictionary { | 9 class SkPdfType0FontDictionary : public SkPdfFontDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kType0FontDictionary_SkPdfObj
ectType;} | 11 virtual SkPdfObjectType getType() const { return kType0FontDictionary_SkPdfObj
ectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType0Fo
ntDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType0Fo
ntDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return this;} | 14 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return this;} |
14 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return
this;} | 15 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return
this;} |
15 | 16 |
16 private: | 17 private: |
17 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return NULL;} | 18 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return NULL;} |
(...skipping 13 matching lines...) Expand all Loading... |
31 | 32 |
32 public: | 33 public: |
33 private: | 34 private: |
34 public: | 35 public: |
35 SkPdfType0FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} | 36 SkPdfType0FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} |
36 | 37 |
37 virtual bool valid() const {return true;} | 38 virtual bool valid() const {return true;} |
38 | 39 |
39 SkPdfType0FontDictionary& operator=(const SkPdfType0FontDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | 40 SkPdfType0FontDictionary& operator=(const SkPdfType0FontDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} |
40 | 41 |
| 42 /** (Required) The type of PDF object that this dictionary describes; must be |
| 43 * Font for a font dictionary. |
| 44 **/ |
| 45 bool has_Type() const { |
| 46 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
| 47 } |
| 48 |
41 std::string Type() const { | 49 std::string Type() const { |
42 std::string ret; | 50 std::string ret; |
43 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | 51 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; |
44 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 52 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
45 return ""; | 53 return ""; |
46 } | 54 } |
47 | 55 |
| 56 /** (Required) The type of font; must be Type0 for a Type 0 font. |
| 57 **/ |
| 58 bool has_Subtype() const { |
| 59 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); |
| 60 } |
| 61 |
48 std::string Subtype() const { | 62 std::string Subtype() const { |
49 std::string ret; | 63 std::string ret; |
50 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; | 64 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; |
51 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 65 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
52 return ""; | 66 return ""; |
53 } | 67 } |
54 | 68 |
| 69 /** (Required) The PostScript name of the font. In principle, this is an arbitra
ry |
| 70 * name, since there is no font program associated directly with a Type 0 font |
| 71 * dictionary. The conventions described here ensure maximum compatibility |
| 72 * with existing Acrobat products. |
| 73 * If the descendant is a Type 0 CIDFont, this name should be the concatenation |
| 74 * of the CIDFont's BaseFont name, a hyphen, and the CMap name given in the |
| 75 * Encoding entry (or the CMapName entry in the CMap program itself). If the |
| 76 * descendant is a Type 2 CIDFont, this name should be the same as the |
| 77 * CIDFont's BaseFont name. |
| 78 **/ |
| 79 bool has_BaseFont() const { |
| 80 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseF
ont", "", NULL)); |
| 81 } |
| 82 |
55 std::string BaseFont() const { | 83 std::string BaseFont() const { |
56 std::string ret; | 84 std::string ret; |
57 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont",
"", &ret)) return ret; | 85 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont",
"", &ret)) return ret; |
58 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 86 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
59 return ""; | 87 return ""; |
60 } | 88 } |
61 | 89 |
| 90 /** (Required) The name of a predefined CMap, or a stream containing a CMap |
| 91 * program, that maps character codes to font numbers and CIDs. If the descen- |
| 92 * dant is a Type 2 CIDFont whose associated TrueType font program is not em- |
| 93 * bedded in the PDF file, the Encoding entry must be a predefined CMap name |
| 94 * (see "Glyph Selection in CIDFonts" on page 339). |
| 95 **/ |
| 96 bool has_Encoding() const { |
| 97 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod
ing", "", NULL)); |
| 98 } |
| 99 |
62 bool isEncodingAName() const { | 100 bool isEncodingAName() const { |
63 SkPdfObject* ret = NULL; | 101 SkPdfObject* ret = NULL; |
64 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | 102 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; |
65 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 103 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
66 } | 104 } |
67 | 105 |
68 std::string getEncodingAsName() const { | 106 std::string getEncodingAsName() const { |
69 std::string ret = ""; | 107 std::string ret = ""; |
70 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding",
"", &ret)) return ret; | 108 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding",
"", &ret)) return ret; |
71 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 109 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
72 return ""; | 110 return ""; |
73 } | 111 } |
74 | 112 |
75 bool isEncodingAStream() const { | 113 bool isEncodingAStream() const { |
76 SkPdfObject* ret = NULL; | 114 SkPdfObject* ret = NULL; |
77 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | 115 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; |
78 return ret->podofo()->HasStream(); | 116 return ret->podofo()->HasStream(); |
79 } | 117 } |
80 | 118 |
81 SkPdfStream getEncodingAsStream() const { | 119 SkPdfStream getEncodingAsStream() const { |
82 SkPdfStream ret = SkPdfStream(); | 120 SkPdfStream ret = SkPdfStream(); |
83 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding"
, "", &ret)) return ret; | 121 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding"
, "", &ret)) return ret; |
84 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 122 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
85 return SkPdfStream(); | 123 return SkPdfStream(); |
86 } | 124 } |
87 | 125 |
| 126 /** (Required) An array specifying one or more fonts or CIDFonts that are |
| 127 * descendants of this composite font. This array is indexed by the font number |
| 128 * that is obtained by mapping a character code through the CMap specified in |
| 129 * the Encoding entry. |
| 130 * Note: In all PDF versions up to and including PDF 1.4, DescendantFonts must |
| 131 * be a one-element array containing a CIDFont dictionary. |
| 132 **/ |
| 133 bool has_DescendantFonts() const { |
| 134 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Desce
ndantFonts", "", NULL)); |
| 135 } |
| 136 |
88 SkPdfArray DescendantFonts() const { | 137 SkPdfArray DescendantFonts() const { |
89 SkPdfArray ret; | 138 SkPdfArray ret; |
90 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Descendant
Fonts", "", &ret)) return ret; | 139 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Descendant
Fonts", "", &ret)) return ret; |
91 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 140 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
92 return SkPdfArray(); | 141 return SkPdfArray(); |
93 } | 142 } |
94 | 143 |
| 144 /** (Optional) A stream containing a CMap file that maps character codes to |
| 145 * Unicode values (see Section 5.9, "ToUnicode CMaps"). |
| 146 **/ |
| 147 bool has_ToUnicode() const { |
| 148 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni
code", "", NULL)); |
| 149 } |
| 150 |
95 SkPdfStream ToUnicode() const { | 151 SkPdfStream ToUnicode() const { |
96 SkPdfStream ret; | 152 SkPdfStream ret; |
97 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode
", "", &ret)) return ret; | 153 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode
", "", &ret)) return ret; |
98 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 154 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
99 return SkPdfStream(); | 155 return SkPdfStream(); |
100 } | 156 } |
101 | 157 |
102 }; | 158 }; |
103 | 159 |
104 #endif // __DEFINED__SkPdfType0FontDictionary | 160 #endif // __DEFINED__SkPdfType0FontDictionary |
OLD | NEW |