git.lucas.co / go_mono
git clone https://git.lucas.co/go_mono.git

commitf551d3a6b7fc11df315ad9e18b404280680f8bec
parent14f8673644
authorNigel Tao <[email protected]>
date2016-04-08 14:15
font/plan9font: derive the example's ascent from the metrics.

The Face.Metrics method is relatively new.

Also pick up the unicode.7x13.font fix from the upstream plan9port:
https://plan9port-review.googlesource.com/#/c/1490/

Change-Id: Ia6e0feec4ea3c9a35e19d38aa634ca9eb6b2ffa0
Reviewed-on: https://go-review.googlesource.com/21699
Reviewed-by: Rob Pike <[email protected]>

 font/plan9font/example_test.go        | 3 +--
 font/testdata/fixed/unicode.7x13.font | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/font/plan9font/example_test.go b/font/plan9font/example_test.go
index c1eacb2..c3e8f89 100644
--- a/font/plan9font/example_test.go
+++ b/font/plan9font/example_test.go
@@ -30,8 +30,7 @@ func ExampleParseFont() {
 	if err != nil {
 		log.Fatal(err)
 	}
-	// TODO: derive the ascent from the face's metrics.
-	const ascent = 11
+	ascent := face.Metrics().Ascent.Ceil()
 
 	dst := image.NewRGBA(image.Rect(0, 0, 4*7, 13))
 	draw.Draw(dst, dst.Bounds(), image.Black, image.Point{}, draw.Src)
diff --git a/font/testdata/fixed/unicode.7x13.font b/font/testdata/fixed/unicode.7x13.font
index 337b428..f1dc0e5 100644
--- a/font/testdata/fixed/unicode.7x13.font
+++ b/font/testdata/fixed/unicode.7x13.font
@@ -1,4 +1,4 @@
-13 10
+13 11
 0x0000 0x001F 7x13.2400
 0x0000 0x00FF 7x13.0000
 0x0100 0x01FF 7x13.0100