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