class HexaPDF::Layout::TextLayouter::Penalty

Parent

Used for layouting. Describes a penalty item, i.e. a point where a break is allowed.

If the penalty is greater than or equal to INFINITY, a break is forbidden. If it is smaller than or equal to -INFINITY, a break is mandatory.

If a penalty contains an item and a break occurs at the penalty (taking the width of the penalty/item into account), then the penality item must be the last item of the line.

Constants

INFINITY

All numbers greater than this one are deemed infinite.

LINE_BREAK

The penalty value for a mandatory line break.

PARAGRAPH_BREAK

The penalty value for a mandatory paragraph break.

ProhibitedBreak

Singleton object describing a Penalty for a prohibited break.

Standard

Singleton object describing a standard Penalty, e.g. for hyphens.

Attributes

item[R]

The wrapped item.

penalty[R]

The penalty for breaking at this point.

width[R]

The width assigned to this item.

Public Class Methods

new(penalty, width = 0, item: nil)

Creates a new Penalty with the given penality.

Public Instance Methods

type()

Returns :penalty.