Breaking paragraphs into lines

The linebreaking algorithm in the node library turns a node list into a vertical list and returns additional information about the lines.

func Linebreak(n Node, settings *LinebreakSettings) (*VList, []*Breakpoint)

Settings can be configured:

Name Type Description Default
SqueezeOverfullBoxes bool Allow negative space between words to avoid overfull lines false
DemeritsFitness int The demerits to be added when the fitness class changes 100
DoublehyphenDemerits int Demerits when two consecutive rows end with hyphens 3000
HangingPunctuationEnd bool Allow hyphens and other punctuation overflow on the right margin false
FontExpansion float64 0.0
HSize bag.ScaledPoint The total width of the paragraph 0
Hyphenpenalty int Penalty for a line ending with a hyphen 50
Indent bag.ScaledPoint Indentation of the first row(s) 0
IndentRows int Number of rows to be indented 0
LineEndGlue *Glue Glue at the end of each line (default 0) 0
LineHeight bag.ScaledPoint Distance between two base lines 0
LineStartGlue *Glue Glue at the beginning of each line (default 0) 0
OmitLastLeading bool If true, no leading is applied after the last line false
Tolerance float64 +inf