prawn 0.13.0 → 0.14.0

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +9 -0
  3. data/Gemfile +7 -14
  4. data/Rakefile +5 -10
  5. data/data/images/16bit.alpha +0 -0
  6. data/data/images/16bit.color +0 -0
  7. data/data/images/dice.alpha +0 -0
  8. data/data/images/dice.color +0 -0
  9. data/data/images/page_white_text.alpha +0 -0
  10. data/data/images/page_white_text.color +0 -0
  11. data/lib/pdf/core/document_state.rb +3 -2
  12. data/lib/pdf/core/graphics_state.rb +29 -8
  13. data/lib/pdf/core/object_store.rb +6 -15
  14. data/lib/pdf/core/pdf_object.rb +8 -33
  15. data/lib/prawn/document/bounding_box.rb +11 -0
  16. data/lib/prawn/document/column_box.rb +12 -4
  17. data/lib/prawn/document.rb +30 -42
  18. data/lib/prawn/encoding.rb +1 -2
  19. data/lib/prawn/font/afm.rb +71 -30
  20. data/lib/prawn/font/dfont.rb +1 -1
  21. data/lib/prawn/font/ttf.rb +10 -2
  22. data/lib/prawn/font.rb +7 -8
  23. data/lib/prawn/graphics.rb +8 -7
  24. data/lib/prawn/image_handler.rb +4 -0
  25. data/lib/prawn/images/jpg.rb +9 -10
  26. data/lib/prawn/images/png.rb +46 -118
  27. data/lib/prawn/images.rb +2 -7
  28. data/lib/prawn/layout.rb +2 -2
  29. data/lib/prawn/measurement_extensions.rb +1 -1
  30. data/lib/prawn/table/cells.rb +6 -2
  31. data/lib/prawn/table/column_width_calculator.rb +55 -0
  32. data/lib/prawn/table.rb +9 -22
  33. data/lib/prawn/templates.rb +75 -0
  34. data/lib/prawn/text/formatted/arranger.rb +1 -5
  35. data/lib/prawn/text/formatted/box.rb +1 -1
  36. data/lib/prawn/text/formatted/fragment.rb +5 -11
  37. data/lib/prawn/text/formatted/line_wrap.rb +4 -25
  38. data/lib/prawn/text/formatted/wrap.rb +1 -4
  39. data/lib/prawn.rb +1 -2
  40. data/manual/document_and_page_options/document_and_page_options.rb +2 -1
  41. data/manual/document_and_page_options/metadata.rb +3 -3
  42. data/manual/document_and_page_options/print_scaling.rb +20 -0
  43. data/manual/example_file.rb +2 -7
  44. data/manual/manual/cover.rb +3 -2
  45. data/manual/manual/manual.rb +1 -2
  46. data/prawn.gemspec +10 -6
  47. data/spec/bounding_box_spec.rb +12 -0
  48. data/spec/column_box_spec.rb +32 -0
  49. data/spec/document_spec.rb +5 -7
  50. data/spec/extensions/encoding_helpers.rb +2 -3
  51. data/spec/filters_spec.rb +1 -1
  52. data/spec/font_spec.rb +3 -2
  53. data/spec/formatted_text_box_spec.rb +14 -25
  54. data/spec/graphics_spec.rb +18 -0
  55. data/spec/image_handler_spec.rb +12 -0
  56. data/spec/images_spec.rb +2 -6
  57. data/spec/line_wrap_spec.rb +2 -2
  58. data/spec/object_store_spec.rb +6 -0
  59. data/spec/outline_spec.rb +10 -10
  60. data/spec/png_spec.rb +9 -12
  61. data/spec/table_spec.rb +55 -2
  62. data/spec/{template_spec.rb → template_spec_obsolete.rb} +2 -1
  63. data/spec/text_at_spec.rb +11 -26
  64. data/spec/text_box_spec.rb +6 -2
  65. data/spec/text_spec.rb +39 -27
  66. metadata +58 -38
  67. data/README.md +0 -109
  68. data/data/images/16bit.dat +0 -0
  69. data/data/images/dice.dat +0 -0
  70. data/data/images/page_white_text.dat +0 -0
  71. data/lib/prawn/compatibility.rb +0 -91
  72. data/manual/templates/full_template.rb +0 -25
  73. data/manual/templates/page_template.rb +0 -48
  74. data/manual/templates/templates.rb +0 -27
