adding helper

This commit is contained in:
Will Charczuk 2017-03-26 16:27:15 -07:00
parent a44401b5ca
commit fec5be6506

View File

@ -23,6 +23,7 @@ func SVG(width, height int) (Renderer, error) {
c: canvas, c: canvas,
s: &Style{}, s: &Style{},
p: []string{}, p: []string{},
dpi: DefaultDPI,
}, nil }, nil
} }
@ -288,7 +289,9 @@ func (c *canvas) styleAsSVG(s Style) string {
pieces = append(pieces, "stroke:none") pieces = append(pieces, "stroke:none")
} }
if !fc.IsZero() { if !fnc.IsZero() {
pieces = append(pieces, "fill:"+fnc.String())
} else if !fc.IsZero() {
pieces = append(pieces, "fill:"+fc.String()) pieces = append(pieces, "fill:"+fc.String())
} else { } else {
pieces = append(pieces, "fill:none") pieces = append(pieces, "fill:none")
@ -298,10 +301,6 @@ func (c *canvas) styleAsSVG(s Style) string {
pieces = append(pieces, "font-size:"+fmt.Sprintf("%.1fpx", drawing.PointsToPixels(c.dpi, fs))) pieces = append(pieces, "font-size:"+fmt.Sprintf("%.1fpx", drawing.PointsToPixels(c.dpi, fs)))
} }
if !fnc.IsZero() {
pieces = append(pieces, "fill:"+fnc.String())
}
if s.Font != nil { if s.Font != nil {
pieces = append(pieces, c.getFontFace(s)) pieces = append(pieces, c.getFontFace(s))
} }