diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/circuit-macros/svg.m4')
-rw-r--r-- | Master/texmf-dist/doc/latex/circuit-macros/svg.m4 | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 b/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 index cd04defbf64..e270060393e 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 @@ -1,12 +1,12 @@ divert(-1) svg.m4 Initialization for SVG output. -* Circuit_macros Version 9.1, copyright (c) 2019 J. D. Aplevich under * -* the LaTeX Project Public License. The files of this distribution may * -* be redistributed or modified provided that this copyright notice is * -* included and provided that modifications are clearly marked to * -* distinguish them from this distribution. There is no warranty * -* whatsoever for these files. * +* Circuit_macros Version 9.2, copyright (c) 2020 J. D. Aplevich under * +* the LaTeX Project Public Licence in file Licence.txt. The files of * +* this distribution may be redistributed or modified provided that this * +* copyright notice is included and provided that modifications are clearly * +* marked to distinguish them from this distribution. There is no warranty * +* whatsoever for these files. * define(`m4picprocessor',dpic) define(`m4postprocessor',svg) @@ -155,6 +155,38 @@ define(`svgLinkString',`"<a xlink:href=\"`$1'\"dnl stroke=\"rgb(0,0,255)\">dnl `$2' dnl </a>"') + +# svgrot_init(filename) +# filename is the basename of the output +# produced by dpic -v filename.pic > filename.svg +define(`svgrot_init',`NeedDpicTools + define(`_file_',ifelse(`$1',,patsubst(__file__,.m4),`$1')) + syscmd(touch _file_.svg _file_.cor; cp _file_.svg _file_.tmp) + sh "grep \"^ x=.*\/text>\" _file_.tmp | sed -e dnl + \"s/x=\\"\([0-9.]*\)\\" y=\\"\([0-9.]*\)\\".*/\1 \2/\" > _file_.cor" + svgrot_k = 0; svg_rotz = 0 + define svg_rotcoords { svgrot_k += 1 + if "$`'1" != "" then { x[svgrot_k] = $`'1; y[svgrot_k] = $`'2; svg_rotz = 1 } + } + copythru(svg_rotcoords, _file_.cor) + sh "rm -f _file_.tmp _file_.cor" + svg_rotk = 0 + + ifdef(`svg_rot_',,` +# `svg_rot(deg clockwise rotation,text or object) +# Requires svgrot_init(filename) +# Rotation of svg text is a can of worms because +# the final coordinates of the text are required; +# this forward reference has to be extracted from +# the output file and the source processed twice.' + define svg_rot { if svg_rotz then { svg_rotk += 1; command \ + sprintf("<g transform=\"rotate(%g %g %g)\">",$`'1,x[svg_rotk],y[svg_rotk]) }\ + else { command sprintf("<g transform=\"rotate(%g)\">",$`'1) } +$`'2 + command "</g>" } + define(`svg_rot_') ') + ') + # ---------------------------------------------------------------------------# define(`thinlines_',`linethick = 0.4 |