data/spec/table_spec.rb CHANGED
@@ -46,6 +46,19 @@ describe "Prawn::Table" do
46
46
  end
47
47
 
48
48
  describe "You can explicitly set the column widths and use a colspan > 1" do
49
+ it "should work with two different given colspans", :issue => 628 do
50
+ data = [
51
+ [" ", " ", " "],
52
+ [{:content=>" ", :colspan=>3}],
53
+ [" ", {:content=>" ", :colspan=>2}]
54
+ ]
55
+ column_widths = [60, 240, 60]
56
+ pdf = Prawn::Document.new
57
+ #the next line raised an Prawn::Errors::CannotFit exception before issue 628 was fixed
58
+ table = Prawn::Table.new data, pdf, :column_widths => column_widths
59
+ table.column_widths.should == column_widths
60
+ end
61
+
49
62
  it "should work with a colspan > 1 with given column_widths (issue #407)" do
50
63
  #normal entries in line 1
51
64
  data = [
@@ -80,6 +93,25 @@ describe "Prawn::Table" do
80
93
 
81
94
  end
82
95
 
96
+ it "should not increase column width when rendering a subtable",
97
+ :unresolved, :issue => 612 do
98
+
99
+ pdf = Prawn::Document.new
100
+
101
+ first = {:content=>"Foooo fo foooooo",:width=>50,:align=>:center}
102
+ second = {:content=>"Foooo",:colspan=>2,:width=>70,:align=>:center}
103
+ third = {:content=>"fooooooooooo, fooooooooooooo, fooo, foooooo fooooo",:width=>50,:align=>:center}
104
+ fourth = {:content=>"Bar",:width=>20,:align=>:center}
105
+
106
+ table_content = [[
107
+ first,
108
+ [[second],[third,fourth]]
109
+ ]]
110
+
111
+ table = Prawn::Table.new table_content, pdf
112
+ table.column_widths.should == [50.0, 70.0]
113
+ end
114
+
83
115
  it "illustrate issue #533" do
84
116
  data = [['', '', '', '', '',''],
85
117
  ['',{:content => '', :colspan => 5}]]
@@ -91,15 +123,36 @@ describe "Prawn::Table" do
91
123
  pdf = Prawn::Document.new
92
124
  first = {:content=>"Foooo fo foooooo",:width=>50,:align=>:center}
93
125
  second = {:content=>"Foooo",:colspan=>2,:width=>70,:align=>:center}
94
- third = {:content=>"fooooooooooo, fooooooooooooo, fooo, foooooo fooooo",:width=>55,:align=>:center}
95
- fourth = {:content=>"Bar",:width=>15,:align=>:center}
126
+ third = {:content=>"fooooooooooo, fooooooooooooo, fooo, foooooo fooooo",:width=>50,:align=>:center}
127
+ fourth = {:content=>"Bar",:width=>20,:align=>:center}
96
128
  table_content = [[
97
129
  first,
98
130
  [[second],[third,fourth]]
99
131
  ]]
100
132
  pdf.move_down(20)
133
+ table = Prawn::Table.new table_content, pdf
101
134
  pdf.table(table_content)
102
135
  end
136
+
137
+ #https://github.com/prawnpdf/prawn/issues/407#issuecomment-28556698
138
+ it "correctly computes column widths with empty cells + colspan" do
139
+ data = [['', ''],
140
+ [{:content => '', :colspan => 2}]
141
+ ]
142
+ pdf = Prawn::Document.new
143
+
144
+ table = Prawn::Table.new data, pdf, :column_widths => [50, 200]
145
+ table.column_widths.should == [50.0, 200.0]
146
+ end
147
+
148
+ it "illustrates a variant of problem in issue #407 - comment 28556698" do
149
+ pdf = Prawn::Document.new
150
+ table_data = [["a", "b", "c"], [{:content=>"d", :colspan=>3}]]
151
+ column_widths = [50, 60, 400]
152
+
153
+ # Before we fixed #407, this line incorrectly raise a CannotFit error
154
+ pdf.table(table_data, :column_widths => column_widths)
155
+ end
103
156
  end
104
157
 
105
158
  describe "#initialize" do
@@ -1,4 +1,5 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
1
+ require_relative "spec_helper"
2
+ require_relative "../lib/prawn/templates"
2
3
 
3
4
  describe "Document built from a template" do
4
5
  it "should have the same page count as the source document" do
data/spec/text_at_spec.rb CHANGED
@@ -98,33 +98,18 @@ describe "#draw_text" do
98
98
  text.strings.first.should == str
99
99
  end
100
100
 
101
- if "spec".respond_to?(:encode!)
102
- # Handle non utf-8 string encodings in a sane way on M17N aware VMs
103
- it "should raise_error an exception when a utf-8 incompatible string is rendered" do
104
- str = "Blah \xDD"
105
- str.force_encoding("ASCII-8BIT")
106
- lambda { @pdf.draw_text(str, :at => [0, 0]) }.should raise_error(
107
- Prawn::Errors::IncompatibleStringEncoding)
108
- end
101
+ it "should raise_error an exception when a utf-8 incompatible string is rendered" do
102
+ str = "Blah \xDD"
103
+ str.force_encoding(Encoding::ASCII_8BIT)
104
+ lambda { @pdf.draw_text(str, :at => [0, 0]) }.should raise_error(
105
+ Prawn::Errors::IncompatibleStringEncoding)
106
+ end
109
107
 
110
- it "should not raise an exception when a shift-jis string is rendered" do
111
- datafile = "#{Prawn::DATADIR}/shift_jis_text.txt"
112
- sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
113
- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
108
+ it "should not raise an exception when a shift-jis string is rendered" do
109
+ datafile = "#{Prawn::DATADIR}/shift_jis_text.txt"
110
+ sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
111
+ @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
114
112
 
115
- @pdf.draw_text(sjis_str, :at => [0, 0])
116
- end
117
- else
118
- # Handle non utf-8 string encodings in a sane way on non-M17N aware VMs
119
- it "should raise_error an exception when a corrupt utf-8 string is rendered" do
120
- str = "Blah \xDD"
121
- lambda { @pdf.draw_text(str, :at => [0, 0]) }.should raise_error(
122
- Prawn::Errors::IncompatibleStringEncoding)
123
- end
124
- it "should raise_error an exception when a shift-jis string is rendered" do
125
- sjis_str = File.read("#{Prawn::DATADIR}/shift_jis_text.txt")
126
- lambda { @pdf.draw_text(sjis_str, :at => [0, 0]) }.should raise_error(
127
- Prawn::Errors::IncompatibleStringEncoding)
128
- end
113
+ @pdf.draw_text(sjis_str, :at => [0, 0])
129
114
  end
130
115
  end
@@ -992,7 +992,7 @@ describe "Text::Box wrapping" do
992
992
 
993
993
  expected = "©" * 25 + "\n" + "©" * 5
994
994
  @pdf.font.normalize_encoding!(expected)
995
- expected = expected.force_encoding("utf-8") if expected.respond_to?(:force_encoding)
995
+ expected = expected.force_encoding(Encoding::UTF_8)
996
996
  text_box.text.should == expected
997
997
  end
998
998
 
@@ -1009,7 +1009,7 @@ describe "Text::Box wrapping" do
1009
1009
  text_box.render
1010
1010
  results_without_accent = text_box.text
1011
1011
 
1012
- results_with_accent.first_line.length.should == results_without_accent.first_line.length
1012
+ first_line(results_with_accent).length.should == first_line(results_without_accent).length
1013
1013
  end
1014
1014
  end
1015
1015
 
@@ -1028,3 +1028,7 @@ end
1028
1028
  def reduce_precision(float)
1029
1029
  ("%.5f" % float).to_f
1030
1030
  end
1031
+
1032
+ def first_line(str)
1033
+ str.each_line { |line| return line }
1034
+ end
data/spec/text_spec.rb CHANGED
@@ -313,34 +313,20 @@ describe "#text" do
313
313
  pages[1][:strings].should == [str]
314
314
  end
315
315
 
316
- if "spec".respond_to?(:encode!)
317
- # Handle non utf-8 string encodings in a sane way on M17N aware VMs
318
- it "should raise_error an exception when a utf-8 incompatible string is rendered" do
319
- str = "Blah \xDD"
320
- str.force_encoding("ASCII-8BIT")
321
- lambda { @pdf.text str }.should raise_error(
322
- Prawn::Errors::IncompatibleStringEncoding)
323
- end
324
- it "should_not raise_error an exception when a shift-jis string is rendered" do
325
- datafile = "#{Prawn::DATADIR}/shift_jis_text.txt"
326
- sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
327
- @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
316
+ it "should raise_error an exception when a utf-8 incompatible string is rendered" do
317
+ str = "Blah \xDD"
318
+ str.force_encoding(Encoding::ASCII_8BIT)
319
+ lambda { @pdf.text str }.should raise_error(
320
+ Prawn::Errors::IncompatibleStringEncoding)
321
+ end
328
322
 
329
- # Expect that the call to text will not raise an encoding error
330
- @pdf.text(sjis_str)
331
- end
332
- else
333
- # Handle non utf-8 string encodings in a sane way on non-M17N aware VMs
334
- it "should raise_error an exception when a corrupt utf-8 string is rendered" do
335
- str = "Blah \xDD"
336
- lambda { @pdf.text str }.should raise_error(
337
- Prawn::Errors::IncompatibleStringEncoding)
338
- end
339
- it "should raise_error an exception when a shift-jis string is rendered" do
340
- sjis_str = File.read("#{Prawn::DATADIR}/shift_jis_text.txt")
341
- lambda { @pdf.text sjis_str }.should raise_error(
342
- Prawn::Errors::IncompatibleStringEncoding)
343
- end
323
+ it "should_not raise_error an exception when a shift-jis string is rendered" do
324
+ datafile = "#{Prawn::DATADIR}/shift_jis_text.txt"
325
+ sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
326
+ @pdf.font("#{Prawn::DATADIR}/fonts/gkai00mp.ttf")
327
+
328
+ # Expect that the call to text will not raise an encoding error
329
+ @pdf.text(sjis_str)
344
330
  end
345
331
 
346
332
  it "should call move_past_bottom when printing more text than can fit" +
@@ -422,4 +408,30 @@ describe "#text" do
422
408
  @pdf.text "VAT", :kerning => false
423
409
  end
424
410
  end
411
+
412
+ describe "#shrink_to_fit with special utf-8 text" do
413
+ it "Should not throw an exception",
414
+ :unresolved, :issue => 603 do
415
+ pages = 0
416
+ doc = Prawn::Document.new(page_size: 'A4', margin: [2, 2, 2, 2]) do |pdf|
417
+ add_unicode_fonts(pdf)
418
+ pdf.bounding_box([1, 1], :width => 90, :height => 50) do
419
+ broken_text = " Sample Text\nSAMPLE SAMPLE SAMPLEoddělení ZMĚN\nSAMPLE"
420
+ pdf.text broken_text, :overflow => :shrink_to_fit
421
+ end
422
+ end
423
+ end
424
+ end
425
+
426
+
427
+ def add_unicode_fonts(pdf)
428
+ dejavu = "#{::Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
429
+ pdf.font_families.update("dejavu" => {
430
+ :normal => dejavu,
431
+ :italic => dejavu,
432
+ :bold => dejavu,
433
+ :bold_italic => dejavu
434
+ })
435
+ pdf.fallback_fonts = ["dejavu"]
436
+ end
425
437
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-12-16 00:00:00.000000000 Z
15
+ date: 2014-01-16 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pdf-reader
@@ -57,13 +57,41 @@ dependencies:
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  - !ruby/object:Gem::Dependency
60
- name: afm
60
+ name: pdf-inspector
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.1.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: 1.1.0
73
+ - !ruby/object:Gem::Dependency
74
+ name: coderay
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: 1.0.7
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: 1.0.7
87
+ - !ruby/object:Gem::Dependency
88
+ name: yard
61
89
  requirement: !ruby/object:Gem::Requirement
62
90
  requirements:
63
91
  - - '>='
64
92
  - !ruby/object:Gem::Version
65
93
  version: '0'
66
- type: :runtime
94
+ type: :development
67
95
  prerelease: false
68
96
  version_requirements: !ruby/object:Gem::Requirement
69
97
  requirements:
@@ -71,35 +99,35 @@ dependencies:
71
99
  - !ruby/object:Gem::Version
72
100
  version: '0'
73
101
  - !ruby/object:Gem::Dependency
74
- name: pdf-inspector
102
+ name: rspec
75
103
  requirement: !ruby/object:Gem::Requirement
76
104
  requirements:
77
- - - ~>
105
+ - - '>='
78
106
  - !ruby/object:Gem::Version
79
- version: 1.1.0
107
+ version: '0'
80
108
  type: :development
81
109
  prerelease: false
82
110
  version_requirements: !ruby/object:Gem::Requirement
83
111
  requirements:
84
- - - ~>
112
+ - - '>='
85
113
  - !ruby/object:Gem::Version
86
- version: 1.1.0
114
+ version: '0'
87
115
  - !ruby/object:Gem::Dependency
88
- name: coderay
116
+ name: mocha
89
117
  requirement: !ruby/object:Gem::Requirement
90
118
  requirements:
91
- - - ~>
119
+ - - '>='
92
120
  - !ruby/object:Gem::Version
93
- version: 1.0.7
121
+ version: '0'
94
122
  type: :development
95
123
  prerelease: false
96
124
  version_requirements: !ruby/object:Gem::Requirement
97
125
  requirements:
98
- - - ~>
126
+ - - '>='
99
127
  - !ruby/object:Gem::Version
100
- version: 1.0.7
128
+ version: '0'
101
129
  - !ruby/object:Gem::Dependency
102
- name: rdoc
130
+ name: rake
103
131
  requirement: !ruby/object:Gem::Requirement
104
132
  requirements:
105
133
  - - '>='
@@ -122,12 +150,7 @@ email:
122
150
  - jimmy@deefa.com
123
151
  executables: []
124
152
  extensions: []
125
- extra_rdoc_files:
126
- - README.md
127
- - LICENSE
128
- - COPYING
129
- - GPLv2
130
- - GPLv3
153
+ extra_rdoc_files: []
131
154
  files:
132
155
  - lib/pdf/core/annotations.rb
133
156
  - lib/pdf/core/byte_string.rb
@@ -147,7 +170,6 @@ files:
147
170
  - lib/pdf/core/stream.rb
148
171
  - lib/pdf/core/text.rb
149
172
  - lib/pdf/core.rb
150
- - lib/prawn/compatibility.rb
151
173
  - lib/prawn/document/bounding_box.rb
152
174
  - lib/prawn/document/column_box.rb
153
175
  - lib/prawn/document/graphics_state.rb
@@ -191,7 +213,9 @@ files:
191
213
  - lib/prawn/table/cell/text.rb
192
214
  - lib/prawn/table/cell.rb
193
215
  - lib/prawn/table/cells.rb
216
+ - lib/prawn/table/column_width_calculator.rb
194
217
  - lib/prawn/table.rb
218
+ - lib/prawn/templates.rb
195
219
  - lib/prawn/text/box.rb
196
220
  - lib/prawn/text/formatted/arranger.rb
197
221
  - lib/prawn/text/formatted/box.rb
@@ -244,7 +268,7 @@ files:
244
268
  - spec/stroke_styles_spec.rb
245
269
  - spec/table/span_dummy_spec.rb
246
270
  - spec/table_spec.rb
247
- - spec/template_spec.rb
271
+ - spec/template_spec_obsolete.rb
248
272
  - spec/text_at_spec.rb
249
273
  - spec/text_box_spec.rb
250
274
  - spec/text_rendering_mode_spec.rb
@@ -272,6 +296,7 @@ files:
272
296
  - manual/document_and_page_options/metadata.rb
273
297
  - manual/document_and_page_options/page_margins.rb
274
298
  - manual/document_and_page_options/page_size.rb
299
+ - manual/document_and_page_options/print_scaling.rb
275
300
  - manual/example_file.rb
276
301
  - manual/example_helper.rb
277
302
  - manual/example_package.rb
@@ -342,9 +367,6 @@ files:
342
367
  - manual/table/style.rb
343
368
  - manual/table/table.rb
344
369
  - manual/table/width.rb
345
- - manual/templates/full_template.rb
346
- - manual/templates/page_template.rb
347
- - manual/templates/templates.rb
348
370
  - manual/text/alignment.rb
349
371
  - manual/text/color.rb
350
372
  - manual/text/column_box.rb
@@ -375,13 +397,13 @@ files:
375
397
  - manual/text/win_ansi_charset.rb
376
398
  - data/encodings/win_ansi.txt
377
399
  - data/images/16bit.alpha
378
- - data/images/16bit.dat
400
+ - data/images/16bit.color
379
401
  - data/images/16bit.png
380
402
  - data/images/arrow.png
381
403
  - data/images/arrow2.png
382
404
  - data/images/barcode_issue.png
383
405
  - data/images/dice.alpha
384
- - data/images/dice.dat
406
+ - data/images/dice.color
385
407
  - data/images/dice.png
386
408
  - data/images/dice_interlaced.png
387
409
  - data/images/fractal.jpg
@@ -389,7 +411,7 @@ files:
389
411
  - data/images/indexed_color.png
390
412
  - data/images/letterhead.jpg
391
413
  - data/images/page_white_text.alpha
392
- - data/images/page_white_text.dat
414
+ - data/images/page_white_text.color
393
415
  - data/images/page_white_text.png
394
416
  - data/images/pigs.jpg
395
417
  - data/images/prawn.png
@@ -436,9 +458,12 @@ files:
436
458
  - LICENSE
437
459
  - GPLv2
438
460
  - GPLv3
439
- - README.md
461
+ - .yardopts
440
462
  homepage: http://prawn.majesticseacreature.com
441
- licenses: []
463
+ licenses:
464
+ - RUBY
465
+ - GPL-2
466
+ - GPL-3
442
467
  metadata: {}
443
468
  post_install_message: |2+
444
469
 
@@ -454,12 +479,7 @@ post_install_message: |2+
454
479
 
455
480
  ********************************************
456
481
 
457
- rdoc_options:
458
- - --title
459
- - Prawn Documentation
460
- - --main
461
- - README.md
462
- - -q
482
+ rdoc_options: []
463
483
  require_paths:
464
484
  - lib
465
485
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -514,7 +534,6 @@ test_files:
514
534
  - spec/stream_spec.rb
515
535
  - spec/stroke_styles_spec.rb
516
536
  - spec/table_spec.rb
517
- - spec/template_spec.rb
518
537
  - spec/text_at_spec.rb
519
538
  - spec/text_box_spec.rb
520
539
  - spec/text_rendering_mode_spec.rb
@@ -522,3 +541,4 @@ test_files:
522
541
  - spec/text_spec.rb
523
542
  - spec/text_with_inline_formatting_spec.rb
524
543
  - spec/transparency_spec.rb
544
+ has_rdoc:
data/README.md DELETED
@@ -1,109 +0,0 @@
1
- # Prawn: Fast, Nimble PDF Generation For Ruby
2
-
3
- [![Build Status](https://secure.travis-ci.org/prawnpdf/prawn.png)](http://travis-ci.org/prawnpdf/prawn)
4
-
5
- Prawn is a pure Ruby PDF generation library that provides a lot of great functionality while trying to remain simple and reasonably performant. Here are some of the important features we provide:
6
-
7
- * Vector drawing support, including lines, polygons, curves, ellipses, etc.
8
- * Extensive text rendering support, including flowing text and limited inline formatting options.
9
- * Support for both PDF builtin fonts as well as embedded TrueType fonts
10
- * A variety of low level tools for basic layout needs, including a simple grid system
11
- * PNG and JPG image embedding, with flexible scaling options
12
- * Reporting tools for rendering complex data tables, with pagination support
13
- * Security features including encryption and password protection
14
- * Tools for rendering repeatable content (i.e headers, footers, and page numbers)
15
- * Comprehensive internationalization features, including full support for UTF-8 based fonts, right-to-left text rendering, fallback font support, and extension points for customizable text wrapping.
16
- * Support for PDF outlines for document navigation
17
- * Low level PDF features, allowing users to create custom extensions by dropping down all the way to the PDF object tree layer. (Mostly useful to those with knowledge of the PDF specification)
18
- * Lots of other stuff!
19
-
20
- ## Should You Use Prawn?
21
-
22
- If you are looking for a highly flexible PDF document generation system, Prawn might be the tool for you. It is not a reporting tool or a publishing toolchain, though it could be fairly easily used to build those things.
23
-
24
- One thing Prawn is not, and will never be, is an HTML to PDF generator. For those needs, consider looking into FlyingSaucer via JRuby, or one of the webkit based tools, like Wicked or PDFKit. We do have basic support for inline styling but it is limited to a very small subset of functionality and is not suitable for rendering rich HTML documents.
25
-
26
- ## Supported Ruby Versions and Implementations
27
-
28
- Because Prawn is pure Ruby and virtually all of its dependencies are maintained by our core team, it should run pretty much anywhere, including Rubinius, JRuby, MacRuby, etc. We officially support MRI {1.9.3 and 2.0.0} and jruby 1.7.x in 1.9 mode, however we will accept patches to fix problems on other Ruby platforms if they aren't too invasive.
29
-
30
- ## Installing Prawn
31
-
32
- Prawn is distributed via RubyGems, and can be installed the usual way that you install gems: by simply typing `gem install prawn` on the command line.
33
-
34
- You can also install from git if you'd like, the _master_ branch contains the latest developments, and _stable_ represents the latest bug fixes to the currently released version of Prawn. If you go this route, using Bundler is encouraged.
35
-
36
- ## Release Policies
37
-
38
- We may introduce backwards incompatible changes each time our minor version number is bumped, but that any tiny version number bump should be bug fixes and internal changes only. Be sure to read the release notes each time we cut a new release and lock your gems accordingly. You can find the project CHANGELOG at: https://github.com/prawnpdf/prawn/wiki/CHANGELOG
39
-
40
- ## Hello World!
41
-
42
- If the following code runs and produces a working PDF file, you've successfully installed Prawn.
43
-
44
- require "prawn"
45
-
46
- Prawn::Document.generate("hello.pdf") do
47
- text "Hello World!"
48
- end
49
-
50
- Of course, you'll probably want to do more interesting things than that...
51
-
52
- ## Manual
53
-
54
- Mendicant University student Felipe Doria provided us with a beautiful system for generating a user manual from our examples. This can be generated from the prawn source or you can download a pre-generated snapshot of it at http://prawn.majesticseacreature.com/manual.pdf
55
-
56
- Note that while we will try to keep the downloadable manual up to date, that it's provided as a convenience only and you should generate the manual yourself if you want to be sure the code in it actually runs and works as expected. To build the manual, here's what you need to do:
57
-
58
- 1. clone the repository
59
- 2. switch to the stable branch (optional, stay on master for development version)
60
- 3. install bundler if necessay
61
- 4. run `bundle install`
62
- 5. run `bundle exec rake manual`, which will generate _manual.pdf_ in the project root
63
-
64
- ## Support
65
-
66
- The easiest way to get help with Prawn is to post a message to our mailing list:
67
-
68
- <http://groups.google.com/group/prawn-ruby>
69
-
70
- Feel free to post any Prawn related question there, our community is very responsive and will be happy to help you figure out how to use Prawn, or help you determine whether it's the right tool for the task you are working on.
71
-
72
- Please make your posts to the list as specific as possible, including code samples and output where relevant. Do not post any information that should not be shared publicly, and be sure to reduce your example code as much as possible so that those who are responding to your question can more easily see what the issue might be.
73
-
74
- ## Contributing
75
-
76
- If you've found a bug, want to submit a patch, or have a feature request, please enter a ticket into our github tracker:
77
-
78
- <http://github.com/prawnpdf/prawn/issues>
79
-
80
- We strongly encourage bug reports to come with failing tests or at least a reduced example that demonstrates the problem. Similarly, patches should include tests, API documentation, and an update to the manual where relevant. Feel free to send a pull request early though, if you just want some feedback or a code review before preparing your code to be merged.
81
-
82
- If you are unsure about whether or not you've found a bug, or want to check to see whether we'd be interested in the feature you want to add before you start working on it, feel free to post to our mailing list.
83
-
84
- You can run our test suite in a few different ways:
85
-
86
- 1. Running `rake` will run the entire test suite excluding any unresolved issues
87
- 2. Running `rspec` will run the entire test suite including unresolved issues
88
- 3. Running `rspec -t unresolved` will run *only* unresolved issues
89
- 4. Running `rspec -t issue:NUMBER` will run the tests for a specific issue
90
-
91
- These filters make it possible for us to add failing test cases for bugs that
92
- are currently being researched or worked on, without breaking the typical
93
- full suite run.
94
-
95
- ## Authorship
96
-
97
- Prawn was originally developed by Gregory Brown, under the auspices of the Ruby Mendicant Project, a grassroots initiative in which the Ruby community collectively provided funding so that Gregory could take several months off of work to focus on this project.
98
-
99
- Over the last several years, we've received code contributions from over 50 people, which is amazing considering the low-level nature of this project. In 2010, Gregory officially handed the project off to the Prawn core team. Currently active maintainers include Brad Ediger, Daniel Nelson, James Healy, and Jonathan Greenberg.
100
-
101
- While he was only with us for a short time before moving on to other things, we'd also like to thank Prawn core team emeritus Jamis Buck for his contributions. He was responsible for introducing font subsetting as well as the first implementation of our inline formatting support.
102
-
103
- You can find the full list of folks who have at least one patch accepted to Prawn on github at https://github.com/prawnpdf/prawn/contributors
104
-
105
- ## License
106
-
107
- Prawn is released under a slightly modified form of the License of Ruby, allowing you to choose between Matz's terms, the GPLv2, or GPLv3. For details, please see the LICENSE, GPLv2, and GPLv3 files.
108
-
109
- If you wish to contribute to Prawn, you will retain your own copyright but must agree to license your code under the same terms as the project itself.
Binary file
data/data/images/dice.dat DELETED
Binary file
Binary file
@@ -1,91 +0,0 @@
1
- # coding: utf-8
2
- #
3
- # Compatibility layer to smooth over differences between Ruby implementations
4
- # The oldest version of Ruby which is supported is MRI 1.8.7
5
- # Ideally, all version-specific or implementation-specific code should be
6
- # kept in this file (but that ideal has not been attained yet)
7
-
8
- class String #:nodoc:
9
- def first_line
10
- self.each_line { |line| return line }
11
- end
12
-
13
- unless "".respond_to?(:codepoints)
14
- def codepoints(&block)
15
- if block_given?
16
- unpack("U*").each(&block)
17
- else
18
- unpack("U*")
19
- end
20
- end
21
-
22
- def each_codepoint(&block)
23
- unpack("U*").each(&block)
24
- end
25
- end
26
-
27
- if "".respond_to?(:encode)
28
- def normalize_to_utf8
29
- begin
30
- encode(Encoding::UTF_8)
31
- rescue
32
- raise Prawn::Errors::IncompatibleStringEncoding, "Encoding " +
33
- "#{text.encoding} can not be transparently converted to UTF-8. " +
34
- "Please ensure the encoding of the string you are attempting " +
35
- "to use is set correctly"
36
- end
37
- end
38
- alias :unicode_characters :each_char
39
- alias :unicode_length :length
40
-
41
- else
42
- def normalize_to_utf8
43
- begin
44
- # use unpack as a hackish way to verify the string is valid utf-8
45
- unpack("U*")
46
- return dup
47
- rescue
48
- raise Prawn::Errors::IncompatibleStringEncoding, "The string you " +
49
- "are attempting to render is not encoded in valid UTF-8."
50
- end
51
- end
52
- def unicode_characters
53
- if block_given?
54
- unpack("U*").each { |c| yield [c].pack("U") }
55
- else
56
- unpack("U*").map { |c| [c].pack("U") }
57
- end
58
- end
59
- def unicode_length
60
- unpack("U*").length
61
- end
62
- end
63
- end
64
-
65
- unless File.respond_to?(:binread)
66
- def File.binread(file) #:nodoc:
67
- File.open(file,"rb") { |f| f.read }
68
- end
69
- end
70
-
71
- if RUBY_VERSION < "1.9"
72
-
73
- def ruby_18 #:nodoc:
74
- yield
75
- end
76
-
77
- def ruby_19 #:nodoc:
78
- false
79
- end
80
-
81
- else
82
-
83
- def ruby_18 #:nodoc:
84
- false
85
- end
86
-
87
- def ruby_19 #:nodoc:
88
- yield
89
- end
90
-
91
- end