font/gofont: add style descriptions to the generated package docs.

Fixes golang/go#17964

Change-Id: I3b9f567db7e613a5fcf8fc5e3d4d9f15069fd19b
Reviewed-on: https://go-review.googlesource.com/33370
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Nigel Tao 2016-11-18 11:16:02 +11:00
parent b7f8df6bc0
commit d2f07f8aaa
11 changed files with 39 additions and 11 deletions

View File

@ -60,9 +60,17 @@ func do(ttfName string) {
log.Fatal(err)
}
desc := "a proportional-width, sans-serif"
if strings.Contains(ttfName, "Mono") {
desc = "a fixed-width, slab-serif"
}
b := new(bytes.Buffer)
fmt.Fprintf(b, "// generated by go run gen.go; DO NOT EDIT\n\n")
fmt.Fprintf(b, "// Package %s provides the %q TrueType font\n// from the Go font family.\n", pkgName, fontName)
fmt.Fprintf(b, "// Package %s provides the %q TrueType font\n", pkgName, fontName)
fmt.Fprintf(b, "// from the Go font family. It is %s font.\n", desc)
fmt.Fprintf(b, "//\n")
fmt.Fprintf(b, "// See https://blog.golang.org/go-fonts for details.\n")
fmt.Fprintf(b, "package %s\n\n", pkgName)
fmt.Fprintf(b, "// TTF is the data for the %q TrueType font.\n", fontName)
fmt.Fprintf(b, "var TTF = []byte{")

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gobold provides the "Go Bold" TrueType font
// from the Go font family.
// from the Go font family. It is a proportional-width, sans-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gobold
// TTF is the data for the "Go Bold" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gobolditalic provides the "Go Bold Italic" TrueType font
// from the Go font family.
// from the Go font family. It is a proportional-width, sans-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gobolditalic
// TTF is the data for the "Go Bold Italic" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package goitalic provides the "Go Italic" TrueType font
// from the Go font family.
// from the Go font family. It is a proportional-width, sans-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package goitalic
// TTF is the data for the "Go Italic" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gomedium provides the "Go Medium" TrueType font
// from the Go font family.
// from the Go font family. It is a proportional-width, sans-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gomedium
// TTF is the data for the "Go Medium" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gomediumitalic provides the "Go Medium Italic" TrueType font
// from the Go font family.
// from the Go font family. It is a proportional-width, sans-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gomediumitalic
// TTF is the data for the "Go Medium Italic" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gomono provides the "Go Mono" TrueType font
// from the Go font family.
// from the Go font family. It is a fixed-width, slab-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gomono
// TTF is the data for the "Go Mono" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gomonobold provides the "Go Mono Bold" TrueType font
// from the Go font family.
// from the Go font family. It is a fixed-width, slab-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gomonobold
// TTF is the data for the "Go Mono Bold" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gomonobolditalic provides the "Go Mono Bold Italic" TrueType font
// from the Go font family.
// from the Go font family. It is a fixed-width, slab-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gomonobolditalic
// TTF is the data for the "Go Mono Bold Italic" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package gomonoitalic provides the "Go Mono Italic" TrueType font
// from the Go font family.
// from the Go font family. It is a fixed-width, slab-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package gomonoitalic
// TTF is the data for the "Go Mono Italic" TrueType font.

View File

@ -1,7 +1,9 @@
// generated by go run gen.go; DO NOT EDIT
// Package goregular provides the "Go Regular" TrueType font
// from the Go font family.
// from the Go font family. It is a proportional-width, sans-serif font.
//
// See https://blog.golang.org/go-fonts for details.
package goregular
// TTF is the data for the "Go Regular" TrueType font.