lib/thinreports/generator/pdf/document/graphics/text.rb in thinreports-0.7.6 vs lib/thinreports/generator/pdf/document/graphics/text.rb in thinreports-0.7.7

- old
+ new

@@ -19,16 +19,19 @@ # @option attrs [:top, :center, :bottom] :valign (:top) # @option attrs [Numeric, String] :line_height The total height of an text line. # @option attrs [Numeric, String] :letter_spacing # @option attrs [Boolean] :single (false) # @option attrs [:trancate, :shrink_to_fit, :expand] :overflow (:trancate) + # @option attrs [:none, :break_word] :word_wrap (:none) def text_box(content, x, y, w, h, attrs = {}) w, h = s2f(w, h) box_attrs = text_box_attrs(x, y, w, h, :single => attrs.delete(:single), :overflow => attrs[:overflow]) + # Do not break by word unless :word_wrap is :break_word + content = text_without_line_wrap(content) if attrs[:word_wrap] == :none with_text_styles(attrs) do |built_attrs, font_styles| - pdf.formatted_text_box([{:text => text_without_line_wrap(content), + pdf.formatted_text_box([{:text => content, :styles => font_styles}], built_attrs.merge(box_attrs)) end rescue Prawn::Errors::CannotFit => e # Nothing to do.