class HexaPDF::Layout::InlineBox

Parent

An InlineBox wraps a regular Box so that it can be used as an item for a Line. This enables inline graphics.

When an inline box gets placed on a line, the method fit_wrapped_box is called to fit the wrapped box. This allows the wrapped box to correctly set its width and height which are needed by the TextLayouter algorithm.

Note: It is mandatory that the wrapped box sets its width and height without relying on the dimensions of the frame’s current region.

Attributes

box[R]

The wrapped Box object.

valign[R]

The vertical alignment of the box.

Can be any supported value except :text - see Line for all possible values.

Public Class Methods

create(valign: :baseline, **args, &block)

Creates an InlineBox that wraps a basic Box. All arguments (except valign) and the block are passed to Box::create.

See ::new for the valign argument.

new(box, valign: :baseline)

Creates a new InlineBox object wrapping box.

The valign argument can be used to specify the vertical alignment of the box relative to other items in the Line.

Public Instance Methods

draw(canvas, x, y)

Draws the wrapped box. If the box has margins specified, the x and y offsets are correctly adjusted.

empty?()

Returns true if this inline box is just a placeholder without drawing operations.

fit_wrapped_box(frame = nil)

Fits the wrapped box.

If the frame argument is nil, a custom frame is created. Otherwise the given frame is used for creating an appropriate child frame for the fitting operation.

After this operation the caller is responsible for checking the actual width and height of the inline box and whether it really fits.

height()

Returns the height of the wrapped box plus its top and bottom margins.

style()

Returns the style of the wrapped box.

width()

Returns the width of the wrapped box plus its left and right margins.

x_max()

The maximum x-coordinate which is equivalent to the width of the inline box.

x_min()

The minimum x-coordinate which is always 0.

y_max()

The maximum y-coordinate which is equivalent to the height of the inline box.

y_min()

The minimum y-coordinate which is always 0.