Documentation
¶
Overview ¶
Package styledtext provides rendering of text containing multiple fonts and styles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SpanStyle ¶
type SpanStyle struct { Font text.Font Size unit.Sp Color color.NRGBA Content string Img image.Image // contains filtered or unexported fields }
SpanStyle describes the appearance of a span of styled text.
type TextStyle ¶
TextStyle presents rich text.
func (TextStyle) Layout ¶
func (t TextStyle) Layout(gtx layout.Context, spanFn func(gtx layout.Context, idx int, dims layout.Dimensions)) layout.Dimensions
Layout renders the TextStyle.
The spanFn function, if not nil, gets called for each span after it has been drawn, with the offset set to the span's top left corner. This can be used to set up input handling, for example.
The context's maximum constraint is set to the span's dimensions, while the dims argument additionally provides the text's baseline. The idx argument is the span's index in TextStyle.Styles. The function may get called multiple times with the same index if a span has to be broken across multiple lines.