diff options
author | Norbert Preining <norbert@preining.info> | 2022-07-29 03:01:04 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-07-29 03:01:04 +0000 |
commit | da2dc471ec5bb2620f0ef5a4a700b236d1a8af06 (patch) | |
tree | d928b5b5abe4df9287ffda090d15e777c78bd783 /graphics/circuit_macros/svg.m4 | |
parent | 5937dac9360bdf40d1b0baf9d7384b109fb5b7a7 (diff) |
CTAN sync 202207290301
Diffstat (limited to 'graphics/circuit_macros/svg.m4')
-rw-r--r-- | graphics/circuit_macros/svg.m4 | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/graphics/circuit_macros/svg.m4 b/graphics/circuit_macros/svg.m4 index dfa968891f..73f144594f 100644 --- a/graphics/circuit_macros/svg.m4 +++ b/graphics/circuit_macros/svg.m4 @@ -1,7 +1,7 @@ divert(-1) svg.m4 Initialization for SVG output. -* Circuit_macros Version 9.8, copyright (c) 2022 J. D. Aplevich under * +* Circuit_macros Version 9.9, copyright (c) 2022 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 * @@ -207,6 +207,7 @@ define(`svg_pound',`svg_symbol(&`#'35;)') define(`svg_circ',`svg_symbol(&`#'710;)') define(`svg_deg',`svg_symbol(&`#'176;)') define(`svg_equiv',`svg_symbol(&`#'8801;)') +define(`svg_tilde',`svg_symbol(&`#'126;)') ') define(`svgcolor',`sprintf("rgb(%g,%g,%g)",\ @@ -242,7 +243,7 @@ define(`svg_rot_init',` | sed -e \"s/x=\\"\([0-9.]*\)\\" y=\\"\([0-9.]*\)\\".*/\1 \2/\" dnl > _file_.cor" ) if retcode != 0 then { print " - Awk failure + Awk failure. Awk and sed are required by svg_rot to rotate svg text. " } svgrot_k = 0 @@ -254,7 +255,7 @@ define(`svg_rot_init',` svgrot_i = 0 ifdef(`svg_rot_',,` -# `svg_rot(degrees,"text" [at position]) +# `svg_rot(degrees,"text",[at position]) # Rotate text degrees ccw # Requires svg_rot_init(filename) # which uses both awk and sed. @@ -263,15 +264,36 @@ define(`svg_rot_init',` if "$`'1" != "" then { svg_rang = -($`'1) } else { svg_rang = -90 } if svgrot_k != 0 then { svgrot_i +=1 command sprintf("<g transform=\"rotate(%g %g %g)\">",svg_rang,\ - svg_rx[svgrot_i],svg_ry[svgrot_i]) }\ + svg_rx[svgrot_i]+textht/2*sind(svg_rang),\ + svg_ry[svgrot_i]+textht/2*(1-cosd(svg_rang))) }\ else { command sprintf("<g transform=\"rotate(%g)\">",svg_rang) } -$`'2 + if "$`'3"=="" then { $`'2 } \ + else { $`'2 $`'3 - (sind(svg_rang),(cosd(svg_rang)-1))*textht/2 } command "</g>" } } define(`svg_rot_') ') `# svg_rot'_init end ') +ifelse(0,1,` +# ifdef(`svg_rot_',,` +## `svg_rot(degrees,"text" [at position]) +## Rotate text degrees ccw +## Requires svg_rot_init(filename) +## which uses both awk and sed. +## The source must be processed twice by m4 and dpic.' +# define svg_rot { if retcode != 0 then {$`'2} else { +# if "$`'1" != "" then { svg_rang = -($`'1) } else { svg_rang = -90 } +# if svgrot_k != 0 then { svgrot_i +=1 +# command sprintf("<g transform=\"rotate(%g %g %g)\">",svg_rang,\ +# svg_rx[svgrot_i],svg_ry[svgrot_i]) }\ +# else { command sprintf("<g transform=\"rotate(%g)\">",svg_rang) } +#$`'2 +# command "</g>" } } +# define(`svg_rot_') +# ') +') + # ---------------------------------------------------------------------------# define(`thinlines_',`linethick = 0.4 |