1 /*
2 * Copyright 2013 Google Inc.
3
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkPdfFontDescriptorDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10
Type(SkPdfNativeDoc * doc)11 SkString SkPdfFontDescriptorDictionary::Type(SkPdfNativeDoc* doc) {
12 SkPdfNativeObject* ret = get("Type", "");
13 if (doc) {ret = doc->resolveReference(ret);}
14 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
15 // TODO(edisonn): warn about missing required field, assert for known good pdfs
16 return SkString();
17 }
18
has_Type() const19 bool SkPdfFontDescriptorDictionary::has_Type() const {
20 return get("Type", "") != NULL;
21 }
22
FontName(SkPdfNativeDoc * doc)23 SkString SkPdfFontDescriptorDictionary::FontName(SkPdfNativeDoc* doc) {
24 SkPdfNativeObject* ret = get("FontName", "");
25 if (doc) {ret = doc->resolveReference(ret);}
26 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
27 // TODO(edisonn): warn about missing required field, assert for known good pdfs
28 return SkString();
29 }
30
has_FontName() const31 bool SkPdfFontDescriptorDictionary::has_FontName() const {
32 return get("FontName", "") != NULL;
33 }
34
Flags(SkPdfNativeDoc * doc)35 int64_t SkPdfFontDescriptorDictionary::Flags(SkPdfNativeDoc* doc) {
36 SkPdfNativeObject* ret = get("Flags", "");
37 if (doc) {ret = doc->resolveReference(ret);}
38 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
39 // TODO(edisonn): warn about missing required field, assert for known good pdfs
40 return 0;
41 }
42
has_Flags() const43 bool SkPdfFontDescriptorDictionary::has_Flags() const {
44 return get("Flags", "") != NULL;
45 }
46
FontBBox(SkPdfNativeDoc * doc)47 SkRect SkPdfFontDescriptorDictionary::FontBBox(SkPdfNativeDoc* doc) {
48 SkPdfNativeObject* ret = get("FontBBox", "");
49 if (doc) {ret = doc->resolveReference(ret);}
50 if ((ret != NULL && ret->isRectangle()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->rectangleValue();
51 // TODO(edisonn): warn about missing required field, assert for known good pdfs
52 return SkRect::MakeEmpty();
53 }
54
has_FontBBox() const55 bool SkPdfFontDescriptorDictionary::has_FontBBox() const {
56 return get("FontBBox", "") != NULL;
57 }
58
ItalicAngle(SkPdfNativeDoc * doc)59 double SkPdfFontDescriptorDictionary::ItalicAngle(SkPdfNativeDoc* doc) {
60 SkPdfNativeObject* ret = get("ItalicAngle", "");
61 if (doc) {ret = doc->resolveReference(ret);}
62 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
63 // TODO(edisonn): warn about missing required field, assert for known good pdfs
64 return 0;
65 }
66
has_ItalicAngle() const67 bool SkPdfFontDescriptorDictionary::has_ItalicAngle() const {
68 return get("ItalicAngle", "") != NULL;
69 }
70
Ascent(SkPdfNativeDoc * doc)71 double SkPdfFontDescriptorDictionary::Ascent(SkPdfNativeDoc* doc) {
72 SkPdfNativeObject* ret = get("Ascent", "");
73 if (doc) {ret = doc->resolveReference(ret);}
74 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
75 // TODO(edisonn): warn about missing required field, assert for known good pdfs
76 return 0;
77 }
78
has_Ascent() const79 bool SkPdfFontDescriptorDictionary::has_Ascent() const {
80 return get("Ascent", "") != NULL;
81 }
82
Descent(SkPdfNativeDoc * doc)83 double SkPdfFontDescriptorDictionary::Descent(SkPdfNativeDoc* doc) {
84 SkPdfNativeObject* ret = get("Descent", "");
85 if (doc) {ret = doc->resolveReference(ret);}
86 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
87 // TODO(edisonn): warn about missing required field, assert for known good pdfs
88 return 0;
89 }
90
has_Descent() const91 bool SkPdfFontDescriptorDictionary::has_Descent() const {
92 return get("Descent", "") != NULL;
93 }
94
Leading(SkPdfNativeDoc * doc)95 double SkPdfFontDescriptorDictionary::Leading(SkPdfNativeDoc* doc) {
96 SkPdfNativeObject* ret = get("Leading", "");
97 if (doc) {ret = doc->resolveReference(ret);}
98 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
99 // TODO(edisonn): warn about missing default value for optional fields
100 return 0;
101 }
102
has_Leading() const103 bool SkPdfFontDescriptorDictionary::has_Leading() const {
104 return get("Leading", "") != NULL;
105 }
106
CapHeight(SkPdfNativeDoc * doc)107 double SkPdfFontDescriptorDictionary::CapHeight(SkPdfNativeDoc* doc) {
108 SkPdfNativeObject* ret = get("CapHeight", "");
109 if (doc) {ret = doc->resolveReference(ret);}
110 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
111 // TODO(edisonn): warn about missing required field, assert for known good pdfs
112 return 0;
113 }
114
has_CapHeight() const115 bool SkPdfFontDescriptorDictionary::has_CapHeight() const {
116 return get("CapHeight", "") != NULL;
117 }
118
XHeight(SkPdfNativeDoc * doc)119 double SkPdfFontDescriptorDictionary::XHeight(SkPdfNativeDoc* doc) {
120 SkPdfNativeObject* ret = get("XHeight", "");
121 if (doc) {ret = doc->resolveReference(ret);}
122 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
123 // TODO(edisonn): warn about missing default value for optional fields
124 return 0;
125 }
126
has_XHeight() const127 bool SkPdfFontDescriptorDictionary::has_XHeight() const {
128 return get("XHeight", "") != NULL;
129 }
130
StemV(SkPdfNativeDoc * doc)131 double SkPdfFontDescriptorDictionary::StemV(SkPdfNativeDoc* doc) {
132 SkPdfNativeObject* ret = get("StemV", "");
133 if (doc) {ret = doc->resolveReference(ret);}
134 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
135 // TODO(edisonn): warn about missing required field, assert for known good pdfs
136 return 0;
137 }
138
has_StemV() const139 bool SkPdfFontDescriptorDictionary::has_StemV() const {
140 return get("StemV", "") != NULL;
141 }
142
StemH(SkPdfNativeDoc * doc)143 double SkPdfFontDescriptorDictionary::StemH(SkPdfNativeDoc* doc) {
144 SkPdfNativeObject* ret = get("StemH", "");
145 if (doc) {ret = doc->resolveReference(ret);}
146 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
147 // TODO(edisonn): warn about missing default value for optional fields
148 return 0;
149 }
150
has_StemH() const151 bool SkPdfFontDescriptorDictionary::has_StemH() const {
152 return get("StemH", "") != NULL;
153 }
154
AvgWidth(SkPdfNativeDoc * doc)155 double SkPdfFontDescriptorDictionary::AvgWidth(SkPdfNativeDoc* doc) {
156 SkPdfNativeObject* ret = get("AvgWidth", "");
157 if (doc) {ret = doc->resolveReference(ret);}
158 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
159 // TODO(edisonn): warn about missing default value for optional fields
160 return 0;
161 }
162
has_AvgWidth() const163 bool SkPdfFontDescriptorDictionary::has_AvgWidth() const {
164 return get("AvgWidth", "") != NULL;
165 }
166
MaxWidth(SkPdfNativeDoc * doc)167 double SkPdfFontDescriptorDictionary::MaxWidth(SkPdfNativeDoc* doc) {
168 SkPdfNativeObject* ret = get("MaxWidth", "");
169 if (doc) {ret = doc->resolveReference(ret);}
170 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
171 // TODO(edisonn): warn about missing default value for optional fields
172 return 0;
173 }
174
has_MaxWidth() const175 bool SkPdfFontDescriptorDictionary::has_MaxWidth() const {
176 return get("MaxWidth", "") != NULL;
177 }
178
MissingWidth(SkPdfNativeDoc * doc)179 double SkPdfFontDescriptorDictionary::MissingWidth(SkPdfNativeDoc* doc) {
180 SkPdfNativeObject* ret = get("MissingWidth", "");
181 if (doc) {ret = doc->resolveReference(ret);}
182 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
183 // TODO(edisonn): warn about missing default value for optional fields
184 return 0;
185 }
186
has_MissingWidth() const187 bool SkPdfFontDescriptorDictionary::has_MissingWidth() const {
188 return get("MissingWidth", "") != NULL;
189 }
190
FontFile(SkPdfNativeDoc * doc)191 SkPdfStream* SkPdfFontDescriptorDictionary::FontFile(SkPdfNativeDoc* doc) {
192 SkPdfNativeObject* ret = get("FontFile", "");
193 if (doc) {ret = doc->resolveReference(ret);}
194 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
195 // TODO(edisonn): warn about missing default value for optional fields
196 return NULL;
197 }
198
has_FontFile() const199 bool SkPdfFontDescriptorDictionary::has_FontFile() const {
200 return get("FontFile", "") != NULL;
201 }
202
FontFile2(SkPdfNativeDoc * doc)203 SkPdfStream* SkPdfFontDescriptorDictionary::FontFile2(SkPdfNativeDoc* doc) {
204 SkPdfNativeObject* ret = get("FontFile2", "");
205 if (doc) {ret = doc->resolveReference(ret);}
206 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
207 // TODO(edisonn): warn about missing default value for optional fields
208 return NULL;
209 }
210
has_FontFile2() const211 bool SkPdfFontDescriptorDictionary::has_FontFile2() const {
212 return get("FontFile2", "") != NULL;
213 }
214
FontFile3(SkPdfNativeDoc * doc)215 SkPdfStream* SkPdfFontDescriptorDictionary::FontFile3(SkPdfNativeDoc* doc) {
216 SkPdfNativeObject* ret = get("FontFile3", "");
217 if (doc) {ret = doc->resolveReference(ret);}
218 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
219 // TODO(edisonn): warn about missing default value for optional fields
220 return NULL;
221 }
222
has_FontFile3() const223 bool SkPdfFontDescriptorDictionary::has_FontFile3() const {
224 return get("FontFile3", "") != NULL;
225 }
226
CharSet(SkPdfNativeDoc * doc)227 SkString SkPdfFontDescriptorDictionary::CharSet(SkPdfNativeDoc* doc) {
228 SkPdfNativeObject* ret = get("CharSet", "");
229 if (doc) {ret = doc->resolveReference(ret);}
230 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
231 // TODO(edisonn): warn about missing default value for optional fields
232 return SkString();
233 }
234
has_CharSet() const235 bool SkPdfFontDescriptorDictionary::has_CharSet() const {
236 return get("CharSet", "") != NULL;
237 }
238