fix #8 by exporting utility function LoadFontFace
This commit is contained in:
parent
19103e0c61
commit
5917fd97e8
@ -594,7 +594,7 @@ func (dc *Context) SetFontFace(fontFace font.Face) {
|
||||
}
|
||||
|
||||
func (dc *Context) LoadFontFace(path string, points float64) error {
|
||||
face, err := loadFontFace(path, points)
|
||||
face, err := LoadFontFace(path, points)
|
||||
if err == nil {
|
||||
dc.fontFace = face
|
||||
dc.fontHeight = points * 72 / 96
|
||||
|
3
util.go
3
util.go
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"image"
|
||||
"image/draw"
|
||||
_ "image/jpeg"
|
||||
"image/png"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
@ -99,7 +100,7 @@ func unfix(x fixed.Int26_6) float64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func loadFontFace(path string, points float64) (font.Face, error) {
|
||||
func LoadFontFace(path string, points float64) (font.Face, error) {
|
||||
fontBytes, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user