From 3af25f5588a02693c06ab3905613a081003b40fe Mon Sep 17 00:00:00 2001 From: Drahoslav Date: Tue, 26 Dec 2017 19:52:06 +0100 Subject: [PATCH] Use font-size in texts of svg context --- draw2dsvg/gc.go | 5 +++-- draw2dsvg/svg.go | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/draw2dsvg/gc.go b/draw2dsvg/gc.go index 94d9abe..884828b 100644 --- a/draw2dsvg/gc.go +++ b/draw2dsvg/gc.go @@ -126,12 +126,13 @@ func (gc *GraphicContext) drawString(text string, drawType drawType, x, y float6 // set attrs to text element svgText.Text = text + svgText.FontSize = gc.Current.FontSize svgText.X = x svgText.Y = y - // TODO set font + svgText.FontFamily = "" // TODO set font // link to group - (*group).Texts = []*Text{&svgText} + group.Texts = []*Text{&svgText} return 0 } diff --git a/draw2dsvg/svg.go b/draw2dsvg/svg.go index 4a22cc6..0867036 100644 --- a/draw2dsvg/svg.go +++ b/draw2dsvg/svg.go @@ -32,8 +32,10 @@ type Path struct { type Text struct { FillStroke Position - Text string `xml:",innerxml"` - Style string `xml:"style,attr,omitempty"` + FontSize float64 `xml:"font-size,attr,omitempty"` + FontFamily string `xml:"font-family,attr,omitempty"` + Text string `xml:",innerxml"` + Style string `xml:"style,attr,omitempty"` } /* shared attrs */