Text cursor is now an I beam
This commit is contained in:
parent
381f5f88bd
commit
6f9eca99e7
@ -253,20 +253,19 @@ func (this *textBox) drawDot (can canvas.Canvas) {
|
||||
|
||||
pen := can.Pen()
|
||||
|
||||
bounds := this.InnerBounds()
|
||||
metrics := face.Metrics()
|
||||
dot := this.dot.Canon()
|
||||
start := this.drawer.PositionAt(dot.Start).Add(fixPt(this.textOffset()))
|
||||
end := this.drawer.PositionAt(dot.End ).Add(fixPt(this.textOffset()))
|
||||
height := this.drawer.LineHeight().Round()
|
||||
ascent := fixed.Point26_6 { Y: metrics.Descent }
|
||||
descent := fixed.Point26_6 { Y: metrics.Ascent }
|
||||
bounds := this.InnerBounds()
|
||||
metrics := face.Metrics()
|
||||
dot := this.dot
|
||||
canonDot := dot.Canon()
|
||||
start := this.drawer.PositionAt(canonDot.Start).Add(fixPt(this.textOffset()))
|
||||
end := this.drawer.PositionAt(canonDot.End ).Add(fixPt(this.textOffset()))
|
||||
canonEnd := this.drawer.PositionAt(dot.End ).Add(fixPt(this.textOffset()))
|
||||
height := this.drawer.LineHeight().Round()
|
||||
ascent := fixed.Point26_6 { Y: metrics.Descent }
|
||||
descent := fixed.Point26_6 { Y: metrics.Ascent }
|
||||
|
||||
switch {
|
||||
case dot.Empty():
|
||||
pen.Stroke(textColor)
|
||||
pen.StrokeWeight(1)
|
||||
pen.Path(roundPt(start.Add(ascent)), roundPt(start.Sub(descent)))
|
||||
case canonDot.Empty():
|
||||
|
||||
case start.Y == end.Y:
|
||||
pen.Fill(dotColor)
|
||||
@ -300,6 +299,19 @@ func (this *textBox) drawDot (can canvas.Canvas) {
|
||||
rect.Min.X = bounds.Min.X
|
||||
pen.Rectangle(rect)
|
||||
}
|
||||
|
||||
pen.Stroke(textColor)
|
||||
pen.StrokeWeight(1)
|
||||
beamTop := roundPt(canonEnd.Add(ascent)).Sub(image.Pt(0, 1))
|
||||
beamBottom := roundPt(canonEnd.Sub(descent))
|
||||
beamSerif := 3
|
||||
pen.Path(beamTop, beamBottom)
|
||||
pen.Path (
|
||||
beamTop.Sub(image.Pt(beamSerif - 1, 0)),
|
||||
beamTop.Add(image.Pt(beamSerif, 0)))
|
||||
pen.Path (
|
||||
beamBottom.Sub(image.Pt(beamSerif - 1, 0)),
|
||||
beamBottom.Add(image.Pt(beamSerif, 0)))
|
||||
}
|
||||
|
||||
func (this *textBox) textOffset () image.Point {
|
||||
|
Loading…
Reference in New Issue
Block a user