From 150256794bdd392da53a7c3ca87a796afbe8201b Mon Sep 17 00:00:00 2001 From: Will Charczuk Date: Wed, 6 Jul 2016 17:29:25 -0700 Subject: [PATCH] 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. --- draw2dimg/ftgc.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/draw2dimg/ftgc.go b/draw2dimg/ftgc.go index 8bedf91..4ac6d98 100644 --- a/draw2dimg/ftgc.go +++ b/draw2dimg/ftgc.go @@ -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)