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 <r@golang.org>
This commit is contained in:
Nigel Tao 2016-04-08 14:15:19 +10:00
parent 14f8673644
commit f551d3a6b7
2 changed files with 2 additions and 3 deletions

View File

@ -30,8 +30,7 @@ func ExampleParseFont() {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
// TODO: derive the ascent from the face's metrics. ascent := face.Metrics().Ascent.Ceil()
const ascent = 11
dst := image.NewRGBA(image.Rect(0, 0, 4*7, 13)) dst := image.NewRGBA(image.Rect(0, 0, 4*7, 13))
draw.Draw(dst, dst.Bounds(), image.Black, image.Point{}, draw.Src) draw.Draw(dst, dst.Bounds(), image.Black, image.Point{}, draw.Src)

View File

@ -1,4 +1,4 @@
13 10 13 11
0x0000 0x001F 7x13.2400 0x0000 0x001F 7x13.2400
0x0000 0x00FF 7x13.0000 0x0000 0x00FF 7x13.0000
0x0100 0x01FF 7x13.0100 0x0100 0x01FF 7x13.0100