fix #8 by exporting utility function LoadFontFace

This commit is contained in:
Michael Fogleman 2016-12-14 14:26:04 -05:00
parent 19103e0c61
commit 5917fd97e8
2 changed files with 3 additions and 2 deletions

View File

@ -594,7 +594,7 @@ func (dc *Context) SetFontFace(fontFace font.Face) {
} }
func (dc *Context) LoadFontFace(path string, points float64) error { func (dc *Context) LoadFontFace(path string, points float64) error {
face, err := loadFontFace(path, points) face, err := LoadFontFace(path, points)
if err == nil { if err == nil {
dc.fontFace = face dc.fontFace = face
dc.fontHeight = points * 72 / 96 dc.fontHeight = points * 72 / 96

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"image" "image"
"image/draw" "image/draw"
_ "image/jpeg"
"image/png" "image/png"
"io/ioutil" "io/ioutil"
"math" "math"
@ -99,7 +100,7 @@ func unfix(x fixed.Int26_6) float64 {
return 0 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) fontBytes, err := ioutil.ReadFile(path)
if err != nil { if err != nil {
return nil, err return nil, err