origami 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. data/COPYING.LESSER +165 -0
  2. data/README +77 -0
  3. data/VERSION +1 -0
  4. data/bin/config/pdfcop.conf.yml +237 -0
  5. data/bin/gui/about.rb +46 -0
  6. data/bin/gui/config.rb +132 -0
  7. data/bin/gui/file.rb +385 -0
  8. data/bin/gui/hexdump.rb +74 -0
  9. data/bin/gui/hexview.rb +91 -0
  10. data/bin/gui/imgview.rb +72 -0
  11. data/bin/gui/menu.rb +392 -0
  12. data/bin/gui/properties.rb +132 -0
  13. data/bin/gui/signing.rb +635 -0
  14. data/bin/gui/textview.rb +107 -0
  15. data/bin/gui/treeview.rb +409 -0
  16. data/bin/gui/walker.rb +282 -0
  17. data/bin/gui/xrefs.rb +79 -0
  18. data/bin/pdf2graph +121 -0
  19. data/bin/pdf2ruby +353 -0
  20. data/bin/pdfcocoon +104 -0
  21. data/bin/pdfcop +455 -0
  22. data/bin/pdfdecompress +104 -0
  23. data/bin/pdfdecrypt +95 -0
  24. data/bin/pdfencrypt +112 -0
  25. data/bin/pdfextract +221 -0
  26. data/bin/pdfmetadata +123 -0
  27. data/bin/pdfsh +13 -0
  28. data/bin/pdfwalker +7 -0
  29. data/bin/shell/.irbrc +104 -0
  30. data/bin/shell/console.rb +136 -0
  31. data/bin/shell/hexdump.rb +83 -0
  32. data/origami.rb +36 -0
  33. data/origami/3d.rb +239 -0
  34. data/origami/acroform.rb +321 -0
  35. data/origami/actions.rb +299 -0
  36. data/origami/adobe/fdf.rb +259 -0
  37. data/origami/adobe/ppklite.rb +489 -0
  38. data/origami/annotations.rb +775 -0
  39. data/origami/array.rb +187 -0
  40. data/origami/boolean.rb +101 -0
  41. data/origami/catalog.rb +486 -0
  42. data/origami/destinations.rb +213 -0
  43. data/origami/dictionary.rb +188 -0
  44. data/origami/docmdp.rb +96 -0
  45. data/origami/encryption.rb +1293 -0
  46. data/origami/export.rb +283 -0
  47. data/origami/file.rb +222 -0
  48. data/origami/filters.rb +250 -0
  49. data/origami/filters/ascii.rb +189 -0
  50. data/origami/filters/ccitt.rb +515 -0
  51. data/origami/filters/crypt.rb +47 -0
  52. data/origami/filters/dct.rb +61 -0
  53. data/origami/filters/flate.rb +112 -0
  54. data/origami/filters/jbig2.rb +63 -0
  55. data/origami/filters/jpx.rb +53 -0
  56. data/origami/filters/lzw.rb +195 -0
  57. data/origami/filters/predictors.rb +276 -0
  58. data/origami/filters/runlength.rb +117 -0
  59. data/origami/font.rb +209 -0
  60. data/origami/functions.rb +93 -0
  61. data/origami/graphics.rb +33 -0
  62. data/origami/graphics/colors.rb +191 -0
  63. data/origami/graphics/instruction.rb +126 -0
  64. data/origami/graphics/path.rb +154 -0
  65. data/origami/graphics/patterns.rb +180 -0
  66. data/origami/graphics/state.rb +164 -0
  67. data/origami/graphics/text.rb +224 -0
  68. data/origami/graphics/xobject.rb +493 -0
  69. data/origami/header.rb +90 -0
  70. data/origami/linearization.rb +318 -0
  71. data/origami/metadata.rb +114 -0
  72. data/origami/name.rb +170 -0
  73. data/origami/null.rb +75 -0
  74. data/origami/numeric.rb +188 -0
  75. data/origami/obfuscation.rb +233 -0
  76. data/origami/object.rb +527 -0
  77. data/origami/outline.rb +59 -0
  78. data/origami/page.rb +559 -0
  79. data/origami/parser.rb +268 -0
  80. data/origami/parsers/fdf.rb +45 -0
  81. data/origami/parsers/pdf.rb +27 -0
  82. data/origami/parsers/pdf/linear.rb +113 -0
  83. data/origami/parsers/ppklite.rb +86 -0
  84. data/origami/pdf.rb +1144 -0
  85. data/origami/reference.rb +113 -0
  86. data/origami/signature.rb +474 -0
  87. data/origami/stream.rb +575 -0
  88. data/origami/string.rb +416 -0
  89. data/origami/trailer.rb +173 -0
  90. data/origami/webcapture.rb +87 -0
  91. data/origami/xfa.rb +3027 -0
  92. data/origami/xreftable.rb +447 -0
  93. data/templates/patterns.rb +66 -0
  94. data/templates/widgets.rb +173 -0
  95. data/templates/xdp.rb +92 -0
  96. data/tests/dataset/test.dummycrt +28 -0
  97. data/tests/dataset/test.dummykey +27 -0
  98. data/tests/tc_actions.rb +32 -0
  99. data/tests/tc_annotations.rb +85 -0
  100. data/tests/tc_pages.rb +37 -0
  101. data/tests/tc_pdfattach.rb +24 -0
  102. data/tests/tc_pdfencrypt.rb +110 -0
  103. data/tests/tc_pdfnew.rb +32 -0
  104. data/tests/tc_pdfparse.rb +98 -0
  105. data/tests/tc_pdfsig.rb +37 -0
  106. data/tests/tc_streams.rb +129 -0
  107. data/tests/ts_pdf.rb +45 -0
  108. metadata +193 -0
