Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: experimental/PdfViewer/SkPdfType1FontDictionary_autogen.h

Issue 16975013: Deal with ca and CA transparency operators in pdf. add comments to generated classes. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #ifndef __DEFINED__SkPdfType1FontDictionary 1 #ifndef __DEFINED__SkPdfType1FontDictionary
2 #define __DEFINED__SkPdfType1FontDictionary 2 #define __DEFINED__SkPdfType1FontDictionary
3 3
4 #include "SkPdfEnums_autogen.h" 4 #include "SkPdfEnums_autogen.h"
5 #include "SkPdfArray_autogen.h" 5 #include "SkPdfArray_autogen.h"
6 #include "SkPdfFontDictionary_autogen.h" 6 #include "SkPdfFontDictionary_autogen.h"
7 7
8 // Entries in a Type 1 font dictionary
8 class SkPdfType1FontDictionary : public SkPdfFontDictionary { 9 class SkPdfType1FontDictionary : public SkPdfFontDictionary {
9 public: 10 public:
10 virtual SkPdfObjectType getType() const { return kType1FontDictionary_SkPdfObj ectType;} 11 virtual SkPdfObjectType getType() const { return kType1FontDictionary_SkPdfObj ectType;}
11 virtual SkPdfObjectType getTypeEnd() const { return kType1FontDictionary__End_ SkPdfObjectType;} 12 virtual SkPdfObjectType getTypeEnd() const { return kType1FontDictionary__End_ SkPdfObjectType;}
12 public: 13 public:
13 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return this;} 14 virtual SkPdfType1FontDictionary* asType1FontDictionary() {return this;}
14 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return this;} 15 virtual const SkPdfType1FontDictionary* asType1FontDictionary() const {return this;}
15 16
16 private: 17 private:
17 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return NULL;} 18 virtual SkPdfCIDFontDictionary* asCIDFontDictionary() {return NULL;}
(...skipping 10 matching lines...) Expand all
28 29
29 public: 30 public:
30 private: 31 private:
31 public: 32 public:
32 SkPdfType1FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {} 33 SkPdfType1FontDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje ct* podofoObj = NULL) : SkPdfFontDictionary(podofoDoc, podofoObj) {}
33 34
34 virtual bool valid() const {return true;} 35 virtual bool valid() const {return true;}
35 36
36 SkPdfType1FontDictionary& operator=(const SkPdfType1FontDictionary& from) {thi s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi s;} 37 SkPdfType1FontDictionary& operator=(const SkPdfType1FontDictionary& from) {thi s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi s;}
37 38
39 /** (Required) The type of PDF object that this dictionary describes; must be
40 * Font for a font dictionary.
41 **/
42 bool has_Type() const {
43 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type" , "", NULL));
44 }
45
38 std::string Type() const { 46 std::string Type() const {
39 std::string ret; 47 std::string ret;
40 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret; 48 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
41 // TODO(edisonn): warn about missing required field, assert for known good p dfs 49 // TODO(edisonn): warn about missing required field, assert for known good p dfs
42 return ""; 50 return "";
43 } 51 }
44 52
53 /** (Required) The type of font; must be Type1 for a Type 1 font.
54 **/
55 bool has_Subtype() const {
56 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty pe", "", NULL));
57 }
58
45 std::string Subtype() const { 59 std::string Subtype() const {
46 std::string ret; 60 std::string ret;
47 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", " ", &ret)) return ret; 61 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", " ", &ret)) return ret;
48 // TODO(edisonn): warn about missing required field, assert for known good p dfs 62 // TODO(edisonn): warn about missing required field, assert for known good p dfs
49 return ""; 63 return "";
50 } 64 }
51 65
66 /** (Required in PDF 1.0; optional otherwise) The name by which this font is ref -
67 * erenced in the Font subdictionary of the current resource dictionary.
68 * Note: This entry is obsolescent and its use is no longer recommended. (See
69 * implementation note 42 in Appendix H.)
70 **/
71 bool has_Name() const {
72 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name" , "", NULL));
73 }
74
52 std::string Name() const { 75 std::string Name() const {
53 std::string ret; 76 std::string ret;
54 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "", &ret)) return ret; 77 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "", &ret)) return ret;
55 // TODO(edisonn): warn about missing required field, assert for known good p dfs 78 // TODO(edisonn): warn about missing required field, assert for known good p dfs
56 return ""; 79 return "";
57 } 80 }
58 81
82 /** (Required) The PostScript name of the font. For Type 1 fonts, this is usuall y
83 * the value of the FontName entry in the font program; for more information,
84 * see Section 5.2 of the PostScript Language Reference, Third Edition. The Pos t-
85 * Script name of the font can be used to find the font's definition in the vie wer
86 * application or its environment. It is also the name that will be used when
87 * printing to a PostScript output device.
88 **/
89 bool has_BaseFont() const {
90 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseF ont", "", NULL));
91 }
92
59 std::string BaseFont() const { 93 std::string BaseFont() const {
60 std::string ret; 94 std::string ret;
61 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont", "", &ret)) return ret; 95 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont", "", &ret)) return ret;
62 // TODO(edisonn): warn about missing required field, assert for known good p dfs 96 // TODO(edisonn): warn about missing required field, assert for known good p dfs
63 return ""; 97 return "";
64 } 98 }
65 99
100 /** (Required except for the standard 14 fonts) The first character code defined in
101 * the font's Widths array.
102 **/
103 bool has_FirstChar() const {
104 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First Char", "", NULL));
105 }
106
66 long FirstChar() const { 107 long FirstChar() const {
67 long ret; 108 long ret;
68 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FirstChar", "", &ret)) return ret; 109 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FirstChar", "", &ret)) return ret;
69 // TODO(edisonn): warn about missing required field, assert for known good p dfs 110 // TODO(edisonn): warn about missing required field, assert for known good p dfs
70 return 0; 111 return 0;
71 } 112 }
72 113
114 /** (Required except for the standard 14 fonts) The last character code defined in
115 * the font's Widths array.
116 **/
117 bool has_LastChar() const {
118 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastC har", "", NULL));
119 }
120
73 long LastChar() const { 121 long LastChar() const {
74 long ret; 122 long ret;
75 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastChar", "", &ret)) return ret; 123 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastChar", "", &ret)) return ret;
76 // TODO(edisonn): warn about missing required field, assert for known good p dfs 124 // TODO(edisonn): warn about missing required field, assert for known good p dfs
77 return 0; 125 return 0;
78 } 126 }
79 127
128 /** (Required except for the standard 14 fonts; indirect reference preferred) An array
129 * of (LastChar - FirstChar + 1) widths, each element being the glyph width for
130 * the character whose code is FirstChar plus the array index. For character
131 * codes outside the range FirstChar to LastChar, the value of MissingWidth fro m
132 * the FontDescriptor entry for this font is used. The glyph widths are measure d
133 * in units in which 1000 units corresponds to 1 unit in text space. These widt hs
134 * must be consistent with the actual widths given in the font program itself.
135 * (See implementation note 43 in Appendix H.) For more information on
136 * glyph widths and other glyph metrics, see Section 5.1.3, "Glyph Positioning
137 * and Metrics."
138 **/
139 bool has_Widths() const {
140 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width s", "", NULL));
141 }
142
80 SkPdfArray Widths() const { 143 SkPdfArray Widths() const {
81 SkPdfArray ret; 144 SkPdfArray ret;
82 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Widths", " ", &ret)) return ret; 145 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Widths", " ", &ret)) return ret;
83 // TODO(edisonn): warn about missing required field, assert for known good p dfs 146 // TODO(edisonn): warn about missing required field, assert for known good p dfs
84 return SkPdfArray(); 147 return SkPdfArray();
85 } 148 }
86 149
150 /** (Required except for the standard 14 fonts; must be an indirect reference) A font
151 * descriptor describing the font's metrics other than its glyph widths (see Se c-
152 * tion 5.7, "Font Descriptors").
153 * Note: For the standard 14 fonts, the entries FirstChar, LastChar, Widths, and
154 * FontDescriptor must either all be present or all absent. Ordinarily, they are ab-
155 * sent; specifying them enables a standard font to be overridden (see "Stan dard
156 * Type 1 Fonts," below).
157 **/
158 bool has_FontDescriptor() const {
159 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD escriptor", "", NULL));
160 }
161
87 SkPdfDictionary* FontDescriptor() const { 162 SkPdfDictionary* FontDescriptor() const {
88 SkPdfDictionary* ret; 163 SkPdfDictionary* ret;
89 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD escriptor", "", &ret)) return ret; 164 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD escriptor", "", &ret)) return ret;
90 // TODO(edisonn): warn about missing required field, assert for known good p dfs 165 // TODO(edisonn): warn about missing required field, assert for known good p dfs
91 return NULL; 166 return NULL;
92 } 167 }
93 168
169 /** (Optional) A specification of the font's character encoding, if different fr om
170 * its built-in encoding. The value of Encoding may be either the name of a pre -
171 * defined encoding (MacRomanEncoding, MacExpertEncoding, or WinAnsi-
172 * Encoding, as described in Appendix D) or an encoding dictionary that
173 * specifies differences from the font's built-in encoding or from a specified pre-
174 * defined encoding (see Section 5.5.5, "Character Encoding").
175 **/
176 bool has_Encoding() const {
177 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod ing", "", NULL));
178 }
179
94 bool isEncodingAName() const { 180 bool isEncodingAName() const {
95 SkPdfObject* ret = NULL; 181 SkPdfObject* ret = NULL;
96 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding ", "", &ret)) return false; 182 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding ", "", &ret)) return false;
97 return ret->podofo()->GetDataType() == ePdfDataType_Name; 183 return ret->podofo()->GetDataType() == ePdfDataType_Name;
98 } 184 }
99 185
100 std::string getEncodingAsName() const { 186 std::string getEncodingAsName() const {
101 std::string ret = ""; 187 std::string ret = "";
102 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding", "", &ret)) return ret; 188 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding", "", &ret)) return ret;
103 // TODO(edisonn): warn about missing required field, assert for known good p dfs 189 // TODO(edisonn): warn about missing required field, assert for known good p dfs
104 return ""; 190 return "";
105 } 191 }
106 192
107 bool isEncodingADictionary() const { 193 bool isEncodingADictionary() const {
108 SkPdfObject* ret = NULL; 194 SkPdfObject* ret = NULL;
109 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding ", "", &ret)) return false; 195 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encoding ", "", &ret)) return false;
110 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; 196 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary;
111 } 197 }
112 198
113 SkPdfDictionary* getEncodingAsDictionary() const { 199 SkPdfDictionary* getEncodingAsDictionary() const {
114 SkPdfDictionary* ret = NULL; 200 SkPdfDictionary* ret = NULL;
115 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod ing", "", &ret)) return ret; 201 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Encod ing", "", &ret)) return ret;
116 // TODO(edisonn): warn about missing required field, assert for known good p dfs 202 // TODO(edisonn): warn about missing required field, assert for known good p dfs
117 return NULL; 203 return NULL;
118 } 204 }
119 205
206 /** (Optional; PDF 1.2) A stream containing a CMap file that maps character
207 * codes to Unicode values (see Section 5.9, "ToUnicode CMaps").
208 **/
209 bool has_ToUnicode() const {
210 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUni code", "", NULL));
211 }
212
120 SkPdfStream ToUnicode() const { 213 SkPdfStream ToUnicode() const {
121 SkPdfStream ret; 214 SkPdfStream ret;
122 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode ", "", &ret)) return ret; 215 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ToUnicode ", "", &ret)) return ret;
123 // TODO(edisonn): warn about missing required field, assert for known good p dfs 216 // TODO(edisonn): warn about missing required field, assert for known good p dfs
124 return SkPdfStream(); 217 return SkPdfStream();
125 } 218 }
126 219
127 }; 220 };
128 221
129 #endif // __DEFINED__SkPdfType1FontDictionary 222 #endif // __DEFINED__SkPdfType1FontDictionary
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698