OLD | NEW |
1 #ifndef __DEFINED__SkPdfType3FontDictionary | 1 #ifndef __DEFINED__SkPdfType3FontDictionary |
2 #define __DEFINED__SkPdfType3FontDictionary | 2 #define __DEFINED__SkPdfType3FontDictionary |
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 "SkPdfType1FontDictionary_autogen.h" | 7 #include "SkPdfType1FontDictionary_autogen.h" |
8 | 8 |
9 // Entries in a Type 3 font dictionary | 9 // Entries in a Type 3 font dictionary |
10 class SkPdfType3FontDictionary : public SkPdfType1FontDictionary { | 10 class SkPdfType3FontDictionary : public SkPdfType1FontDictionary { |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 SkPdfType3FontDictionary& operator=(const SkPdfType3FontDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | 34 SkPdfType3FontDictionary& operator=(const SkPdfType3FontDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} |
35 | 35 |
36 /** (Required) The type of PDF object that this dictionary describes; must be | 36 /** (Required) The type of PDF object that this dictionary describes; must be |
37 * Font for a font dictionary. | 37 * Font for a font dictionary. |
38 **/ | 38 **/ |
39 bool has_Type() const { | 39 bool has_Type() const { |
40 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | 40 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
41 } | 41 } |
42 | 42 |
43 std::string Type() const { | 43 std::string Type() const; |
44 std::string ret; | |
45 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | |
46 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
47 return ""; | |
48 } | |
49 | |
50 /** (Required) The type of font; must be Type3 for a Type 3 font. | 44 /** (Required) The type of font; must be Type3 for a Type 3 font. |
51 **/ | 45 **/ |
52 bool has_Subtype() const { | 46 bool has_Subtype() const { |
53 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); | 47 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); |
54 } | 48 } |
55 | 49 |
56 std::string Subtype() const { | 50 std::string Subtype() const; |
57 std::string ret; | |
58 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; | |
59 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
60 return ""; | |
61 } | |
62 | |
63 /** (Required in PDF 1.0; optional otherwise) See Table 5.8 on page 317. | 51 /** (Required in PDF 1.0; optional otherwise) See Table 5.8 on page 317. |
64 **/ | 52 **/ |
65 bool has_Name() const { | 53 bool has_Name() const { |
66 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); | 54 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); |
67 } | 55 } |
68 | 56 |
69 std::string Name() const { | 57 std::string Name() const; |
70 std::string ret; | |
71 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "",
&ret)) return ret; | |
72 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
73 return ""; | |
74 } | |
75 | |
76 /** (Required) A rectangle (see Section 3.8.3, "Rectangles"), expressed in the | 58 /** (Required) A rectangle (see Section 3.8.3, "Rectangles"), expressed in the |
77 * glyph coordinate system, specifying the font bounding box. This is the small
- | 59 * glyph coordinate system, specifying the font bounding box. This is the small
- |
78 * est rectangle enclosing the shape that would result if all of the glyphs of
the | 60 * est rectangle enclosing the shape that would result if all of the glyphs of
the |
79 * font were placed with their origins coincident and then filled. | 61 * font were placed with their origins coincident and then filled. |
80 * If all four elements of the rectangle are zero, no assumptions are made base
d | 62 * If all four elements of the rectangle are zero, no assumptions are made base
d |
81 * on the font bounding box. If any element is nonzero, it is essential that th
e | 63 * on the font bounding box. If any element is nonzero, it is essential that th
e |
82 * font bounding box be accurate; if any glyph's marks fall outside this bound- | 64 * font bounding box be accurate; if any glyph's marks fall outside this bound- |
83 * ing box, incorrect behavior may result. | 65 * ing box, incorrect behavior may result. |
84 **/ | 66 **/ |
85 bool has_FontBBox() const { | 67 bool has_FontBBox() const { |
86 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontB
Box", "", NULL)); | 68 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontB
Box", "", NULL)); |
87 } | 69 } |
88 | 70 |
89 SkRect* FontBBox() const { | 71 SkRect* FontBBox() const; |
90 SkRect* ret; | |
91 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontBBox"
, "", &ret)) return ret; | |
92 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
93 return NULL; | |
94 } | |
95 | |
96 /** (Required) An array of six numbers specifying the font matrix, mapping | 72 /** (Required) An array of six numbers specifying the font matrix, mapping |
97 * glyph space to text space (see Section 5.1.3, "Glyph Positioning and | 73 * glyph space to text space (see Section 5.1.3, "Glyph Positioning and |
98 * Metrics"). A common practice is to define glyphs in terms of a 1000-unit | 74 * Metrics"). A common practice is to define glyphs in terms of a 1000-unit |
99 * glyph coordinate system, in which case the font matrix
is | 75 * glyph coordinate system, in which case the font matrix
is |
100 * [0.001 0 0 0.001 0 0]. | 76 * [0.001 0 0 0.001 0 0]. |
101 **/ | 77 **/ |
102 bool has_FontMatrix() const { | 78 bool has_FontMatrix() const { |
103 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontM
atrix", "", NULL)); | 79 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontM
atrix", "", NULL)); |
104 } | 80 } |
105 | 81 |
106 SkMatrix* FontMatrix() const { | 82 SkMatrix* FontMatrix() const; |
107 SkMatrix* ret; | |
108 if (SkMatrixFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontMat
rix", "", &ret)) return ret; | |
109 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
110 return NULL; | |
111 } | |
112 | |
113 /** (Required) A dictionary in which each key is a character name and the value | 83 /** (Required) A dictionary in which each key is a character name and the value |
114 * associated with that key is a content stream that constructs and paints the | 84 * associated with that key is a content stream that constructs and paints the |
115 * glyph for that character. The stream must include as its first operator eith
er | 85 * glyph for that character. The stream must include as its first operator eith
er |
116 * d0 or d1. This is followed by operators describing one or more graphics | 86 * d0 or d1. This is followed by operators describing one or more graphics |
117 * objects, which may include path, text, or image objects. See below for more | 87 * objects, which may include path, text, or image objects. See below for more |
118 * details about Type 3 glyph descriptions. | 88 * details about Type 3 glyph descriptions. |
119 **/ | 89 **/ |
120 bool has_CharProcs() const { | 90 bool has_CharProcs() const { |
121 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CharP
rocs", "", NULL)); | 91 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CharP
rocs", "", NULL)); |
122 } | 92 } |
123 | 93 |
124 SkPdfDictionary* CharProcs() const { | 94 SkPdfDictionary* CharProcs() const; |
125 SkPdfDictionary* ret; | |
126 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CharP
rocs", "", &ret)) return ret; | |
127 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
128 return NULL; | |
129 } | |
130 | |
131 /** (Required) An encoding dictionary whose Differences array specifies the | 95 /** (Required) An encoding dictionary whose Differences array specifies the |
132 * complete character encoding for this font (see Section 5.5.5, "Character | 96 * complete character encoding for this font (see Section 5.5.5, "Character |
133 * Encoding"; also see implementation note 46 in Appendix H). | 97 * Encoding"; also see implementation note 46 in Appendix H). |
134 **/ | 98 **/ |
135 bool has_Encoding() const { | 99 bool has_Encoding() const { |
136 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod
ing", "", NULL)); | 100 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod
ing", "", NULL)); |
137 } | 101 } |
138 | 102 |
139 bool isEncodingAName() const { | 103 bool isEncodingAName() const { |
140 SkPdfObject* ret = NULL; | 104 SkPdfObject* ret = NULL; |
141 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | 105 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; |
142 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 106 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
143 } | 107 } |
144 | 108 |
145 std::string getEncodingAsName() const { | 109 std::string getEncodingAsName() const; |
146 std::string ret = ""; | |
147 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding",
"", &ret)) return ret; | |
148 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
149 return ""; | |
150 } | |
151 | |
152 bool isEncodingAEncodingdictionary() const { | 110 bool isEncodingAEncodingdictionary() const { |
153 SkPdfObject* ret = NULL; | 111 SkPdfObject* ret = NULL; |
154 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; | 112 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding
", "", &ret)) return false; |
155 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; | 113 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; |
156 } | 114 } |
157 | 115 |
158 SkPdfEncodingDictionary* getEncodingAsEncodingdictionary() const { | 116 SkPdfEncodingDictionary* getEncodingAsEncodingdictionary() const; |
159 SkPdfEncodingDictionary* ret = NULL; | |
160 if (DictionaryFromDictionary2(fPodofoDoc, fPodofoObj->GetDictionary(), "Enco
ding", "", &ret)) return ret; | |
161 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
162 return NULL; | |
163 } | |
164 | |
165 /** (Required) The first character code defined in the font's Widths array. | 117 /** (Required) The first character code defined in the font's Widths array. |
166 **/ | 118 **/ |
167 bool has_FirstChar() const { | 119 bool has_FirstChar() const { |
168 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First
Char", "", NULL)); | 120 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First
Char", "", NULL)); |
169 } | 121 } |
170 | 122 |
171 long FirstChar() const { | 123 long FirstChar() const; |
172 long ret; | |
173 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FirstChar",
"", &ret)) return ret; | |
174 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
175 return 0; | |
176 } | |
177 | |
178 /** (Required) The last character code defined in the font's Widths array. | 124 /** (Required) The last character code defined in the font's Widths array. |
179 **/ | 125 **/ |
180 bool has_LastChar() const { | 126 bool has_LastChar() const { |
181 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastC
har", "", NULL)); | 127 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastC
har", "", NULL)); |
182 } | 128 } |
183 | 129 |
184 long LastChar() const { | 130 long LastChar() const; |
185 long ret; | |
186 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastChar",
"", &ret)) return ret; | |
187 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
188 return 0; | |
189 } | |
190 | |
191 /** (Required; indirect reference preferred) An array of (LastChar - FirstChar +
1) | 131 /** (Required; indirect reference preferred) An array of (LastChar - FirstChar +
1) |
192 * widths, each element being the glyph width for the character whose code is | 132 * widths, each element being the glyph width for the character whose code is |
193 * FirstChar plus the array index. For character codes outside the range FirstC
har | 133 * FirstChar plus the array index. For character codes outside the range FirstC
har |
194 * to LastChar, the width is 0. These widths are interpreted in glyph space as | 134 * to LastChar, the width is 0. These widths are interpreted in glyph space as |
195 * specified by FontMatrix (unlike the widths of a Type 1 font, which are in | 135 * specified by FontMatrix (unlike the widths of a Type 1 font, which are in |
196 * thousandths of a unit of text space). | 136 * thousandths of a unit of text space). |
197 * Note: If FontMatrix specifies a rotation, only the horizontal component of t
he | 137 * Note: If FontMatrix specifies a rotation, only the horizontal component of t
he |
198 * transformed width is used. That is, the resulting displacement is always hor
izon- | 138 * transformed width is used. That is, the resulting displacement is always hor
izon- |
199 * tal in text space, as is the case for all simple fonts. | 139 * tal in text space, as is the case for all simple fonts. |
200 **/ | 140 **/ |
201 bool has_Widths() const { | 141 bool has_Widths() const { |
202 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width
s", "", NULL)); | 142 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width
s", "", NULL)); |
203 } | 143 } |
204 | 144 |
205 SkPdfArray* Widths() const { | 145 SkPdfArray* Widths() const; |
206 SkPdfArray* ret; | |
207 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Widths", "
", &ret)) return ret; | |
208 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
209 return NULL; | |
210 } | |
211 | |
212 /** (Optional but strongly recommended; PDF 1.2) A list of the named resources, | 146 /** (Optional but strongly recommended; PDF 1.2) A list of the named resources, |
213 * such as fonts and images, required by the glyph descriptions in this font (s
ee | 147 * such as fonts and images, required by the glyph descriptions in this font (s
ee |
214 * Section 3.7.2, "Resource Dictionaries"). If any glyph descriptions refer to | 148 * Section 3.7.2, "Resource Dictionaries"). If any glyph descriptions refer to |
215 * named resources but this dictionary is absent, the names are looked up in th
e | 149 * named resources but this dictionary is absent, the names are looked up in th
e |
216 * resource dictionary of the page on which the font is used. (See implementa- | 150 * resource dictionary of the page on which the font is used. (See implementa- |
217 * tion note 47 in Appendix H.) | 151 * tion note 47 in Appendix H.) |
218 **/ | 152 **/ |
219 bool has_Resources() const { | 153 bool has_Resources() const { |
220 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", NULL)); | 154 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", NULL)); |
221 } | 155 } |
222 | 156 |
223 SkPdfDictionary* Resources() const { | 157 SkPdfDictionary* Resources() const; |
224 SkPdfDictionary* ret; | |
225 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", &ret)) return ret; | |
226 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
227 return NULL; | |
228 } | |
229 | |
230 /** (Optional; PDF 1.2) A stream containing a CMap file that maps character | 158 /** (Optional; PDF 1.2) A stream containing a CMap file that maps character |
231 * codes to Unicode values (see Section 5.9, "ToUnicode CMaps"). | 159 * codes to Unicode values (see Section 5.9, "ToUnicode CMaps"). |
232 **/ | 160 **/ |
233 bool has_ToUnicode() const { | 161 bool has_ToUnicode() const { |
234 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni
code", "", NULL)); | 162 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni
code", "", NULL)); |
235 } | 163 } |
236 | 164 |
237 SkPdfStream* ToUnicode() const { | 165 SkPdfStream* ToUnicode() const; |
238 SkPdfStream* ret; | |
239 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode
", "", &ret)) return ret; | |
240 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
241 return NULL; | |
242 } | |
243 | |
244 }; | 166 }; |
245 | 167 |
246 #endif // __DEFINED__SkPdfType3FontDictionary | 168 #endif // __DEFINED__SkPdfType3FontDictionary |
OLD | NEW |