mirror of https://github.com/lapce/lapce.git
text shift change
This commit is contained in:
parent
0b78a098b1
commit
f7bd6b093e
|
@ -12,6 +12,7 @@ type Font struct {
|
||||||
height float64
|
height float64
|
||||||
ascent float64
|
ascent float64
|
||||||
descent float64
|
descent float64
|
||||||
|
leading float64
|
||||||
shift float64
|
shift float64
|
||||||
lineHeight float64
|
lineHeight float64
|
||||||
underlinePos float64
|
underlinePos float64
|
||||||
|
@ -31,10 +32,11 @@ func NewFont() *Font {
|
||||||
f.ascent = fontMetrics.Ascent()
|
f.ascent = fontMetrics.Ascent()
|
||||||
f.descent = fontMetrics.Descent()
|
f.descent = fontMetrics.Descent()
|
||||||
f.underlinePos = fontMetrics.UnderlinePos()
|
f.underlinePos = fontMetrics.UnderlinePos()
|
||||||
|
f.leading = fontMetrics.Leading()
|
||||||
|
|
||||||
f.lineSpace = float64(10)
|
f.lineSpace = float64(10)
|
||||||
f.lineHeight = float64(int(f.height + f.lineSpace + 0.5))
|
f.lineHeight = float64(int(f.height + f.lineSpace + 0.5))
|
||||||
f.shift = float64(int(f.lineSpace/2 + f.ascent - f.descent + 1))
|
f.shift = float64(int(f.lineSpace/2 + f.ascent - f.leading + 0.5))
|
||||||
|
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue