tsvg


Name

tsvg - Thingy SVG writer - package to create svg image files with a syntax close to Tcl and to SVG. Using *cairosvg* writing PDF and PNG files is as well possible.

Description

DDG The package provides one command tsvg which can hold currently just a single svg code collection. All commands will be evaluated within the tsvg namespace, all unknown methods will be forwarded to the standard tsvg::tag method and produce svg code out of them. So tsvg dummy x="20" hello will produce: <dummy x="20">hello</dummy> as output. If the tool cairosvg is installed as well PNG and PDF files can be written since version 0.3.0.

Links

Example

Below a simple example to create a "Hello World!" figure:

package require tsvg
tsvg circle cx 50 cy 50 r 45 stroke black stroke-width 2 fill salmon
tsvg text x 29 y 45 Hello
tsvg text x 27 y 65 World!
tsvg write hello-world.svg

tsvg-image

For more examples see the manual page .


See also


Discussion

DDG - 2021-12-01 - Version 0.3.0 adds support for writing PNG and PDF files using an installation of cairosvg