Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed :final_gap option from fix for #169.
  • Loading branch information
jessedoyle committed Oct 16, 2014
commit 19e9cfba93d1265208908265d311d15d7240ed35
5 changes: 0 additions & 5 deletions lib/prawn/text/box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ module Text
# <tt>:valign</tt>::
# <tt>:top</tt>, <tt>:center</tt>, or <tt>:bottom</tt>. Vertical
# alignment within the bounding box [:top]
# <tt>:final_gap</tt>::
# <tt>boolean</tt>. If true, then the space between
# each line is included below the last line;
# otherwise, document.y is placed just below the
# descender of the last line printed [true]
# <tt>:rotate</tt>::
# <tt>number</tt>. The angle to rotate the text
# <tt>:rotate_around</tt>::
Expand Down
4 changes: 1 addition & 3 deletions lib/prawn/text/formatted/box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def initialize(formatted_text, options={})
@align = options[:align] ||
(@direction == :rtl ? :right : :left)
@vertical_align = options[:valign] || :top
@final_gap = options[:final_gap].nil? || options[:final_gap]
@leading = options[:leading] || @document.default_leading
@character_spacing = options[:character_spacing] ||
@document.character_spacing
Expand Down Expand Up @@ -330,7 +329,7 @@ def self.inherited(base)

def valid_options
PDF::Core::Text::VALID_OPTIONS + [:at, :height, :width,
:align, :valign, :final_gap,
:align, :valign,
:rotate, :rotate_around,
:overflow, :min_font_size,
:disable_wrap_by_char,
Expand Down Expand Up @@ -493,7 +492,6 @@ def process_vertical_alignment(text)
@at[1] -= (@height - height + @descender) * 0.5
when :bottom
@at[1] -= (@height - height)
@at[1] += line_gap if @final_gap
end

@height = height
Expand Down
24 changes: 1 addition & 23 deletions spec/formatted_text_box_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@
end

describe "Text::Formatted::Box#render with :valign => :bottom" do
it "should render a :final_gap on the bottom by default" do
it "should not render a gap between the text and bottom of box" do
create_pdf
box_height = 100
y = 450
Expand All @@ -656,28 +656,6 @@
text_box = Prawn::Text::Formatted::Box.new(array, options)
text_box.render
top_padding = y - (box_height - text_box.height)
top_padding += text_box.line_gap

text_box.at[1].should be_within(0.01).of(top_padding)
end

it "should not render a :final_gap if set to false" do
create_pdf
box_height = 100
y = 450
array = [{ :text => 'Vertical Align' }]
options = {
:document => @pdf,
:valign => :bottom,
:final_gap => false,
:at => [0,y],
:width => 100,
:height => box_height,
:size => 16
}
text_box = Prawn::Text::Formatted::Box.new(array, options)
text_box.render
top_padding = y - (box_height - text_box.height)

text_box.at[1].should be_within(0.01).of(top_padding)
end
Expand Down