A Line
is a vertically atomic slice of the typeset document. Documents can be split into multiple pages by simply filling up pages with lines until it hits the maximum height.
new Line(
context
: Context
)
This will create a new line with the specified context. Note that, normally, only the typeset()
methods should create lines.
context
: Context
The line’s typesetting context.
width
: number, height
: numberThe line’s width and height in pixels.
content
: ArrayThe line’s content. This will contain things like TextNode
s or Spacer
s.
source
: TypesettableThe line’s creator. This is usually a ParagraphNode
.
lastInParagraph
: booleanWhen true, this means that this line is the last in the current paragraph and thus, when the text is justified, that it shouldn’t actually justify lest the last line be stretched across the whole context width.
update()
This will update the width
and height
by adding the contained nodes’ widths and finding the node with the greatest height and multiplying that by the line height.
append(
child
: any)
This will add the child
to the content
and update the width
and height
accordingly.