Implements the necessary functionality to allow Prawn::Document#column_box to work.
Override the padding functions so as not to split the padding amount between all columns on the page.
# File lib/prawn/document/column_box.rb, line 112 def add_left_padding(left_padding) @total_left_padding += left_padding @x += left_padding end
# File lib/prawn/document/column_box.rb, line 122 def add_right_padding(right_padding) @total_right_padding += right_padding end
The column width, not the width of the whole box, before left and/or right padding
# File lib/prawn/document/column_box.rb, line 57 def bare_column_width (@width - @spacer * (@columns - 1)) / @columns end
Relative position of the left edge of the current column
# File lib/prawn/document/column_box.rb, line 82 def left width_of_column * @current_column end
x coordinate of the left edge of the current column
# File lib/prawn/document/column_box.rb, line 76 def left_side absolute_left + (width_of_column * @current_column) end
Moves to the next column or starts a new page if currently positioned at the rightmost column.
# File lib/prawn/document/column_box.rb, line 101 def move_past_bottom @current_column = (@current_column + 1) % @columns @document.y = @y if 0 == @current_column @document.start_new_page end end
Relative position of the right edge of the current column.
# File lib/prawn/document/column_box.rb, line 95 def right left + width end
x co-orordinate of the right edge of the current column
# File lib/prawn/document/column_box.rb, line 88 def right_side columns_from_right = @columns - (1 + @current_column) absolute_right - (width_of_column * columns_from_right) end
# File lib/prawn/document/column_box.rb, line 117 def subtract_left_padding(left_padding) @total_left_padding -= left_padding @x -= left_padding end
# File lib/prawn/document/column_box.rb, line 126 def subtract_right_padding(right_padding) @total_right_padding -= right_padding end
The column width after padding. Used to calculate how long a line of text can be.
# File lib/prawn/document/column_box.rb, line 64 def width bare_column_width - (@total_left_padding + @total_right_padding) end
Column width including the spacer.
# File lib/prawn/document/column_box.rb, line 70 def width_of_column bare_column_width + @spacer end