Class | Prawn::Text::Box
In: | lib/prawn/text/box.rb
Parent: | Object

Generally, one would use the text_box convenience method. However, using Text::Box.new in conjunction with render() enables one to do look-ahead calculations prior to placing text on the page, or to determine how much vertical space was consumed by the printed text

### Methods

height new render

### Constants

VALID_OPTIONS | = | Prawn::Core::Text::VALID_OPTIONS + [:at, :height, :width, :align, :valign, :overflow, :min_font_size, :line_wrap, :leading, :document, :rotate, :rotate_around, :single_line, :skip_encoding]

### Attributes

ascender | [R] | The height of the ascender of the last line printed
at | [R] | The upper left corner of the text box
descender | [R] | The height of the descender of the last line printed
leading | [R] | The leading used during printing
line_height | [R] | The line height of the last line printed
text | [R] | The text that was successfully printed (or, if `dry_run` was used, the test that would have been successfully printed)

### Public Class methods

new(string, options={})

See Prawn::Text#text_box for valid options

### Public Instance methods

height()

The height actually used during the previous `render`

render(flags={})

Render text to the document based on the settings defined in initialize.

In order to facilitate look-ahead calculations, `render` accepts a `:dry_run => true` option. If provided then everything is executed as if rendering, with the exception that nothing is drawn on the page. Useful for look-ahead computations of height, unprinted text, etc.

Returns any text that did not print under the current settings

[Validate]