adding helper
This commit is contained in:
parent
a44401b5ca
commit
fec5be6506
1 changed files with 8 additions and 9 deletions
|
@ -19,10 +19,11 @@ func SVG(width, height int) (Renderer, error) {
|
||||||
canvas := newCanvas(buffer)
|
canvas := newCanvas(buffer)
|
||||||
canvas.Start(width, height)
|
canvas.Start(width, height)
|
||||||
return &vectorRenderer{
|
return &vectorRenderer{
|
||||||
b: buffer,
|
b: buffer,
|
||||||
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))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue