Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Box ¶
type Box interface {
// Direction returns the writing direction of the box.
Direction() Direction
// Width returns the extent of the box within the text.
Width() float32
}
Box is a solid text element (typically, a word).
type Line ¶
type Line struct {
// Boxes is the slice of boxes within the line.
Boxes []Box
// GlueWidth is the extent of the glues between the boxes.
GlueWidth float32
}
Line is a series of boxes that fit in a line of text.
func Greedy ¶
Greedy is a greedy but fast line-breaking algorithm that tries to fit as much boxes as possible in each and every line.
func KnuthPlass ¶
KnuthPlass is a relatively slow line-breaking algorithm but gives the best result aesthetically.
type Options ¶
type Options struct {
// TextWidth is the extent of a line of text.
TextWidth float32
// TextDirection is the writing direction of the text.
TextDirection Direction
// GlueWidth is the normal extent of the glues between the boxes.
GlueWidth float32
// GlueShrink is the extent that a glue can shrink to.
GlueShrink float32
// GlueExpand is the extent that a glue can expand to.
GlueExpand float32
}
Options contains several options passed to the line-breaking algorithm.
Click to show internal directories.
Click to hide internal directories.