Class: Prawn::Core::Text::Formatted::LineWrap
- Inherits:
-
Object
- Object
- Prawn::Core::Text::Formatted::LineWrap
- Defined in:
- lib/prawn/core/text/formatted/line_wrap.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#space_count ⇒ Object
readonly
The number of spaces in the last wrapped line.
Instance Method Summary collapse
-
#paragraph_finished? ⇒ Boolean
Whether this line is the last line in the paragraph.
-
#width ⇒ Object
The width of the last wrapped line.
-
#wrap_line(options) ⇒ Object
Work in conjunction with the Prawn::Core::Formatted::Arranger defined in the :arranger option to determine what formatted text will fit within the width defined by the :width option.
Instance Attribute Details
#space_count ⇒ Object (readonly)
The number of spaces in the last wrapped line
25 26 27 |
# File 'lib/prawn/core/text/formatted/line_wrap.rb', line 25 def space_count @space_count end |
Instance Method Details
#paragraph_finished? ⇒ Boolean
Whether this line is the last line in the paragraph
28 29 30 |
# File 'lib/prawn/core/text/formatted/line_wrap.rb', line 28 def paragraph_finished? @newline_encountered || is_next_string_newline? || @arranger.finished? end |
#width ⇒ Object
The width of the last wrapped line
20 21 22 |
# File 'lib/prawn/core/text/formatted/line_wrap.rb', line 20 def width @accumulated_width || 0 end |
#wrap_line(options) ⇒ Object
Work in conjunction with the Prawn::Core::Formatted::Arranger defined in the :arranger option to determine what formatted text will fit within the width defined by the :width option
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/prawn/core/text/formatted/line_wrap.rb', line 36 def wrap_line() initialize_line() while fragment = @arranger.next_string @fragment_output = "" fragment.lstrip! if first_fragment_on_this_line?(fragment) next if empty_line?(fragment) unless apply_font_settings_and_add_fragment_to_line(fragment) break end end @arranger.finalize_line @accumulated_width = @arranger.line_width @space_count = @arranger.space_count @arranger.line end |