Skip to content

Commit 3af25f5

Browse files
committed
Use font-size in texts of svg context
1 parent 90f9626 commit 3af25f5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

draw2dsvg/gc.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,13 @@ func (gc *GraphicContext) drawString(text string, drawType drawType, x, y float6
126126

127127
// set attrs to text element
128128
svgText.Text = text
129+
svgText.FontSize = gc.Current.FontSize
129130
svgText.X = x
130131
svgText.Y = y
131-
// TODO set font
132+
svgText.FontFamily = "" // TODO set font
132133

133134
// link to group
134-
(*group).Texts = []*Text{&svgText}
135+
group.Texts = []*Text{&svgText}
135136
return 0
136137
}
137138

draw2dsvg/svg.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ type Path struct {
3232
type Text struct {
3333
FillStroke
3434
Position
35-
Text string `xml:",innerxml"`
36-
Style string `xml:"style,attr,omitempty"`
35+
FontSize float64 `xml:"font-size,attr,omitempty"`
36+
FontFamily string `xml:"font-family,attr,omitempty"`
37+
Text string `xml:",innerxml"`
38+
Style string `xml:"style,attr,omitempty"`
3739
}
3840

3941
/* shared attrs */

0 commit comments

Comments
 (0)