prawn 0.4.1 → 0.5.0.1

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 (179) hide show
  1. data/lib/prawn.rb +2 -72
  2. metadata +33 -224
  3. data/COPYING +0 -340
  4. data/LICENSE +0 -56
  5. data/README +0 -40
  6. data/Rakefile +0 -79
  7. data/data/encodings/win_ansi.txt +0 -29
  8. data/data/fonts/Action Man.dfont +0 -0
  9. data/data/fonts/Activa.ttf +0 -0
  10. data/data/fonts/Chalkboard.ttf +0 -0
  11. data/data/fonts/Courier-Bold.afm +0 -342
  12. data/data/fonts/Courier-BoldOblique.afm +0 -342
  13. data/data/fonts/Courier-Oblique.afm +0 -342
  14. data/data/fonts/Courier.afm +0 -342
  15. data/data/fonts/DejaVuSans.ttf +0 -0
  16. data/data/fonts/Dustismo_Roman.ttf +0 -0
  17. data/data/fonts/Helvetica-Bold.afm +0 -2827
  18. data/data/fonts/Helvetica-BoldOblique.afm +0 -2827
  19. data/data/fonts/Helvetica-Oblique.afm +0 -3051
  20. data/data/fonts/Helvetica.afm +0 -3051
  21. data/data/fonts/MustRead.html +0 -19
  22. data/data/fonts/Symbol.afm +0 -213
  23. data/data/fonts/Times-Bold.afm +0 -2588
  24. data/data/fonts/Times-BoldItalic.afm +0 -2384
  25. data/data/fonts/Times-Italic.afm +0 -2667
  26. data/data/fonts/Times-Roman.afm +0 -2419
  27. data/data/fonts/ZapfDingbats.afm +0 -225
  28. data/data/fonts/comicsans.ttf +0 -0
  29. data/data/fonts/gkai00mp.ttf +0 -0
  30. data/data/images/arrow.png +0 -0
  31. data/data/images/arrow2.png +0 -0
  32. data/data/images/barcode_issue.png +0 -0
  33. data/data/images/dice.alpha +0 -0
  34. data/data/images/dice.dat +0 -0
  35. data/data/images/dice.png +0 -0
  36. data/data/images/fractal.jpg +0 -0
  37. data/data/images/letterhead.jpg +0 -0
  38. data/data/images/page_white_text.alpha +0 -0
  39. data/data/images/page_white_text.dat +0 -0
  40. data/data/images/page_white_text.png +0 -0
  41. data/data/images/pigs.jpg +0 -0
  42. data/data/images/rails.dat +0 -0
  43. data/data/images/rails.png +0 -0
  44. data/data/images/ruport.png +0 -0
  45. data/data/images/ruport_data.dat +0 -0
  46. data/data/images/ruport_transparent.png +0 -0
  47. data/data/images/ruport_type0.png +0 -0
  48. data/data/images/stef.jpg +0 -0
  49. data/data/images/web-links.dat +0 -1
  50. data/data/images/web-links.png +0 -0
  51. data/data/shift_jis_text.txt +0 -1
  52. data/examples/bounding_box/bounding_boxes.rb +0 -44
  53. data/examples/bounding_box/lazy_bounding_boxes.rb +0 -28
  54. data/examples/bounding_box/padded_box.rb +0 -24
  55. data/examples/bounding_box/russian_boxes.rb +0 -37
  56. data/examples/general/background.rb +0 -20
  57. data/examples/general/canvas.rb +0 -16
  58. data/examples/general/measurement_units.rb +0 -52
  59. data/examples/general/multi_page_layout.rb +0 -17
  60. data/examples/general/page_geometry.rb +0 -32
  61. data/examples/graphics/basic_images.rb +0 -27
  62. data/examples/graphics/cmyk.rb +0 -13
  63. data/examples/graphics/curves.rb +0 -12
  64. data/examples/graphics/hexagon.rb +0 -14
  65. data/examples/graphics/image_fit.rb +0 -16
  66. data/examples/graphics/image_flow.rb +0 -38
  67. data/examples/graphics/image_position.rb +0 -18
  68. data/examples/graphics/line.rb +0 -33
  69. data/examples/graphics/png_types.rb +0 -23
  70. data/examples/graphics/polygons.rb +0 -17
  71. data/examples/graphics/remote_images.rb +0 -12
  72. data/examples/graphics/ruport_style_helpers.rb +0 -20
  73. data/examples/graphics/stroke_bounds.rb +0 -23
  74. data/examples/m17n/chinese_text_wrapping.rb +0 -20
  75. data/examples/m17n/euro.rb +0 -16
  76. data/examples/m17n/sjis.rb +0 -29
  77. data/examples/m17n/utf8.rb +0 -14
  78. data/examples/m17n/win_ansi_charset.rb +0 -55
  79. data/examples/text/alignment.rb +0 -19
  80. data/examples/text/dfont.rb +0 -49
  81. data/examples/text/family_based_styling.rb +0 -25
  82. data/examples/text/flowing_text_with_header_and_footer.rb +0 -37
  83. data/examples/text/font_calculations.rb +0 -92
  84. data/examples/text/font_size.rb +0 -34
  85. data/examples/text/kerning.rb +0 -31
  86. data/examples/text/simple_text.rb +0 -18
  87. data/examples/text/simple_text_ttf.rb +0 -18
  88. data/examples/text/span.rb +0 -30
  89. data/examples/text/text_box.rb +0 -26
  90. data/examples/text/text_flow.rb +0 -68
  91. data/lib/prawn/compatibility.rb +0 -38
  92. data/lib/prawn/document.rb +0 -309
  93. data/lib/prawn/document/annotations.rb +0 -63
  94. data/lib/prawn/document/bounding_box.rb +0 -368
  95. data/lib/prawn/document/destinations.rb +0 -81
  96. data/lib/prawn/document/internals.rb +0 -126
  97. data/lib/prawn/document/page_geometry.rb +0 -79
  98. data/lib/prawn/document/span.rb +0 -55
  99. data/lib/prawn/document/text.rb +0 -185
  100. data/lib/prawn/document/text/box.rb +0 -76
  101. data/lib/prawn/document/text/wrapping.rb +0 -59
  102. data/lib/prawn/encoding.rb +0 -121
  103. data/lib/prawn/errors.rb +0 -40
  104. data/lib/prawn/font.rb +0 -277
  105. data/lib/prawn/font/afm.rb +0 -202
  106. data/lib/prawn/font/dfont.rb +0 -31
  107. data/lib/prawn/font/ttf.rb +0 -326
  108. data/lib/prawn/graphics.rb +0 -257
  109. data/lib/prawn/graphics/color.rb +0 -140
  110. data/lib/prawn/images.rb +0 -339
  111. data/lib/prawn/images/jpg.rb +0 -45
  112. data/lib/prawn/images/png.rb +0 -199
  113. data/lib/prawn/literal_string.rb +0 -14
  114. data/lib/prawn/measurement_extensions.rb +0 -46
  115. data/lib/prawn/measurements.rb +0 -71
  116. data/lib/prawn/name_tree.rb +0 -165
  117. data/lib/prawn/pdf_object.rb +0 -73
  118. data/lib/prawn/reference.rb +0 -59
  119. data/spec/annotations_spec.rb +0 -90
  120. data/spec/bounding_box_spec.rb +0 -141
  121. data/spec/destinations_spec.rb +0 -15
  122. data/spec/document_spec.rb +0 -193
  123. data/spec/font_spec.rb +0 -234
  124. data/spec/graphics_spec.rb +0 -209
  125. data/spec/images_spec.rb +0 -68
  126. data/spec/jpg_spec.rb +0 -25
  127. data/spec/measurement_units_spec.rb +0 -23
  128. data/spec/name_tree_spec.rb +0 -103
  129. data/spec/pdf_object_spec.rb +0 -112
  130. data/spec/png_spec.rb +0 -196
  131. data/spec/reference_spec.rb +0 -42
  132. data/spec/spec_helper.rb +0 -23
  133. data/spec/text_spec.rb +0 -178
  134. data/vendor/pdf-inspector/README +0 -18
  135. data/vendor/pdf-inspector/lib/pdf/inspector.rb +0 -25
  136. data/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +0 -80
  137. data/vendor/pdf-inspector/lib/pdf/inspector/page.rb +0 -16
  138. data/vendor/pdf-inspector/lib/pdf/inspector/text.rb +0 -31
  139. data/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +0 -19
  140. data/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
  141. data/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
  142. data/vendor/ttfunk/example.rb +0 -45
  143. data/vendor/ttfunk/lib/ttfunk.rb +0 -102
  144. data/vendor/ttfunk/lib/ttfunk/directory.rb +0 -17
  145. data/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +0 -88
  146. data/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +0 -69
  147. data/vendor/ttfunk/lib/ttfunk/reader.rb +0 -44
  148. data/vendor/ttfunk/lib/ttfunk/resource_file.rb +0 -78
  149. data/vendor/ttfunk/lib/ttfunk/subset.rb +0 -18
  150. data/vendor/ttfunk/lib/ttfunk/subset/base.rb +0 -141
  151. data/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +0 -46
  152. data/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +0 -48
  153. data/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +0 -63
  154. data/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +0 -51
  155. data/vendor/ttfunk/lib/ttfunk/subset_collection.rb +0 -72
  156. data/vendor/ttfunk/lib/ttfunk/table.rb +0 -46
  157. data/vendor/ttfunk/lib/ttfunk/table/cmap.rb +0 -34
  158. data/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +0 -54
  159. data/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +0 -126
  160. data/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +0 -79
  161. data/vendor/ttfunk/lib/ttfunk/table/glyf.rb +0 -64
  162. data/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +0 -81
  163. data/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +0 -37
  164. data/vendor/ttfunk/lib/ttfunk/table/head.rb +0 -44
  165. data/vendor/ttfunk/lib/ttfunk/table/hhea.rb +0 -41
  166. data/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +0 -47
  167. data/vendor/ttfunk/lib/ttfunk/table/kern.rb +0 -79
  168. data/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +0 -62
  169. data/vendor/ttfunk/lib/ttfunk/table/loca.rb +0 -43
  170. data/vendor/ttfunk/lib/ttfunk/table/maxp.rb +0 -40
  171. data/vendor/ttfunk/lib/ttfunk/table/name.rb +0 -119
  172. data/vendor/ttfunk/lib/ttfunk/table/os2.rb +0 -78
  173. data/vendor/ttfunk/lib/ttfunk/table/post.rb +0 -91
  174. data/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +0 -43
  175. data/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +0 -35
  176. data/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +0 -23
  177. data/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +0 -17
  178. data/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +0 -17
  179. data/vendor/ttfunk/lib/ttfunk/table/simple.rb +0 -14
