Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BorderStyle ¶
type LineSplitter ¶
type LineSplitter interface {
// Split the line into runs and put the result in the runs array.
Split(line lt.Line, runs *[]RenderRun)
}
LineSplitter defines the interface external styling source must implement to work with the painter. It used the Split api to split a line into a few RenderRuns.
type RenderRun ¶
type RenderRun struct {
Glyphs []text.Glyph
// Offset is the pixel offset relative to the start of the line.
Offset fixed.Int26_6
// Fg is the text color encoded to Gio ops. This should be left empty
// for runs originated from decorations.
Fg op.CallOp
// Bg is the background color encoded to Gio ops.
Bg op.CallOp
// Underline style for the run.
Underline *UnderlineStyle
Squiggle *SquiggleStyle
Strikethrough *StrikethroughStyle
Border *BorderStyle
}
A RenderRun is a run of adjacent glyphs sharing the same style. This is used as the painting unit of the TextPainter.
type SquiggleStyle ¶
type StrikethroughStyle ¶
type TextPainter ¶
type TextPainter struct {
// contains filtered or unexported fields
}
TextPainter computes the bounding box of and paints text.
func (*TextPainter) Paint ¶
func (tp *TextPainter) Paint(gtx layout.Context, shaper *text.Shaper, lines []lt.Line, defaultColor op.CallOp, syntaxTokens LineSplitter, decorations LineSplitter)
Paint paints text and various styles originated from syntax hignlighting or decorations.
func (*TextPainter) SetViewport ¶
func (tp *TextPainter) SetViewport(viewport image.Rectangle, scrollOff image.Point)
type UnderlineStyle ¶
Click to show internal directories.
Click to hide internal directories.