Documentation ¶
Index ¶
- func EncodeText(raw string, alignment HAlignment) string
- type HAlignment
- type SVG
- func (svg *SVG) Alignment(horizontal HAlignment, vertical VAlignment) *SVG
- func (svg *SVG) Child(x, y float64) *SVG
- func (svg *SVG) Close() *SVG
- func (svg *SVG) Color(color string) *SVG
- func (svg *SVG) Fill(fill string) *SVG
- func (svg *SVG) Font(font string, size string) *SVG
- func (svg *SVG) FontStyle(style Style, weight Weight) *SVG
- func (svg *SVG) Marker(marker string) *SVG
- func (svg *SVG) Path(path string) *SVG
- func (svg *SVG) Polyline(points ...struct{ X, Y float64 }) *SVG
- func (svg *SVG) Rect(x, y, width, height float64) *SVG
- func (svg *SVG) Render() string
- func (svg *SVG) SetSize(width, height int)
- func (svg *SVG) Stroke(stroke string) *SVG
- func (svg *SVG) StrokeWidth(width string) *SVG
- func (svg *SVG) Text(x, y float64, txt string) *SVG
- func (svg *SVG) Transform(transforms ...Transform) *SVG
- type Style
- type Transform
- type VAlignment
- type Weight
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeText ¶
func EncodeText(raw string, alignment HAlignment) string
EncodeText applies proper xml escaping and svg line breaking at each newline in the raw text and returns a section ready for inclusion in a <text> element. NOTE: Line breaking is kind of hacky, since we cannot actually measure text in SVG, and assume that all characters are 1ex wide.
Types ¶
type HAlignment ¶
type HAlignment string
HAlignment is the type for the horizontal alignment constants
const ( HAlignStart HAlignment = "start" HAlignMiddle HAlignment = "middle" HAlignEnd HAlignment = "end" )
Horizontal text alignment constants
type SVG ¶
type SVG struct {
// contains filtered or unexported fields
}
SVG builds SVG format images using a small subset of the standard
func (*SVG) Alignment ¶
func (svg *SVG) Alignment(horizontal HAlignment, vertical VAlignment) *SVG
Alignment sets current text alignment
func (*SVG) Close ¶
Close closes a child SVG and returns the parent. If the current SVG is not a child, this is a noop.
func (*SVG) Marker ¶
Marker adds start, mid and end markers to all following strokes. The specified marker has to be one of "circle" and "square". Setting the marker to the empty string clears the marker.
func (*SVG) SetSize ¶ added in v0.3.0
SetSize of SVG, redefining the value given during construction.
func (*SVG) StrokeWidth ¶
StrokeWidth sets current stroke width
type Transform ¶
type Transform struct {
// contains filtered or unexported fields
}
Transform represents a transform function
type VAlignment ¶
type VAlignment string
VAlignment is the type for the vertical alignment constants
const ( VAlignTop VAlignment = "hanging" VAlignCentral VAlignment = "middle" VAlignBottom VAlignment = "baseline" )
Vertical text alignment constants