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 "SkPdfType0FontDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10
Type(SkPdfNativeDoc * doc)11 SkString SkPdfType0FontDictionary::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 SkPdfType0FontDictionary::has_Type() const {
20 return get("Type", "") != NULL;
21 }
22
Subtype(SkPdfNativeDoc * doc)23 SkString SkPdfType0FontDictionary::Subtype(SkPdfNativeDoc* doc) {
24 SkPdfNativeObject* ret = get("Subtype", "");
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_Subtype() const31 bool SkPdfType0FontDictionary::has_Subtype() const {
32 return get("Subtype", "") != NULL;
33 }
34
BaseFont(SkPdfNativeDoc * doc)35 SkString SkPdfType0FontDictionary::BaseFont(SkPdfNativeDoc* doc) {
36 SkPdfNativeObject* ret = get("BaseFont", "");
37 if (doc) {ret = doc->resolveReference(ret);}
38 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
39 // TODO(edisonn): warn about missing required field, assert for known good pdfs
40 return SkString();
41 }
42
has_BaseFont() const43 bool SkPdfType0FontDictionary::has_BaseFont() const {
44 return get("BaseFont", "") != NULL;
45 }
46
isEncodingAName(SkPdfNativeDoc * doc)47 bool SkPdfType0FontDictionary::isEncodingAName(SkPdfNativeDoc* doc) {
48 SkPdfNativeObject* ret = get("Encoding", "");
49 if (doc) {ret = doc->resolveReference(ret);}
50 return ret != NULL && ret->isName();
51 }
52
getEncodingAsName(SkPdfNativeDoc * doc)53 SkString SkPdfType0FontDictionary::getEncodingAsName(SkPdfNativeDoc* doc) {
54 SkPdfNativeObject* ret = get("Encoding", "");
55 if (doc) {ret = doc->resolveReference(ret);}
56 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
57 // TODO(edisonn): warn about missing required field, assert for known good pdfs
58 return SkString();
59 }
60
isEncodingAStream(SkPdfNativeDoc * doc)61 bool SkPdfType0FontDictionary::isEncodingAStream(SkPdfNativeDoc* doc) {
62 SkPdfNativeObject* ret = get("Encoding", "");
63 if (doc) {ret = doc->resolveReference(ret);}
64 return ret != NULL && ret->hasStream();
65 }
66
getEncodingAsStream(SkPdfNativeDoc * doc)67 SkPdfStream* SkPdfType0FontDictionary::getEncodingAsStream(SkPdfNativeDoc* doc) {
68 SkPdfNativeObject* ret = get("Encoding", "");
69 if (doc) {ret = doc->resolveReference(ret);}
70 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
71 // TODO(edisonn): warn about missing required field, assert for known good pdfs
72 return NULL;
73 }
74
has_Encoding() const75 bool SkPdfType0FontDictionary::has_Encoding() const {
76 return get("Encoding", "") != NULL;
77 }
78
DescendantFonts(SkPdfNativeDoc * doc)79 SkPdfArray* SkPdfType0FontDictionary::DescendantFonts(SkPdfNativeDoc* doc) {
80 SkPdfNativeObject* ret = get("DescendantFonts", "");
81 if (doc) {ret = doc->resolveReference(ret);}
82 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
83 // TODO(edisonn): warn about missing required field, assert for known good pdfs
84 return NULL;
85 }
86
has_DescendantFonts() const87 bool SkPdfType0FontDictionary::has_DescendantFonts() const {
88 return get("DescendantFonts", "") != NULL;
89 }
90
ToUnicode(SkPdfNativeDoc * doc)91 SkPdfStream* SkPdfType0FontDictionary::ToUnicode(SkPdfNativeDoc* doc) {
92 SkPdfNativeObject* ret = get("ToUnicode", "");
93 if (doc) {ret = doc->resolveReference(ret);}
94 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
95 // TODO(edisonn): warn about missing default value for optional fields
96 return NULL;
97 }
98
has_ToUnicode() const99 bool SkPdfType0FontDictionary::has_ToUnicode() const {
100 return get("ToUnicode", "") != NULL;
101 }
102