add Text.Orig (start of the text)
This commit is contained in:
parent
424b6e0f0b
commit
e2a16764c4
|
@ -37,7 +37,8 @@ func RangeTable(table *unicode.RangeTable) []rune {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Text struct {
|
type Text struct {
|
||||||
Dot pixel.Vec
|
Orig pixel.Vec
|
||||||
|
Dot pixel.Vec
|
||||||
|
|
||||||
color pixel.RGBA
|
color pixel.RGBA
|
||||||
|
|
||||||
|
@ -96,10 +97,10 @@ func (txt *Text) Write(p []byte) (n int, err error) {
|
||||||
switch r {
|
switch r {
|
||||||
case '\n':
|
case '\n':
|
||||||
txt.Dot -= pixel.Y(txt.atlas.lineHeight)
|
txt.Dot -= pixel.Y(txt.atlas.lineHeight)
|
||||||
txt.Dot = txt.Dot.WithX(0)
|
txt.Dot = txt.Dot.WithX(txt.Orig.X())
|
||||||
continue
|
continue
|
||||||
case '\r':
|
case '\r':
|
||||||
txt.Dot = txt.Dot.WithX(0)
|
txt.Dot = txt.Dot.WithX(txt.Orig.X())
|
||||||
continue
|
continue
|
||||||
case '\t':
|
case '\t':
|
||||||
//TODO
|
//TODO
|
||||||
|
|
Loading…
Reference in New Issue