@@ -0,0 +1,276 @@
1
+ =begin
2
+
3
+ = File
4
+ filters/predictors.rb
5
+
6
+ = Info
7
+ This file is part of Origami, PDF manipulation framework for Ruby
8
+ Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org>
9
+ All right reserved.
10
+
11
+ Origami is free software: you can redistribute it and/or modify
12
+ it under the terms of the GNU Lesser General Public License as published by
13
+ the Free Software Foundation, either version 3 of the License, or
14
+ (at your option) any later version.
15
+
16
+ Origami is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ GNU Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public License
22
+ along with Origami. If not, see <http://www.gnu.org/licenses/>.
23
+
24
+ =end
25
+
26
+ module Origami
27
+
28
+ module Filter
29
+
30
+ class PredictorError < Exception #:nodoc:
31
+ end
32
+
33
+ module Predictor
34
+
35
+ NONE = 1
36
+ TIFF = 2
37
+ PNG_NONE = 10
38
+ PNG_SUB = 11
39
+ PNG_UP = 12
40
+ PNG_AVERAGE = 13
41
+ PNG_PAETH = 14
42
+ PNG_OPTIMUM = 15
43
+
44
+ def self.do_pre_prediction(data, predictor = NONE, colors = 1, bpc = 8, columns = 1)
45
+
46
+ return data if predictor == NONE
47
+
48
+ unless (1..4) === colors.to_i
49
+ raise PredictorError, "Colors must be between 1 and 4"
50
+ end
51
+
52
+ unless [1,2,4,8,16].include?(bpc.to_i)
53
+ raise PredictorError, "BitsPerComponent must be in 1, 2, 4, 8 or 16"
54
+ end
55
+
56
+ # components per line
57
+ nvals = columns * colors
58
+
59
+ # bytes per pixel
60
+ bpp = (colors * bpc + 7) >> 3
61
+
62
+ # bytes per row
63
+ bpr = (nvals * bpc + 7) >> 3
64
+
65
+ unless data.size % bpr == 0
66
+ raise PredictorError, "Invalid data size #{data.size}, should be multiple of bpr=#{bpr}"
67
+ end
68
+
69
+ if predictor == TIFF
70
+ do_tiff_pre_prediction(data, colors, bpc, columns)
71
+ elsif predictor >= 10 # PNG
72
+ do_png_pre_prediction(data, predictor, bpp, bpr)
73
+ else
74
+ raise PredictorError, "Unknown predictor : #{predictor}"
75
+ end
76
+ end
77
+
78
+ def self.do_post_prediction(data, predictor = NONE, colors = 1, bpc = 8, columns = 1)
79
+
80
+ return data if predictor == NONE
81
+
82
+ unless (1..4) === colors
83
+ raise PredictorError, "Colors must be between 1 and 4"
84
+ end
85
+
86
+ unless [1,2,4,8,16].include?(bpc)
87
+ raise PredictorError, "BitsPerComponent must be in 1, 2, 4, 8 or 16"
88
+ end
89
+
90
+ # components per line
91
+ nvals = columns * colors
92
+
93
+ # bytes per pixel
94
+ bpp = (colors * bpc + 7) >> 3
95
+
96
+ # bytes per row
97
+ bpr = ((nvals * bpc + 7) >> 3) + 1
98
+
99
+ if predictor == TIFF
100
+ do_tiff_post_prediction(data, colors, bpc, columns)
101
+ elsif predictor >= 10 # PNG
102
+ do_png_post_prediction(data, bpp, bpr)
103
+ else
104
+ raise PredictorError, "Unknown predictor : #{predictor}"
105
+ end
106
+ end
107
+
108
+ def self.do_png_post_prediction(data, bpp, bpr)
109
+
110
+ result = ""
111
+ uprow = "\0" * bpr
112
+ thisrow = "\0" * bpr
113
+ nrows = (data.size + bpr - 1) / bpr
114
+
115
+ nrows.times do |irow|
116
+
117
+ line = data[irow * bpr, bpr]
118
+ predictor = 10 + line[0].ord
119
+ line[0] = "\0"
120
+
121
+ for i in (1..line.size-1)
122
+ up = uprow[i].ord
123
+
124
+ if bpp > i
125
+ left = upleft = 0
126
+ else
127
+ left = line[i-bpp].ord
128
+ upleft = uprow[i-bpp].ord
129
+ end
130
+
131
+ case predictor
132
+ when PNG_NONE
133
+ thisrow = line
134
+ when PNG_SUB
135
+ thisrow[i] = ((line[i].ord + left) & 0xFF).chr
136
+ when PNG_UP
137
+ thisrow[i] = ((line[i].ord + up) & 0xFF).chr
138
+ when PNG_AVERAGE
139
+ thisrow[i] = ((line[i].ord + ((left + up) / 2)) & 0xFF).chr
140
+ when PNG_PAETH
141
+ p = left + up - upleft
142
+ pa, pb, pc = (p - left).abs, (p - up).abs, (p - upleft).abs
143
+
144
+ thisrow[i] = ((line[i].ord +
145
+ case [ pa, pb, pc ].min
146
+ when pa then left
147
+ when pb then up
148
+ when pc then upleft
149
+ end
150
+ ) & 0xFF).chr
151
+ else
152
+ puts "Unknown PNG predictor : #{predictor}"
153
+ thisrow = line
154
+ end
155
+
156
+ end
157
+
158
+ result << thisrow[1..-1]
159
+ uprow = thisrow
160
+ end
161
+
162
+ result
163
+ end
164
+
165
+ def self.do_png_pre_prediction(data, predictor, bpp, bpr)
166
+
167
+ result = ""
168
+ nrows = data.size / bpr
169
+
170
+ line = "\0" + data[-bpr, bpr]
171
+
172
+ (nrows-1).downto(0) do |irow|
173
+
174
+ uprow =
175
+ if irow == 0
176
+ "\0" * (bpr+1)
177
+ else
178
+ "\0" + data[(irow-1)*bpr,bpr]
179
+ end
180
+
181
+ bpr.downto(1) do |i|
182
+
183
+ up = uprow[i].ord
184
+ left = line[i-bpp].ord
185
+ upleft = uprow[i-bpp].ord
186
+
187
+ case predictor
188
+ when PNG_SUB
189
+ line[i] = ((line[i].ord - left) & 0xFF).chr
190
+ when PNG_UP
191
+ line[i] = ((line[i].ord - up) & 0xFF).chr
192
+ when PNG_AVERAGE
193
+ line[i] = ((line[i].ord - ((left + up) / 2)) & 0xFF).chr
194
+ when PNG_PAETH
195
+ p = left + up - upleft
196
+ pa, pb, pc = (p - left).abs, (p - up).abs, (p - upleft).abs
197
+
198
+ line[i] = ((line[i].ord -
199
+ case [ pa, pb, pc ].min
200
+ when pa then left
201
+ when pb then up
202
+ when pc then upleft
203
+ end
204
+ ) & 0xFF).chr
205
+ when PNG_NONE
206
+ else
207
+ raise PredictorError, "Unsupported PNG predictor : #{predictor}"
208
+ end
209
+
210
+ end
211
+
212
+ line[0] = (predictor - 10).chr
213
+ result = line + result
214
+
215
+ line = uprow
216
+ end
217
+
218
+ result
219
+ end
220
+
221
+ def self.do_tiff_post_prediction(data, colors, bpc, columns) #:nodoc:
222
+
223
+ bpr = (colors * bpc * columns + 7) >> 3
224
+ nrows = data.size / bpr
225
+ bitmask = (1 << bpc) - 1
226
+ result = Utils::BitWriter.new
227
+
228
+ nrows.times do |irow|
229
+ line = Utils::BitReader.new(data[irow * bpr, bpr])
230
+
231
+ pixel = ::Array.new(colors, 0)
232
+ columns.times do
233
+ diffpixel = ::Array.new(colors) { line.read(bpc) }
234
+ pixel = pixel.zip(diffpixel).map!{|c, diff| (c + diff) & bitmask}
235
+
236
+ pixel.each do |c|
237
+ result.write(c, bpc)
238
+ end
239
+ end
240
+
241
+ result.final
242
+ end
243
+
244
+ result.final.to_s
245
+ end
246
+
247
+ def self.do_tiff_pre_prediction(data, colors, bpc, columns) #:nodoc:
248
+
249
+ bpr = (colors * bpc * columns + 7) >> 3
250
+ nrows = data.size / bpr
251
+ bitmask = (1 << bpc) - 1
252
+ result = Utils::BitWriter.new
253
+
254
+ nrows.times do |irow|
255
+ line = Utils::BitReader.new(data[irow * bpr, bpr])
256
+
257
+ diffpixel = ::Array.new(colors, 0)
258
+ columns.times do
259
+ pixel = ::Array.new(colors) { line.read(bpc) }
260
+ diffpixel = diffpixel.zip(pixel).map!{|diff, c| (c - diff) & bitmask}
261
+
262
+ diffpixel.each do |c|
263
+ result.write(c, bpc)
264
+ end
265
+ end
266
+
267
+ result.final
268
+ end
269
+
270
+ result.final.to_s
271
+ end
272
+ end
273
+
274
+ end
275
+ end
276
+
@@ -0,0 +1,117 @@
1
+ =begin
2
+
3
+ = File
4
+ filters/runlength.rb
5
+
6
+ = Info
7
+ This file is part of Origami, PDF manipulation framework for Ruby
8
+ Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org>
9
+ All right reserved.
10
+
11
+ Origami is free software: you can redistribute it and/or modify
12
+ it under the terms of the GNU Lesser General Public License as published by
13
+ the Free Software Foundation, either version 3 of the License, or
14
+ (at your option) any later version.
15
+
16
+ Origami is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ GNU Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public License
22
+ along with Origami. If not, see <http://www.gnu.org/licenses/>.
23
+
24
+ =end
25
+
26
+ module Origami
27
+
28
+ module Filter
29
+
30
+ class InvalidRunLengthDataError < Exception #:nodoc:
31
+ end
32
+
33
+ #
34
+ # Class representing a Filter used to encode and decode data using RLE compression algorithm.
35
+ #
36
+ class RunLength
37
+ include Filter
38
+
39
+ EOD = 128 #:nodoc:
40
+
41
+ #
42
+ # Encodes data using RLE compression method.
43
+ # _stream_:: The data to encode.
44
+ #
45
+ def encode(stream)
46
+
47
+ result = ""
48
+ i = 0
49
+
50
+ while i < stream.size
51
+
52
+ #
53
+ # How many identical bytes coming?
54
+ #
55
+ length = 1
56
+ while i+1 < stream.size and length < EOD and stream[i] == stream[i+1]
57
+ length = length + 1
58
+ i = i + 1
59
+ end
60
+
61
+ #
62
+ # If more than 1, then compress them.
63
+ #
64
+ if length > 1
65
+ result << (257 - length).chr << stream[i,1]
66
+
67
+ #
68
+ # Otherwise how many different bytes to copy ?
69
+ #
70
+ else
71
+ j = i
72
+ while j+1 < stream.size and (j - i + 1) < EOD and stream[j] != stream[j+1]
73
+ j = j + 1
74
+ end
75
+
76
+ length = j - i
77
+ result << length.chr << stream[i, length+1]
78
+
79
+ i = j
80
+ end
81
+
82
+ i = i + 1
83
+ end
84
+
85
+ result << EOD.chr
86
+ end
87
+
88
+
89
+ #
90
+ # Decodes data using RLE decompression method.
91
+ # _stream_:: The data to decode.
92
+ #
93
+ def decode(stream)
94
+ raise InvalidRunLengthDataError, "No end marker" unless stream.include?(EOD.chr)
95
+
96
+ i = 0
97
+ result = ""
98
+ until stream[i].ord == EOD do
99
+
100
+ length = stream[i]
101
+ if length < EOD
102
+ result << stream[i + 1, length + 1]
103
+ i = i + length + 2
104
+ else
105
+ result << stream[i + 1,1] * (257 - length)
106
+ i = i + 2
107
+ end
108
+
109
+ end
110
+
111
+ result
112
+ end
113
+
114
+ end
115
+ end
116
+ end
117
+
@@ -0,0 +1,209 @@
1
+ =begin
2
+
3
+ = File
4
+ font.rb
5
+
6
+ = Info
7
+ This file is part of Origami, PDF manipulation framework for Ruby
8
+ Copyright (C) 2010 Guillaume Delugr� <guillaume@security-labs.org>
9
+ All right reserved.
10
+
11
+ Origami is free software: you can redistribute it and/or modify
12
+ it under the terms of the GNU Lesser General Public License as published by
13
+ the Free Software Foundation, either version 3 of the License, or
14
+ (at your option) any later version.
15
+
16
+ Origami is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ GNU Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public License
22
+ along with Origami. If not, see <http://www.gnu.org/licenses/>.
23
+
24
+ =end
25
+
26
+ module Origami
27
+
28
+ #
29
+ # Class representing a rendering font in a document.
30
+ #
31
+ class Font < Dictionary
32
+
33
+ include StandardObject
34
+
35
+ field :Type, :Type => Name, :Default => :Font, :Required => true
36
+ field :Subtype, :Type => Name, :Default => :Type1, :Required => true
37
+ field :Name, :Type => Name
38
+ field :FirstChar, :Type => Integer
39
+ field :LastChar, :Type => Integer
40
+ field :Widths, :Type => Array
41
+ field :FontDescriptor, :Type => Dictionary
42
+ field :Encoding, :Type => [ Name, Dictionary ], :Default => :MacRomanEncoding
43
+ field :ToUnicode, :Type => Stream, :Version => "1.2"
44
+
45
+ # TODO: Type0 and CID Fonts
46
+
47
+ #
48
+ # Type1 Fonts.
49
+ #
50
+ class Type1 < Font
51
+
52
+ field :BaseFont, :Type => Name, :Default => :Helvetica, :Required => true
53
+ field :Subtype, :Type => Name, :Default => :Type1, :Required => true
54
+
55
+ #
56
+ # 14 standard Type1 fonts.
57
+ #
58
+ module Standard
59
+
60
+ class TimesRoman < Type1
61
+ field :BaseFont, :Type => Name, :Default => :"Times-Roman", :Required => true
62
+ end
63
+
64
+ class Helvetica < Type1
65
+ field :BaseFont, :Type => Name, :Default => :Helvetica, :Required => true
66
+ end
67
+
68
+ class Courier < Type1
69
+ field :BaseFont, :Type => Name, :Default => :Courier, :Required => true
70
+ end
71
+
72
+ class Symbol < Type1
73
+ field :BaseFont, :Type => Name, :Default => :Symbol, :Required => true
74
+ end
75
+
76
+ class TimesBold < Type1
77
+ field :BaseFont, :Type => Name, :Default => :"Times-Bold", :Required => true
78
+ end
79
+
80
+ class HelveticaBold < Type1
81
+ field :BaseFont, :Type => Name, :Default => :"Helvetica-Bold", :Required => true
82
+ end
83
+
84
+ class CourierBold < Type1
85
+ field :BaseFont, :Type => Name, :Default => :"Courier-Bold", :Required => true
86
+ end
87
+
88
+ class ZapfDingbats < Type1
89
+ field :BaseFont, :Type => Name, :Default => :ZapfDingbats, :Required => true
90
+ end
91
+
92
+ class TimesItalic < Type1
93
+ field :BaseFont, :Type => Name, :Default => :"Times-Italic", :Required => true
94
+ end
95
+
96
+ class HelveticaOblique < Type1
97
+ field :BaseFont, :Type => Name, :Default => :"Helvetica-Oblique", :Required => true
98
+ end
99
+
100
+ class CourierOblique < Type1
101
+ field :BaseFont, :Type => Name, :Default => :"Courier-Oblique", :Required => true
102
+ end
103
+
104
+ class TimesBoldItalic < Type1
105
+ field :BaseFont, :Type => Name, :Default => :"Times-BoldItalic", :Required => true
106
+ end
107
+
108
+ class HelveticaBoldOblique < Type1
109
+ field :BaseFont, :Type => Name, :Default => :"Helvetica-BoldOblique", :Required => true
110
+ end
111
+
112
+ class CourierBoldOblique < Type1
113
+ field :BaseFont, :Type => Name, :Default => :"Courier-BoldOblique", :Required => true
114
+ end
115
+
116
+ end
117
+
118
+ end
119
+
120
+ #
121
+ # TrueType Fonts
122
+ #
123
+ class TrueType < Font
124
+ field :Subtype, :Type => Name, :Default => :TrueType, :Required => true
125
+ end
126
+
127
+ #
128
+ # Type 3 Fonts
129
+ #
130
+ class Type3 < Font
131
+
132
+ field :Subtype, :Type => Name, :Default => :Type3, :Required => true
133
+ field :FontBBox, :Type => Array, :Required => true
134
+ field :FontMatrix, :Type => Array, :Required => true
135
+ field :CharProcs, :Type => Dictionary, :Required => true
136
+ field :Resources, :Type => Dictionary, :Version => "1.2"
137
+
138
+ end
139
+
140
+ end
141
+
142
+ #
143
+ # Embedded font stream.
144
+ #
145
+ class FontStream < Stream
146
+
147
+ field :Subtype, :Type => Name
148
+ field :Length1, :Type => Integer
149
+ field :Length2, :Type => Integer
150
+ field :Length3, :Type => Integer
151
+
152
+ end
153
+
154
+ #
155
+ # Class representing a font details in a document.
156
+ #
157
+ class FontDescriptor < Dictionary
158
+
159
+ include StandardObject
160
+
161
+ FIXEDPITCH = 1 << 1
162
+ SERIF = 1 << 2
163
+ SYMBOLIC = 1 << 3
164
+ SCRIPT = 1 << 4
165
+ NONSYMBOLIC = 1 << 6
166
+ ITALIC = 1 << 7
167
+ ALLCAP = 1 << 17
168
+ SMALLCAP = 1 << 18
169
+ FORCEBOLD = 1 << 19
170
+
171
+ field :Type, :Type => Name, :Default => :FontDescriptor, :Required => true
172
+ field :FontName, :Type => Name, :Required => true
173
+ field :FontFamily, :Type => ByteString, :Version => "1.5"
174
+ field :FontStretch, :Type => Name, :Default => :Normal, :Version => "1.5"
175
+ field :FontWeight, :Type => Integer, :Default => 400, :Version => "1.5"
176
+ field :Flags, :Type => Integer, :Required => true
177
+ field :FontBBox, :Type => Array
178
+ field :ItalicAngle, :Type => Number, :Required => true
179
+ field :Ascent, :Type => Number
180
+ field :Descent, :Type => Number
181
+ field :Leading, :Type => Number, :Default => 0
182
+ field :CapHeight, :Type => Number
183
+ field :XHeight, :Type => Number, :Default => 0
184
+ field :StemV, :Type => Number
185
+ field :StemH, :Type => Number, :Default => 0
186
+ field :AvgWidth, :Type => Number, :Default => 0
187
+ field :MaxWidth, :Type => Number, :Default => 0
188
+ field :MissingWidth, :Type => Number, :Default => 0
189
+ field :FontFile, :Type => Stream
190
+ field :FontFile2, :Type => Stream, :Version => "1.1"
191
+ field :FontFile3, :Type => Stream, :Version => "1.2"
192
+ field :CharSet, :Type => ByteString, :Version => "1.1"
193
+
194
+ end
195
+
196
+ #
197
+ # Class representing a character encoding in a document.
198
+ #
199
+ class Encoding < Dictionary
200
+
201
+ include StandardObject
202
+
203
+ field :Type, :Type => Name, :Default => :Encoding
204
+ field :BaseEncoding, :Type => Name
205
+ field :Differences, :Type => Array
206
+
207
+ end
208
+
209
+ end