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.

Complete box auto-sizing is not possible since the available space cannot be determined beforehand! This means the box must have at least its width set. The height may either also be set or determined during fitting.

Fitting of the wrapped box via fit_wrapped_box needs to be done before accessing any other method that uses the wrapped box. For fitting, a frame is used that has the width of the wrapped box and its height, or if not set, a practically infinite height. In the latter case the height must be set during fitting.

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)

Fits the wrapped box.

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

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.