class HexaPDF::Layout::TextLayouter::Glue

Used for layouting. Describes a glue item, i.e. an item describing white space that could potentially be shrunk or stretched.

Attributes

item[R]

The wrapped item.

shrinkability[R]

The amount by which the glue could be shrunk.

stretchability[R]

The amount by which the glue could be stretched.

Public Class Methods

new(item, stretchability = item.width / 2, shrinkability = item.width / 3) click to toggle source

Creates a new Glue for the item.

# File lib/hexapdf/layout/text_layouter.rb, line 118
def initialize(item, stretchability = item.width / 2, shrinkability = item.width / 3)
  @item = item
  @stretchability = stretchability
  @shrinkability = shrinkability
end

Public Instance Methods

type() click to toggle source

Returns :glue.

# File lib/hexapdf/layout/text_layouter.rb, line 130
def type
  :glue
end
width() click to toggle source

The width of the item.

# File lib/hexapdf/layout/text_layouter.rb, line 125
def width
  @item.width
end