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 */