blob: fc81ad456f57881506a907a9a4d9021abe4abeb0 [file] [log] [blame]
edisonn@google.com29247622013-06-18 16:28:29 +00001#ifndef __DEFINED__SkPdfCIDFontDictionary
2#define __DEFINED__SkPdfCIDFontDictionary
3
4#include "SkPdfEnums_autogen.h"
5#include "SkPdfArray_autogen.h"
6#include "SkPdfFontDictionary_autogen.h"
7
8class SkPdfCIDFontDictionary : public SkPdfFontDictionary {
9public:
edisonn@google.com59543d32013-06-18 22:00:40 +000010 virtual SkPdfObjectType getType() const { return kCIDFontDictionary_SkPdfObjectType;}
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kCIDFontDictionary_SkPdfObjectType + 1);}
edisonn@google.com29247622013-06-18 16:28:29 +000012public:
13 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return this;}
14 virtual const SkPdfCIDFontDictionary* asCIDFontDictionary() const {return this;}
15
16private:
17 virtual SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() {return NULL;}
18 virtual const SkPdfTrueTypeFontDictionary* asTrueTypeFontDictionary() const {return NULL;}
19
20 virtual SkPdfType0FontDictionary* asType0FontDictionary() {return NULL;}
21 virtual const SkPdfType0FontDictionary* asType0FontDictionary() const {return NULL;}
22
23 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return NULL;}
24 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return NULL;}
25
26 virtual SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() {return NULL;}
27 virtual const SkPdfMultiMasterFontDictionary* asMultiMasterFontDictionary() const {return NULL;}
28
29 virtual SkPdfType3FontDictionary* asType3FontDictionary() {return NULL;}
30 virtual const SkPdfType3FontDictionary* asType3FontDictionary() const {return NULL;}
31
32public:
33private:
34public:
35 SkPdfCIDFontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {}
36
37 virtual bool valid() const {return true;}
38
39 SkPdfCIDFontDictionary& operator=(const SkPdfCIDFontDictionary& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;}
40
41 std::string Type() const {
42 std::string ret;
43 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
44 // TODO(edisonn): warn about missing required field, assert for known good pdfs
45 return "";
46 }
47
48 std::string Subtype() const {
49 std::string ret;
50 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "", &ret)) return ret;
51 // TODO(edisonn): warn about missing required field, assert for known good pdfs
52 return "";
53 }
54
55 std::string BaseFont() const {
56 std::string ret;
57 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont", "", &ret)) return ret;
58 // TODO(edisonn): warn about missing required field, assert for known good pdfs
59 return "";
60 }
61
62 SkPdfDictionary* CIDSystemInfo() const {
63 SkPdfDictionary* ret;
64 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSystemInfo", "", &ret)) return ret;
65 // TODO(edisonn): warn about missing required field, assert for known good pdfs
66 return NULL;
67 }
68
69 SkPdfDictionary* FontDescriptor() const {
70 SkPdfDictionary* ret;
71 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontDescriptor", "", &ret)) return ret;
72 // TODO(edisonn): warn about missing required field, assert for known good pdfs
73 return NULL;
74 }
75
76 long DW() const {
77 long ret;
78 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW", "", &ret)) return ret;
79 // TODO(edisonn): warn about missing required field, assert for known good pdfs
80 return 0;
81 }
82
83 SkPdfArray W() const {
84 SkPdfArray ret;
85 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", "", &ret)) return ret;
86 // TODO(edisonn): warn about missing required field, assert for known good pdfs
87 return SkPdfArray();
88 }
89
90 SkPdfArray DW2() const {
91 SkPdfArray ret;
92 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2", "", &ret)) return ret;
93 // TODO(edisonn): warn about missing required field, assert for known good pdfs
94 return SkPdfArray();
95 }
96
97 SkPdfArray W2() const {
98 SkPdfArray ret;
99 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2", "", &ret)) return ret;
100 // TODO(edisonn): warn about missing required field, assert for known good pdfs
101 return SkPdfArray();
102 }
103
104 bool isCIDToGIDMapAStream() const {
105 SkPdfObject* ret = NULL;
106 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap", "", &ret)) return false;
107 return ret->podofo()->HasStream();
108 }
109
110 SkPdfStream getCIDToGIDMapAsStream() const {
111 SkPdfStream ret = SkPdfStream();
112 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap", "", &ret)) return ret;
113 // TODO(edisonn): warn about missing required field, assert for known good pdfs
114 return SkPdfStream();
115 }
116
117 bool isCIDToGIDMapAName() const {
118 SkPdfObject* ret = NULL;
119 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap", "", &ret)) return false;
120 return ret->podofo()->GetDataType() == ePdfDataType_Name;
121 }
122
123 std::string getCIDToGIDMapAsName() const {
124 std::string ret = "";
125 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap", "", &ret)) return ret;
126 // TODO(edisonn): warn about missing required field, assert for known good pdfs
127 return "";
128 }
129
130};
131
132#endif // __DEFINED__SkPdfCIDFontDictionary