Return font set by `SetFont` if already set.

Currently `loadCurrentFont()` is called whenever we call
`CreateStringPath`, if the user has called `SetFont` instead of
using the built in font resolution methods, `loadCurrentFont()`
will more or less ignore that.
This commit is contained in:
Will Charczuk 2016-07-06 17:29:25 -07:00
parent 3f01cfe277
commit 150256794b
1 changed files with 3 additions and 0 deletions

View File

@ -141,6 +141,9 @@ func (gc *GraphicContext) StrokeStringAt(text string, x, y float64) (cursor floa
}
func (gc *GraphicContext) loadCurrentFont() (*truetype.Font, error) {
if gc.Current.Font != nil {
return gc.Current.Font, nil
}
font := draw2d.GetFont(gc.Current.FontData)
if font == nil {
font = draw2d.GetFont(draw2dbase.DefaultFontData)