@@ -1,42 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- describe "A Reference object" do
6
- it "should produce a PDF reference on #to_s call" do
7
- ref = Prawn::Reference(1,true)
8
- ref.to_s.should == "1 0 R"
9
- end
10
-
11
- it "should allow changing generation number" do
12
- ref = Prawn::Reference(1,true)
13
- ref.gen = 1
14
- ref.to_s.should == "1 1 R"
15
- end
16
-
17
- it "should generate a valid PDF object for the referenced data" do
18
- ref = Prawn::Reference(2,[1,"foo"])
19
- ref.object.should == "2 0 obj\n#{Prawn::PdfObject([1,"foo"])}\nendobj\n"
20
- end
21
-
22
- it "should automatically open a stream when #<< is used" do
23
- ref = Prawn::Reference(1, :Length => 41)
24
- ref << "BT\n/F1 12 Tf\n72 712 Td\n( A stream ) Tj\nET"
25
- ref.object.should == "1 0 obj\n<< /Length 41\n>>\nstream"+
26
- "\nBT\n/F1 12 Tf\n72 712 Td\n( A stream ) Tj\nET" +
27
- "\nendstream\nendobj\n"
28
- end
29
-
30
- it "should compress a stream upon request" do
31
- ref = Prawn::Reference(2,{})
32
- ref << "Hi There " * 20
33
-
34
- cref = Prawn::Reference(2,{})
35
- cref << "Hi There " * 20
36
- cref.compress_stream
37
-
38
- assert cref.stream.size < ref.stream.size,
39
- "compressed stream expected to be smaller than source but wasn't"
40
- cref.data[:Filter].should == :FlateDecode
41
- end
42
- end
data/spec/spec_helper.rb DELETED
@@ -1,23 +0,0 @@
1
- # encoding: utf-8
2
-
3
- puts "Prawn specs: Running on Ruby Version: #{RUBY_VERSION}"
4
-
5
- require "rubygems"
6
- require "test/spec"
7
- require "mocha"
8
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
9
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'vendor','pdf-inspector','lib')
10
- require "prawn"
11
-
12
- Prawn.debug = true
13
-
14
- gem 'pdf-reader', ">=0.7.3"
15
- require "pdf/reader"
16
- require "pdf/inspector"
17
-
18
- def create_pdf(klass=Prawn::Document)
19
- @pdf = klass.new(:left_margin => 0,
20
- :right_margin => 0,
21
- :top_margin => 0,
22
- :bottom_margin => 0)
23
- end
data/spec/text_spec.rb DELETED
@@ -1,178 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
4
-
5
- describe "when drawing text" do
6
-
7
- before(:each) { create_pdf }
8
-
9
- it "should advance down the document based on font_height" do
10
- position = @pdf.y
11
- @pdf.text "Foo"
12
-
13
- @pdf.y.should.be.close(position - @pdf.font.height, 0.0001)
14
-
15
- position = @pdf.y
16
- @pdf.text "Foo\nBar\nBaz"
17
- @pdf.y.should.be.close(position - 3*@pdf.font.height, 0.0001)
18
- end
19
-
20
- it "should advance down the document based on font ascender only if final_gap is given" do
21
- position = @pdf.y
22
- @pdf.text "Foo", :final_gap => false
23
-
24
- @pdf.y.should.be.close(position - @pdf.font.ascender, 0.0001)
25
-
26
- position = @pdf.y
27
- @pdf.text "Foo\nBar\nBaz", :final_gap => false
28
- @pdf.y.should.be.close(position - 2*@pdf.font.height - @pdf.font.ascender, 0.0001)
29
- end
30
-
31
- it "should default to 12 point helvetica" do
32
- @pdf.text "Blah", :at => [100,100]
33
- text = PDF::Inspector::Text.analyze(@pdf.render)
34
- text.font_settings[0][:name].should == :Helvetica
35
- text.font_settings[0][:size].should == 12
36
- text.strings.first.should == "Blah"
37
- end
38
-
39
- it "should allow setting font size" do
40
- @pdf.text "Blah", :at => [100,100], :size => 16
41
- text = PDF::Inspector::Text.analyze(@pdf.render)
42
- text.font_settings[0][:size].should == 16
43
- end
44
-
45
- it "should allow setting a default font size" do
46
- @pdf.font_size = 16
47
- @pdf.text "Blah"
48
- text = PDF::Inspector::Text.analyze(@pdf.render)
49
- text.font_settings[0][:size].should == 16
50
- end
51
-
52
- it "should allow setting font size in DSL style" do
53
- @pdf.font_size 20
54
- @pdf.font_size.should == 20
55
- end
56
-
57
- it "should allow overriding default font for a single instance" do
58
- @pdf.font_size = 16
59
-
60
- @pdf.text "Blah", :size => 11
61
- @pdf.text "Blaz"
62
- text = PDF::Inspector::Text.analyze(@pdf.render)
63
- text.font_settings[0][:size].should == 11
64
- text.font_settings[1][:size].should == 16
65
- end
66
-
67
- it "should allow setting a font size transaction with a block" do
68
- @pdf.font_size 16 do
69
- @pdf.text 'Blah'
70
- end
71
-
72
- @pdf.text 'blah'
73
-
74
- text = PDF::Inspector::Text.analyze(@pdf.render)
75
- text.font_settings[0][:size].should == 16
76
- text.font_settings[1][:size].should == 12
77
- end
78
-
79
- it "should allow manual setting the font size " +
80
- "when in a font size block" do
81
- @pdf.font_size(16) do
82
- @pdf.text 'Foo'
83
- @pdf.text 'Blah', :size => 11
84
- @pdf.text 'Blaz'
85
- end
86
- text = PDF::Inspector::Text.analyze(@pdf.render)
87
- text.font_settings[0][:size].should == 16
88
- text.font_settings[1][:size].should == 11
89
- text.font_settings[2][:size].should == 16
90
- end
91
-
92
- it "should allow registering of built-in font_settings on the fly" do
93
- @pdf.font "Times-Roman"
94
- @pdf.text "Blah", :at => [100,100]
95
- @pdf.font "Courier"
96
- @pdf.text "Blaz", :at => [150,150]
97
- text = PDF::Inspector::Text.analyze(@pdf.render)
98
- text.font_settings[0][:name].should == :"Times-Roman"
99
- text.font_settings[1][:name].should == :Courier
100
- end
101
-
102
- it "should utilise the same default font across multiple pages" do
103
- @pdf.text "Blah", :at => [100,100]
104
- @pdf.start_new_page
105
- @pdf.text "Blaz", :at => [150,150]
106
- text = PDF::Inspector::Text.analyze(@pdf.render)
107
-
108
- text.font_settings.size.should == 2
109
- text.font_settings[0][:name].should == :Helvetica
110
- text.font_settings[1][:name].should == :Helvetica
111
- end
112
-
113
- it "should raise an exception when an unknown font is used" do
114
- lambda { @pdf.font "Pao bu" }.should.raise(Prawn::Errors::UnknownFont)
115
- end
116
-
117
- it "should correctly render a utf-8 string when using a built-in font" do
118
- str = "©" # copyright symbol
119
- @pdf.text str
120
-
121
- # grab the text from the rendered PDF and ensure it matches
122
- text = PDF::Inspector::Text.analyze(@pdf.render)
123
- text.strings.first.should == str
124
- end
125
-
126
- if "spec".respond_to?(:encode!)
127
- # Handle non utf-8 string encodings in a sane way on M17N aware VMs
128
- it "should raise an exception when a utf-8 incompatible string is rendered" do
129
- str = "Blah \xDD"
130
- str.force_encoding("ASCII-8BIT")
131
- lambda { @pdf.text str }.should.raise(ArgumentError)
132
- end
133
- it "should not raise an exception when a shift-jis string is rendered" do
134
- datafile = "#{Prawn::BASEDIR}/data/shift_jis_text.txt"
135
- sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
136
- @pdf.font("#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf")
137
- lambda { @pdf.text sjis_str }.should.not.raise(ArgumentError)
138
- end
139
- else
140
- # Handle non utf-8 string encodings in a sane way on non-M17N aware VMs
141
- it "should raise an exception when a corrupt utf-8 string is rendered" do
142
- str = "Blah \xDD"
143
- lambda { @pdf.text str }.should.raise(ArgumentError)
144
- end
145
- it "should raise an exception when a shift-jis string is rendered" do
146
- sjis_str = File.read("#{Prawn::BASEDIR}/data/shift_jis_text.txt")
147
- lambda { @pdf.text sjis_str }.should.raise(ArgumentError)
148
- end
149
- end
150
-
151
- it "should wrap text" do
152
- @pdf = Prawn::Document.new
153
- @pdf.font "Courier"
154
-
155
- text = "Please wrap this text about HERE. More text that should be wrapped"
156
- expect = "Please wrap this text about\nHERE. More text that should be\nwrapped"
157
-
158
- @pdf.naive_wrap(text, 220, @pdf.font_size).should == expect
159
- end
160
-
161
- it "should respect end of line when wrapping text" do
162
- @pdf = Prawn::Document.new
163
- @pdf.font "Courier"
164
- text = "Please wrap only before\nTHIS word. Don't wrap this"
165
- @pdf.naive_wrap(text, 220, @pdf.font_size).should == text
166
- end
167
-
168
- it "should respect end of line when wrapping text and mode is set to 'character'" do
169
- @pdf = Prawn::Document.new
170
- @pdf.font "Courier"
171
-
172
- text = "You can wrap this text HERE"
173
- expect = "You can wrap this text HE\nRE"
174
-
175
- @pdf.naive_wrap(text, 180, @pdf.font_size, :mode => :character).should == expect
176
- end
177
-
178
- end
@@ -1,18 +0,0 @@
1
- PDF::Inspector : A tool for analyzing PDF output
2
-
3
- This library provides a number of PDF::Reader[0] based tools for use in testing
4
- PDF output. Presently, the primary purpose of this tool is to support the
5
- tests found in Prawn[1], a pure Ruby PDF generation library.
6
-
7
- However, it may be useful to others, so we have made it available on Github[2]
8
-
9
- Questions can be directed to the Prawn mailing list[3], but please remember
10
- that this code is not necessarily suitable for production and has no officially
11
- planned release date.
12
-
13
- That having been said, patches are welcome!
14
-
15
- [0] http://github.com/yob/pdf-reader
16
- [1] http://github.com/sandal/prawn
17
- [2] http://github.com/sandal/pdf-inspector
18
- [3] http://groups.google.com/group/prawn-ruby
@@ -1,25 +0,0 @@
1
- require "rubygems"
2
- require "pdf/reader"
3
- require "pdf/inspector/text"
4
- require "pdf/inspector/xobject"
5
- require "pdf/inspector/graphics"
6
- require "pdf/inspector/page"
7
-
8
- module PDF
9
- class Inspector
10
- def self.analyze(output,*args,&block)
11
- obs = self.new(*args, &block)
12
- PDF::Reader.string(output,obs)
13
- obs
14
- end
15
-
16
- def self.analyze_file(filename,*args,&block)
17
- analyze(File.open(filename, "rb") { |f| f.read },*args,&block)
18
- end
19
-
20
- def self.parse(obj)
21
- PDF::Reader::Parser.new(
22
- PDF::Reader::Buffer.new(StringIO.new(obj)), nil).parse_token
23
- end
24
- end
25
- end
@@ -1,80 +0,0 @@
1
- module PDF
2
- class Inspector
3
- module Graphics
4
- class Line < Inspector
5
- attr_accessor :points, :widths
6
-
7
- def initialize
8
- @points = []
9
- @widths = []
10
- end
11
-
12
- def append_line(*params)
13
- @points << params
14
- end
15
-
16
- def begin_new_subpath(*params)
17
- @points << params
18
- end
19
-
20
- def set_line_width(params)
21
- @widths << params
22
- end
23
-
24
- end
25
-
26
- class Rectangle < Inspector
27
- attr_reader :rectangles
28
-
29
- def initialize
30
- @rectangles = []
31
- end
32
-
33
- def append_rectangle(*params)
34
- @rectangles << { :point => params[0..1],
35
- :width => params[2],
36
- :height => params[3] }
37
- end
38
- end
39
-
40
- class Curve < Inspector
41
-
42
- attr_reader :coords
43
-
44
- def initialize
45
- @coords = []
46
- end
47
-
48
- def begin_new_subpath(*params)
49
- @coords += params
50
- end
51
-
52
- def append_curved_segment(*params)
53
- @coords += params
54
- end
55
-
56
- end
57
-
58
- class Color < Inspector
59
- attr_reader :stroke_color, :fill_color, :stroke_color_count,
60
- :fill_color_count
61
-
62
- def initialize
63
- @stroke_color_count = 0
64
- @fill_color_count = 0
65
- end
66
-
67
- def set_rgb_color_for_stroking(*params)
68
- @stroke_color_count += 1
69
- @stroke_color = params
70
- end
71
-
72
- def set_rgb_color_for_nonstroking(*params)
73
- @fill_color_count += 1
74
- @fill_color = params
75
- end
76
- end
77
-
78
- end
79
- end
80
- end
@@ -1,16 +0,0 @@
1
- module PDF
2
- class Inspector
3
- class Page < Inspector
4
- attr_reader :pages
5
-
6
- def initialize
7
- @pages = []
8
- end
9
-
10
- def begin_page(params)
11
- @pages << {:size => params[:MediaBox][-2..-1]}
12
- end
13
-
14
- end
15
- end
16
- end
@@ -1,31 +0,0 @@
1
- module PDF
2
- class Inspector
3
- class Text < Inspector
4
- attr_accessor :font_settings, :size, :strings
5
-
6
- def initialize
7
- @font_settings = []
8
- @fonts = {}
9
- @strings = []
10
- end
11
-
12
- def resource_font(*params)
13
- @fonts[params[0]] = params[1].basefont
14
- end
15
-
16
- def set_text_font_and_size(*params)
17
- @font_settings << { :name => @fonts[params[0]], :size => params[1] }
18
- end
19
-
20
- def show_text(*params)
21
- @strings << params[0]
22
- end
23
-
24
- def show_text_with_positioning(*params)
25
- # ignore kerning information
26
- @strings << params[0].reject { |e| Numeric === e }.join
27
- end
28
-
29
- end
30
- end
31
- end
@@ -1,19 +0,0 @@
1
- module PDF
2
- class Inspector
3
- class XObject < Inspector
4
- attr_accessor :page_xobjects
5
-
6
- def initialize
7
- @page_xobjects = []
8
- end
9
-
10
- def resource_xobject(*params)
11
- @page_xobjects.last << params.first
12
- end
13
-
14
- def begin_page(*params)
15
- @page_xobjects << []
16
- end
17
- end
18
- end
19
- end