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 PolygonBuilder ¶ added in v0.5.0
type PolygonBuilder struct {
// contains filtered or unexported fields
}
PolygonBuilder detects how many polygons can be formed from a group of rectangles, then extarcts vertices for each of them. To draw the polygons in Gio, call Path or Paths to build the clip paths.
func NewPolygonBuilder ¶ added in v0.5.0
func NewPolygonBuilder(expandEmpty bool, minWidth int, radius float32) *PolygonBuilder
func (*PolygonBuilder) Group ¶ added in v0.5.0
func (pb *PolygonBuilder) Group(rects []image.Rectangle) [][]f32.Point
Group groups rectangles by horizontal overlap and generates polygon points for each group. Returns a slice of point slices, one per group.
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) SetLineHeight ¶ added in v0.5.0
func (tp *TextPainter) SetLineHeight(lineHeight fixed.Int26_6)
func (*TextPainter) SetViewport ¶
func (tp *TextPainter) SetViewport(viewport image.Rectangle, scrollOff image.Point)