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

Side by Side Diff: experimental/PdfViewer/autogen/SkPdfCIDFontDictionary_autogen.h

Issue 17856004: refactoring for pdf viewer lib (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__SkPdfCIDFontDictionary 1 #ifndef __DEFINED__SkPdfCIDFontDictionary
2 #define __DEFINED__SkPdfCIDFontDictionary 2 #define __DEFINED__SkPdfCIDFontDictionary
3 3
4 #include "SkPdfUtils.h" 4 #include "SkPdfUtils.h"
5 #include "SkPdfEnums_autogen.h" 5 #include "SkPdfEnums_autogen.h"
6 #include "SkPdfArray_autogen.h" 6 #include "SkPdfArray_autogen.h"
7 #include "SkPdfFontDictionary_autogen.h" 7 #include "SkPdfFontDictionary_autogen.h"
8 8
9 // Entries in a CIDFont dictionary 9 // Entries in a CIDFont dictionary
10 class SkPdfCIDFontDictionary : public SkPdfFontDictionary { 10 class SkPdfCIDFontDictionary : public SkPdfFontDictionary {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 SkPdfCIDFontDictionary& operator=(const SkPdfCIDFontDictionary& from) {this->f PodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} 43 SkPdfCIDFontDictionary& operator=(const SkPdfCIDFontDictionary& from) {this->f PodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;}
44 44
45 /** (Required) The type of PDF object that this dictionary describes; must be 45 /** (Required) The type of PDF object that this dictionary describes; must be
46 * Font for a CIDFont dictionary. 46 * Font for a CIDFont dictionary.
47 **/ 47 **/
48 bool has_Type() const { 48 bool has_Type() const {
49 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type" , "", NULL)); 49 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type" , "", NULL));
50 } 50 }
51 51
52 std::string Type() const { 52 std::string Type() const;
53 std::string ret;
54 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
55 // TODO(edisonn): warn about missing required field, assert for known good p dfs
56 return "";
57 }
58
59 /** (Required) The type of CIDFont; CIDFontType0 or CIDFontType2. 53 /** (Required) The type of CIDFont; CIDFontType0 or CIDFontType2.
60 **/ 54 **/
61 bool has_Subtype() const { 55 bool has_Subtype() const {
62 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty pe", "", NULL)); 56 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty pe", "", NULL));
63 } 57 }
64 58
65 std::string Subtype() const { 59 std::string Subtype() const;
66 std::string ret;
67 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", " ", &ret)) return ret;
68 // TODO(edisonn): warn about missing required field, assert for known good p dfs
69 return "";
70 }
71
72 /** (Required) The PostScript name of the CIDFont. For Type 0 CIDFonts, this 60 /** (Required) The PostScript name of the CIDFont. For Type 0 CIDFonts, this
73 * is usually the value of the CIDFontName entry in the CIDFont program. For 61 * is usually the value of the CIDFontName entry in the CIDFont program. For
74 * Type 2 CIDFonts, it is derived the same way as for a simple TrueType font; 62 * Type 2 CIDFonts, it is derived the same way as for a simple TrueType font;
75 * see Section 5.5.2, "TrueType Fonts." In either case, the name can have a sub - 63 * see Section 5.5.2, "TrueType Fonts." In either case, the name can have a sub -
76 * set prefix if appropriate; see Section 5.5.3, "Font Subsets." 64 * set prefix if appropriate; see Section 5.5.3, "Font Subsets."
77 **/ 65 **/
78 bool has_BaseFont() const { 66 bool has_BaseFont() const {
79 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseF ont", "", NULL)); 67 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseF ont", "", NULL));
80 } 68 }
81 69
82 std::string BaseFont() const { 70 std::string BaseFont() const;
83 std::string ret;
84 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BaseFont", "", &ret)) return ret;
85 // TODO(edisonn): warn about missing required field, assert for known good p dfs
86 return "";
87 }
88
89 /** (Required) A dictionary containing entries that define the character collec- 71 /** (Required) A dictionary containing entries that define the character collec-
90 * tion of the CIDFont. See Table 5.12 on page 337. 72 * tion of the CIDFont. See Table 5.12 on page 337.
91 **/ 73 **/
92 bool has_CIDSystemInfo() const { 74 bool has_CIDSystemInfo() const {
93 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy stemInfo", "", NULL)); 75 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy stemInfo", "", NULL));
94 } 76 }
95 77
96 SkPdfDictionary* CIDSystemInfo() const { 78 SkPdfDictionary* CIDSystemInfo() const;
97 SkPdfDictionary* ret;
98 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDSy stemInfo", "", &ret)) return ret;
99 // TODO(edisonn): warn about missing required field, assert for known good p dfs
100 return NULL;
101 }
102
103 /** (Required; must be an indirect reference) A font descriptor describing the 79 /** (Required; must be an indirect reference) A font descriptor describing the
104 * CIDFont's default metrics other than its glyph widths (see Section 5.7, 80 * CIDFont's default metrics other than its glyph widths (see Section 5.7,
105 * "Font Descriptors"). 81 * "Font Descriptors").
106 **/ 82 **/
107 bool has_FontDescriptor() const { 83 bool has_FontDescriptor() const {
108 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD escriptor", "", NULL)); 84 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD escriptor", "", NULL));
109 } 85 }
110 86
111 SkPdfDictionary* FontDescriptor() const { 87 SkPdfDictionary* FontDescriptor() const;
112 SkPdfDictionary* ret;
113 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FontD escriptor", "", &ret)) return ret;
114 // TODO(edisonn): warn about missing required field, assert for known good p dfs
115 return NULL;
116 }
117
118 /** (Optional) The default width for glyphs in the CIDFont (see "Glyph Met- 88 /** (Optional) The default width for glyphs in the CIDFont (see "Glyph Met-
119 * rics in CIDFonts" on page 340). Default value: 1000. 89 * rics in CIDFonts" on page 340). Default value: 1000.
120 **/ 90 **/
121 bool has_DW() const { 91 bool has_DW() const {
122 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW", "", NULL)); 92 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW", "", NULL));
123 } 93 }
124 94
125 long DW() const { 95 long DW() const;
126 long ret;
127 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW", "", &r et)) return ret;
128 // TODO(edisonn): warn about missing required field, assert for known good p dfs
129 return 0;
130 }
131
132 /** (Optional) A description of the widths for the glyphs in the CIDFont. The 96 /** (Optional) A description of the widths for the glyphs in the CIDFont. The
133 * array's elements have a variable format that can specify individual widths 97 * array's elements have a variable format that can specify individual widths
134 * for consecutive CIDs or one width for a range of CIDs (see "Glyph Metrics 98 * for consecutive CIDs or one width for a range of CIDs (see "Glyph Metrics
135 * in CIDFonts" on page 340). Default value: none (the DW value is used for 99 * in CIDFonts" on page 340). Default value: none (the DW value is used for
136 * all glyphs). 100 * all glyphs).
137 **/ 101 **/
138 bool has_W() const { 102 bool has_W() const {
139 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", " ", NULL)); 103 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", " ", NULL));
140 } 104 }
141 105
142 SkPdfArray* W() const { 106 SkPdfArray* W() const;
143 SkPdfArray* ret;
144 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W", "", &r et)) return ret;
145 // TODO(edisonn): warn about missing required field, assert for known good p dfs
146 return NULL;
147 }
148
149 /** (Optional; applies only to CIDFonts used for vertical writing) An array of t wo 107 /** (Optional; applies only to CIDFonts used for vertical writing) An array of t wo
150 * numbers specifying the default metrics for vertical writing (see "Glyph 108 * numbers specifying the default metrics for vertical writing (see "Glyph
151 * Metrics in CIDFonts" on page 340). Default value: [880 -1000]. 109 * Metrics in CIDFonts" on page 340). Default value: [880 -1000].
152 **/ 110 **/
153 bool has_DW2() const { 111 bool has_DW2() const {
154 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2", "", NULL)); 112 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2", "", NULL));
155 } 113 }
156 114
157 SkPdfArray* DW2() const { 115 SkPdfArray* DW2() const;
158 SkPdfArray* ret;
159 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "DW2", "", &ret)) return ret;
160 // TODO(edisonn): warn about missing required field, assert for known good p dfs
161 return NULL;
162 }
163
164 /** (Optional; applies only to CIDFonts used for vertical writing) A description of 116 /** (Optional; applies only to CIDFonts used for vertical writing) A description of
165 * the metrics for vertical writing for the glyphs in the CIDFont (see "Glyph 117 * the metrics for vertical writing for the glyphs in the CIDFont (see "Glyph
166 * Metrics in CIDFonts" on page 340). Default value: none (the DW2 value is 118 * Metrics in CIDFonts" on page 340). Default value: none (the DW2 value is
167 * used for all glyphs). 119 * used for all glyphs).
168 **/ 120 **/
169 bool has_W2() const { 121 bool has_W2() const {
170 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2", "", NULL)); 122 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2", "", NULL));
171 } 123 }
172 124
173 SkPdfArray* W2() const { 125 SkPdfArray* W2() const;
174 SkPdfArray* ret;
175 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "W2", "", & ret)) return ret;
176 // TODO(edisonn): warn about missing required field, assert for known good p dfs
177 return NULL;
178 }
179
180 /** (Optional; Type 2 CIDFonts only) A specification of the mapping from CIDs 126 /** (Optional; Type 2 CIDFonts only) A specification of the mapping from CIDs
181 * to glyph indices. If the value is a stream, the bytes in the stream contain the 127 * to glyph indices. If the value is a stream, the bytes in the stream contain the
182 * mapping from CIDs to glyph indices: the glyph index for a particular CID 128 * mapping from CIDs to glyph indices: the glyph index for a particular CID
183 * value c is a 2-byte value stored in bytes 2 x c and 2 x c + 1, where the fir st 129 * value c is a 2-byte value stored in bytes 2 x c and 2 x c + 1, where the fir st
184 * byte is the high-order byte. If the value of CIDToGIDMap is a name, it must 130 * byte is the high-order byte. If the value of CIDToGIDMap is a name, it must
185 * be Identity, indicating that the mapping between CIDs and glyph indices is 131 * be Identity, indicating that the mapping between CIDs and glyph indices is
186 * the identity mapping. Default value: Identity. 132 * the identity mapping. Default value: Identity.
187 * This entry may appear only in a Type 2 CIDFont whose associated True- 133 * This entry may appear only in a Type 2 CIDFont whose associated True-
188 * Type font program is embedded in the PDF file (see the next section). 134 * Type font program is embedded in the PDF file (see the next section).
189 **/ 135 **/
190 bool has_CIDToGIDMap() const { 136 bool has_CIDToGIDMap() const {
191 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDTo GIDMap", "", NULL)); 137 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDTo GIDMap", "", NULL));
192 } 138 }
193 139
194 bool isCIDToGIDMapAStream() const { 140 bool isCIDToGIDMapAStream() const {
195 SkPdfObject* ret = NULL; 141 SkPdfObject* ret = NULL;
196 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID Map", "", &ret)) return false; 142 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID Map", "", &ret)) return false;
197 return ret->podofo()->HasStream(); 143 return ret->podofo()->HasStream();
198 } 144 }
199 145
200 SkPdfStream* getCIDToGIDMapAsStream() const { 146 SkPdfStream* getCIDToGIDMapAsStream() const;
201 SkPdfStream* ret = NULL;
202 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDM ap", "", &ret)) return ret;
203 // TODO(edisonn): warn about missing required field, assert for known good p dfs
204 return NULL;
205 }
206
207 bool isCIDToGIDMapAName() const { 147 bool isCIDToGIDMapAName() const {
208 SkPdfObject* ret = NULL; 148 SkPdfObject* ret = NULL;
209 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID Map", "", &ret)) return false; 149 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGID Map", "", &ret)) return false;
210 return ret->podofo()->GetDataType() == ePdfDataType_Name; 150 return ret->podofo()->GetDataType() == ePdfDataType_Name;
211 } 151 }
212 152
213 std::string getCIDToGIDMapAsName() const { 153 std::string getCIDToGIDMapAsName() const;
214 std::string ret = "";
215 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CIDToGIDMap ", "", &ret)) return ret;
216 // TODO(edisonn): warn about missing required field, assert for known good p dfs
217 return "";
218 }
219
220 }; 154 };
221 155
222 #endif // __DEFINED__SkPdfCIDFontDictionary 156 #endif // __DEFINED__SkPdfCIDFontDictionary
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698