• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "SkPdfCIDFontDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10 
Type(SkPdfNativeDoc * doc)11 SkString SkPdfCIDFontDictionary::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 SkPdfCIDFontDictionary::has_Type() const {
20   return get("Type", "") != NULL;
21 }
22 
Subtype(SkPdfNativeDoc * doc)23 SkString SkPdfCIDFontDictionary::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 SkPdfCIDFontDictionary::has_Subtype() const {
32   return get("Subtype", "") != NULL;
33 }
34 
BaseFont(SkPdfNativeDoc * doc)35 SkString SkPdfCIDFontDictionary::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 SkPdfCIDFontDictionary::has_BaseFont() const {
44   return get("BaseFont", "") != NULL;
45 }
46 
CIDSystemInfo(SkPdfNativeDoc * doc)47 SkPdfDictionary* SkPdfCIDFontDictionary::CIDSystemInfo(SkPdfNativeDoc* doc) {
48   SkPdfNativeObject* ret = get("CIDSystemInfo", "");
49   if (doc) {ret = doc->resolveReference(ret);}
50   if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
51   // TODO(edisonn): warn about missing required field, assert for known good pdfs
52   return NULL;
53 }
54 
has_CIDSystemInfo() const55 bool SkPdfCIDFontDictionary::has_CIDSystemInfo() const {
56   return get("CIDSystemInfo", "") != NULL;
57 }
58 
FontDescriptor(SkPdfNativeDoc * doc)59 SkPdfFontDescriptorDictionary* SkPdfCIDFontDictionary::FontDescriptor(SkPdfNativeDoc* doc) {
60   SkPdfNativeObject* ret = get("FontDescriptor", "");
61   if (doc) {ret = doc->resolveReference(ret);}
62   if ((ret != NULL && ret->isDictionary() && ((SkPdfFontDescriptorDictionary*)ret)->valid()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfFontDescriptorDictionary*)ret;
63   // TODO(edisonn): warn about missing default value for optional fields
64   return NULL;
65 }
66 
has_FontDescriptor() const67 bool SkPdfCIDFontDictionary::has_FontDescriptor() const {
68   return get("FontDescriptor", "") != NULL;
69 }
70 
DW(SkPdfNativeDoc * doc)71 int64_t SkPdfCIDFontDictionary::DW(SkPdfNativeDoc* doc) {
72   SkPdfNativeObject* ret = get("DW", "");
73   if (doc) {ret = doc->resolveReference(ret);}
74   if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
75   // TODO(edisonn): warn about missing default value for optional fields
76   return 0;
77 }
78 
has_DW() const79 bool SkPdfCIDFontDictionary::has_DW() const {
80   return get("DW", "") != NULL;
81 }
82 
W(SkPdfNativeDoc * doc)83 SkPdfArray* SkPdfCIDFontDictionary::W(SkPdfNativeDoc* doc) {
84   SkPdfNativeObject* ret = get("W", "");
85   if (doc) {ret = doc->resolveReference(ret);}
86   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
87   // TODO(edisonn): warn about missing default value for optional fields
88   return NULL;
89 }
90 
has_W() const91 bool SkPdfCIDFontDictionary::has_W() const {
92   return get("W", "") != NULL;
93 }
94 
DW2(SkPdfNativeDoc * doc)95 SkPdfArray* SkPdfCIDFontDictionary::DW2(SkPdfNativeDoc* doc) {
96   SkPdfNativeObject* ret = get("DW2", "");
97   if (doc) {ret = doc->resolveReference(ret);}
98   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
99   // TODO(edisonn): warn about missing default value for optional fields
100   return NULL;
101 }
102 
has_DW2() const103 bool SkPdfCIDFontDictionary::has_DW2() const {
104   return get("DW2", "") != NULL;
105 }
106 
W2(SkPdfNativeDoc * doc)107 SkPdfArray* SkPdfCIDFontDictionary::W2(SkPdfNativeDoc* doc) {
108   SkPdfNativeObject* ret = get("W2", "");
109   if (doc) {ret = doc->resolveReference(ret);}
110   if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
111   // TODO(edisonn): warn about missing default value for optional fields
112   return NULL;
113 }
114 
has_W2() const115 bool SkPdfCIDFontDictionary::has_W2() const {
116   return get("W2", "") != NULL;
117 }
118 
isCIDToGIDMapAStream(SkPdfNativeDoc * doc)119 bool SkPdfCIDFontDictionary::isCIDToGIDMapAStream(SkPdfNativeDoc* doc) {
120   SkPdfNativeObject* ret = get("CIDToGIDMap", "");
121   if (doc) {ret = doc->resolveReference(ret);}
122   return ret != NULL && ret->hasStream();
123 }
124 
getCIDToGIDMapAsStream(SkPdfNativeDoc * doc)125 SkPdfStream* SkPdfCIDFontDictionary::getCIDToGIDMapAsStream(SkPdfNativeDoc* doc) {
126   SkPdfNativeObject* ret = get("CIDToGIDMap", "");
127   if (doc) {ret = doc->resolveReference(ret);}
128   if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
129   // TODO(edisonn): warn about missing default value for optional fields
130   return NULL;
131 }
132 
isCIDToGIDMapAName(SkPdfNativeDoc * doc)133 bool SkPdfCIDFontDictionary::isCIDToGIDMapAName(SkPdfNativeDoc* doc) {
134   SkPdfNativeObject* ret = get("CIDToGIDMap", "");
135   if (doc) {ret = doc->resolveReference(ret);}
136   return ret != NULL && ret->isName();
137 }
138 
getCIDToGIDMapAsName(SkPdfNativeDoc * doc)139 SkString SkPdfCIDFontDictionary::getCIDToGIDMapAsName(SkPdfNativeDoc* doc) {
140   SkPdfNativeObject* ret = get("CIDToGIDMap", "");
141   if (doc) {ret = doc->resolveReference(ret);}
142   if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
143   // TODO(edisonn): warn about missing default value for optional fields
144   return SkString();
145 }
146 
has_CIDToGIDMap() const147 bool SkPdfCIDFontDictionary::has_CIDToGIDMap() const {
148   return get("CIDToGIDMap", "") != NULL;
149 }
150