Method: Prawn::Text#formatted_text
- Defined in:
- lib/prawn/text.rb
#formatted_text(array, options = {}) ⇒ void
This method returns an undefined value.
Draws formatted text to the page.
Formatted text is an array of hashes, where each hash defines text and format information.
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/prawn/text.rb', line 263 def formatted_text(array, = {}) = (.dup) color = .delete(:color) if color array = array.map { |fragment| fragment[:color] ? fragment : fragment.merge(color: color) } end if @indent_paragraphs text_formatter.array_paragraphs(array).each do |paragraph| remaining_text = draw_indented_formatted_line(paragraph, ) if @no_text_printed && !@all_text_printed @bounding_box.move_past_bottom remaining_text = draw_indented_formatted_line(paragraph, ) end unless @all_text_printed remaining_text = fill_formatted_text_box(remaining_text, ) draw_remaining_formatted_text_on_new_pages(remaining_text, ) end end else remaining_text = fill_formatted_text_box(array, ) draw_remaining_formatted_text_on_new_pages(remaining_text, ) end end |