diff --git a/README.md b/README.md index 575f0ec..648262e 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ It will even do word wrap for you! ```go DrawString(s string, x, y float64) DrawStringAnchored(s string, x, y, ax, ay float64) -DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align) +DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align) float64 MeasureString(s string) (w, h float64) MeasureMultilineString(s string, lineSpacing float64) (w, h float64) WordWrap(s string, w float64) []string diff --git a/context.go b/context.go index 1ddb09f..e864a9b 100644 --- a/context.go +++ b/context.go @@ -765,7 +765,7 @@ func (dc *Context) DrawStringAnchored(s string, x, y, ax, ay float64) { // DrawStringWrapped word-wraps the specified string to the given max width // and then draws it at the specified anchor point using the given line // spacing and text alignment. -func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align) { +func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align) float64 { lines := dc.WordWrap(s, width) // sync h formula with MeasureMultilineString @@ -789,6 +789,8 @@ func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing dc.DrawStringAnchored(line, x, y, ax, ay) y += dc.fontHeight * lineSpacing } + + return h } func (dc *Context) MeasureMultilineString(s string, lineSpacing float64) (width, height float64) {