prawn-layout 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
4
4
  require "rake/rdoctask"
5
5
  require "rake/gempackagetask"
6
6
 
7
- PRAWN_LAYOUT_VERSION = "0.7.1"
7
+ PRAWN_LAYOUT_VERSION = "0.7.2"
8
8
 
9
9
  task :default => [:test]
10
10
 
@@ -3,7 +3,7 @@ module Prawn
3
3
 
4
4
  # Defines the grid system for a particular document. Takes the number of
5
5
  # rows and columns and the width to use for the gutter as the
6
- # keys :rows, :columns, :gutter
6
+ # keys :rows, :columns, :gutter, :row_gutter, :column_gutter
7
7
  #
8
8
  def define_grid(options = {})
9
9
  @grid = Grid.new(self, options)
@@ -171,9 +171,13 @@ module Prawn
171
171
  # Diagnostic method
172
172
  def show(grid_color = "CCCCCC")
173
173
  self.bounding_box do
174
+ original_stroke_color = pdf.stroke_color
175
+
174
176
  pdf.stroke_color = grid_color
175
177
  pdf.text self.name
176
178
  pdf.stroke_bounds
179
+
180
+ pdf.stroke_color = original_stroke_color
177
181
  end
178
182
  end
179
183
 
@@ -189,7 +189,7 @@ module Prawn
189
189
  old_color = @document.fill_color || "000000"
190
190
  @document.fill_color @text_color if @text_color
191
191
  @document.text @text, options
192
- @document.fill_color "000000"
192
+ @document.fill_color old_color
193
193
  end
194
194
  end
195
195
 
@@ -247,7 +247,7 @@ module Prawn
247
247
 
248
248
  def draw
249
249
  y = @document.y
250
- x = @document.bounds.absolute_left
250
+ x = @document.bounds.left_side
251
251
 
252
252
  @cells.each do |e|
253
253
  e.point = [x - @document.bounds.absolute_left,
data/lib/prawn/table.rb CHANGED
@@ -331,11 +331,11 @@ module Prawn
331
331
  bbox = @parent_bounds.stretchy? ? @document.margin_box : @parent_bounds
332
332
  if c.height > y_pos - bbox.absolute_bottom
333
333
  if C(:headers) && page_contents.length == 1
334
- @document.start_new_page
334
+ @parent_bounds.move_past_bottom
335
335
  y_pos = @document.y
336
336
  else
337
337
  draw_page(page_contents)
338
- @document.start_new_page
338
+ @parent_bounds.move_past_bottom
339
339
  if C(:headers) && page_contents.any?
340
340
  page_contents = [page_contents[0]]
341
341
  y_pos = @document.y - page_contents[0].height
data/spec/grid_spec.rb CHANGED
@@ -57,5 +57,29 @@ describe "A document's grid" do
57
57
  @pdf.grid([1,3], [2,5]).bottom_left.should == [330.0, 456.25]
58
58
  @pdf.grid([1,3], [2,5]).bottom_right.should == [650.0, 456.25]
59
59
  end
60
+
61
+ it "should draw outlines without changing global default colors to grid color" do
62
+ @pdf.grid.show_all('cccccc')
63
+
64
+ colors = PDF::Inspector::Graphics::Color.analyze(@pdf.render)
65
+ colors.fill_color.should.not == [0.8,0.8,0.8]
66
+ colors.stroke_color.should.not == [0.8,0.8,0.8]
67
+
68
+ # Hardcoded default color as I haven't been able to come up with a stable converter
69
+ # between fill_color without lots code.
70
+ colors.fill_color.should == [0.0,0.0,0.0]
71
+ colors.stroke_color.should == [0.0,0.0,0.0]
72
+ end
73
+
74
+ it "should draw outlines without curent color settings" do
75
+ @pdf.fill_color "ccff00"
76
+ @pdf.stroke_color "ffcc00"
77
+
78
+ @pdf.grid.show_all
79
+
80
+ colors = PDF::Inspector::Graphics::Color.analyze(@pdf.render)
81
+ colors.fill_color.should == [0.8,1.0,0.0]
82
+ colors.stroke_color.should == [1.0,0.8,0.0]
83
+ end
60
84
  end
61
85
  end
data/spec/table_spec.rb CHANGED
@@ -319,3 +319,19 @@ describe "An invalid table" do
319
319
  end
320
320
 
321
321
  end
322
+
323
+ describe "A table, in a column box" do
324
+
325
+ it "should flow to the next column rather than always the next page" do
326
+ pdf = Prawn::Document.new do
327
+ column_box [0, cursor], :width => bounds.width, :columns => 2 do
328
+ # 35 rows fit on two columns but not one
329
+ table [["data"]] * 35
330
+ end
331
+ end
332
+
333
+ pdf.page_count.should == 1
334
+ end
335
+
336
+ end
337
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-03 00:00:00 -05:00
12
+ date: 2010-01-31 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: An extension to Prawn that provides table support and other layout functionality
16
+ description: " An extension to Prawn that provides table support and other layout functionality\n"
17
17
  email: " gregory.t.brown@gmail.com"
18
18
  executables: []
19
19
 
@@ -22,17 +22,14 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README
24
24
  files:
25
- - examples/grid
26
25
  - examples/grid/column_gutter_grid.rb
27
26
  - examples/grid/show_grid.rb
28
27
  - examples/grid/multi_boxes.rb
29
28
  - examples/grid/bounding_boxes.rb
30
29
  - examples/grid/simple_grid.rb
31
- - examples/page_layout
32
30
  - examples/page_layout/padded_box.rb
33
31
  - examples/page_layout/lazy_bounding_boxes.rb
34
32
  - examples/example_helper.rb
35
- - examples/table
36
33
  - examples/table/table_header_underline.rb
37
34
  - examples/table/currency.csv
38
35
  - examples/table/addressbook.csv
@@ -44,12 +41,9 @@ files:
44
41
  - examples/table/cell.rb
45
42
  - examples/table/table_colspan.rb
46
43
  - examples/table/table_header_color.rb
47
- - lib/prawn
48
44
  - lib/prawn/layout.rb
49
45
  - lib/prawn/table.rb
50
- - lib/prawn/table
51
46
  - lib/prawn/table/cell.rb
52
- - lib/prawn/layout
53
47
  - lib/prawn/layout/grid.rb
54
48
  - lib/prawn/layout/page.rb
55
49
  - spec/table_spec.rb
@@ -59,6 +53,8 @@ files:
59
53
  - README
60
54
  has_rdoc: true
61
55
  homepage: http://prawn.majesticseacreature.com
56
+ licenses: []
57
+
62
58
  post_install_message:
63
59
  rdoc_options:
64
60
  - --title
@@ -83,9 +79,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
79
  requirements: []
84
80
 
85
81
  rubyforge_project: prawn
86
- rubygems_version: 1.3.1
82
+ rubygems_version: 1.3.5
87
83
  signing_key:
88
- specification_version: 2
84
+ specification_version: 3
89
85
  summary: An extension to Prawn that provides table support and other layout functionality
90
86
  test_files: []
91
87