change Text.LineHeight to use actual units instead of scale (such as 1.5)
This commit is contained in:
parent
48f3d5cb3e
commit
91448dcd68
|
@ -64,8 +64,8 @@ func New(face font.Face, runeSets ...[]rune) *Text {
|
||||||
txt := &Text{
|
txt := &Text{
|
||||||
atlas: atlas,
|
atlas: atlas,
|
||||||
color: pixel.Alpha(1),
|
color: pixel.Alpha(1),
|
||||||
lineHeight: 1,
|
lineHeight: atlas.LineHeight(),
|
||||||
tabWidth: atlas.mapping[' '].Advance * 4,
|
tabWidth: atlas.Glyph(' ').Advance * 4,
|
||||||
}
|
}
|
||||||
txt.glyph.SetLen(6)
|
txt.glyph.SetLen(6)
|
||||||
txt.d.Picture = txt.atlas.pic
|
txt.d.Picture = txt.atlas.pic
|
||||||
|
@ -155,7 +155,7 @@ func (txt *Text) WriteRune(r rune) (n int, err error) {
|
||||||
|
|
||||||
switch r {
|
switch r {
|
||||||
case '\n':
|
case '\n':
|
||||||
txt.Dot -= pixel.Y(txt.atlas.lineHeight * txt.lineHeight)
|
txt.Dot -= pixel.Y(txt.lineHeight)
|
||||||
txt.Dot = txt.Dot.WithX(txt.Orig.X())
|
txt.Dot = txt.Dot.WithX(txt.Orig.X())
|
||||||
return
|
return
|
||||||
case '\r':
|
case '\r':
|
||||||
|
|
Loading…
Reference in New Issue