From f7bd6b093e04f7a9e4dbbdd17d810a6aa3658df3 Mon Sep 17 00:00:00 2001 From: Dongdong Zhou Date: Sun, 25 Feb 2018 06:23:44 +0000 Subject: [PATCH] text shift change --- editor/font.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/font.go b/editor/font.go index 20fa6d17..7c81de48 100644 --- a/editor/font.go +++ b/editor/font.go @@ -12,6 +12,7 @@ type Font struct { height float64 ascent float64 descent float64 + leading float64 shift float64 lineHeight float64 underlinePos float64 @@ -31,10 +32,11 @@ func NewFont() *Font { f.ascent = fontMetrics.Ascent() f.descent = fontMetrics.Descent() f.underlinePos = fontMetrics.UnderlinePos() + f.leading = fontMetrics.Leading() f.lineSpace = float64(10) 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 }