class HexaPDF::Layout::Box::FitResult

Parent

Stores the result of fitting a box in a frame.

Attributes

box[RW]

The box that was fitted into the frame.

frame[RW]

The frame into which the box was fitted.

mask[RW]

The rectangle (a Geom2D::Rectangle object) that will be removed from the frame when drawing the box.

status[R]

The status result of fitting the box in the frame.

Allowed values are:

:failure

(default) Indicates fitting the box has failed.

:success

Indicates that the box was completely fitted.

:overflow

Indicates that only a part of the box was fitted.

x[RW]

The horizontal position where the box will be drawn.

y[RW]

The vertical position where the box will be drawn.

Public Class Methods

new(box, frame: nil)

Initializes the result object for the given box and, optionally, frame.

Public Instance Methods

draw(canvas, dx: 0, dy: 0)

Draws the box onto the canvas at (x + dx, y + dy).

The relative offset (dx, dy) is useful when rendering results that were accumulated and then need to be moved because the container holding them changes its position.

The configuration option “debug” can be used to add visual debug output with respect to box placement.

failure?()

Returns true if fitting was a failure.

overflow!()

Sets the result status to overflow.

overflow?()

Returns true if only parts of the box were fitted.

reset(frame)

Resets the result object.

success!()

Sets the result status to success.

success?()

Returns true if fitting was successful.