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 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 19 bool SkPdfFontDescriptorDictionary::has_Type() const { 20 return get("Type", "") != NULL; 21 } 22 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 31 bool SkPdfFontDescriptorDictionary::has_FontName() const { 32 return get("FontName", "") != NULL; 33 } 34 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 43 bool SkPdfFontDescriptorDictionary::has_Flags() const { 44 return get("Flags", "") != NULL; 45 } 46 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 55 bool SkPdfFontDescriptorDictionary::has_FontBBox() const { 56 return get("FontBBox", "") != NULL; 57 } 58 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 67 bool SkPdfFontDescriptorDictionary::has_ItalicAngle() const { 68 return get("ItalicAngle", "") != NULL; 69 } 70 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 79 bool SkPdfFontDescriptorDictionary::has_Ascent() const { 80 return get("Ascent", "") != NULL; 81 } 82 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 91 bool SkPdfFontDescriptorDictionary::has_Descent() const { 92 return get("Descent", "") != NULL; 93 } 94 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 103 bool SkPdfFontDescriptorDictionary::has_Leading() const { 104 return get("Leading", "") != NULL; 105 } 106 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 115 bool SkPdfFontDescriptorDictionary::has_CapHeight() const { 116 return get("CapHeight", "") != NULL; 117 } 118 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 127 bool SkPdfFontDescriptorDictionary::has_XHeight() const { 128 return get("XHeight", "") != NULL; 129 } 130 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 139 bool SkPdfFontDescriptorDictionary::has_StemV() const { 140 return get("StemV", "") != NULL; 141 } 142 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 151 bool SkPdfFontDescriptorDictionary::has_StemH() const { 152 return get("StemH", "") != NULL; 153 } 154 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 163 bool SkPdfFontDescriptorDictionary::has_AvgWidth() const { 164 return get("AvgWidth", "") != NULL; 165 } 166 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 175 bool SkPdfFontDescriptorDictionary::has_MaxWidth() const { 176 return get("MaxWidth", "") != NULL; 177 } 178 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 187 bool SkPdfFontDescriptorDictionary::has_MissingWidth() const { 188 return get("MissingWidth", "") != NULL; 189 } 190 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 199 bool SkPdfFontDescriptorDictionary::has_FontFile() const { 200 return get("FontFile", "") != NULL; 201 } 202 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 211 bool SkPdfFontDescriptorDictionary::has_FontFile2() const { 212 return get("FontFile2", "") != NULL; 213 } 214 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 223 bool SkPdfFontDescriptorDictionary::has_FontFile3() const { 224 return get("FontFile3", "") != NULL; 225 } 226 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 235 bool SkPdfFontDescriptorDictionary::has_CharSet() const { 236 return get("CharSet", "") != NULL; 237 } 238