font/gofont: add explicit Register

Registering the font as a side effect of importing the gofont package
was too magic. Require an explicit Register call instead. As a side
effect, it is more clear which font is the default (the first one
registered).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-23 10:18:11 +02:00
parent 0504c27e46
commit 143d2aae95
+1 -1
View File
@@ -27,7 +27,7 @@ import (
"golang.org/x/image/font/gofont/gosmallcapsitalic"
)
func init() {
func Register() {
register(text.Font{}, goregular.TTF)
register(text.Font{Style: text.Italic}, goitalic.TTF)
register(text.Font{Weight: text.Bold}, gobold.TTF)