From e4ef1d35e12e8056043d4fcd7bf2ea0ad1a801c3 Mon Sep 17 00:00:00 2001 From: Alexander Grahn Date: Tue, 12 Sep 2023 15:05:46 +0200 Subject: [PATCH 1/2] fix conflicting bbox setting between pgfsys-dvisvgm and dvisvgm command; fixes #1275 Signed-off-by: Alexander Grahn --- doc/generic/pgf/CHANGELOG.md | 2 ++ testfiles/pgf001.latexdvisvgm.tlg | 4 ++++ testfiles/pgf002.latexdvisvgm.tlg | 2 ++ tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/generic/pgf/CHANGELOG.md b/doc/generic/pgf/CHANGELOG.md index bf7eefaf9..d559c9f6e 100644 --- a/doc/generic/pgf/CHANGELOG.md +++ b/doc/generic/pgf/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Typo in animations `end on` key #1273 +- Output bounding box adjustment in pgfsys-dvisvgm.def #1275 ### Changed @@ -25,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Qrrbrbirlbel - quark67 - Yukai Chou (muzimuzhi) +- Alexander Grahn ## [3.1.10] - 2023-01-13 Henri Menke diff --git a/testfiles/pgf001.latexdvisvgm.tlg b/testfiles/pgf001.latexdvisvgm.tlg index 39c95113d..8d3b0f6ec 100644 --- a/testfiles/pgf001.latexdvisvgm.tlg +++ b/testfiles/pgf001.latexdvisvgm.tlg @@ -7,6 +7,7 @@ TEST 1: pgf: \pgfpathmoveto \hbox(0.0+0.0)x0.0, direction TLT .\hbox(0.0+0.0)x0.0, direction TLT ..\special{dvisvgm:bbox 0.0 0.0} +..\special{dvisvgm:bbox lock} ..\hbox(0.0+0.0)x0.0, direction TLT ...\glue -28.45274 ...\hbox(0.0+0.0)x0.0, shifted 28.45274, direction TLT @@ -25,6 +26,7 @@ TEST 1: pgf: \pgfpathmoveto ....\special{dvisvgm:raw } ....\special{color pop} ....\glue 0.0 plus 1.0fil minus 1.0fil +..\special{dvisvgm:bbox unlock} ! OK. \ENDPGFTEST ...th =\maxdimen \showbox \PGFTESTBOX \endgroup \ENDTEST @@ -37,6 +39,7 @@ TEST 2: pgf: \pgfpathlineto \hbox(0.0+0.0)x0.0, direction TLT .\hbox(0.0+0.0)x0.0, direction TLT ..\special{dvisvgm:bbox 0.0 0.0} +..\special{dvisvgm:bbox lock} ..\hbox(0.0+0.0)x0.0, direction TLT ...\glue -28.45274 ...\hbox(0.0+0.0)x0.0, shifted 28.45274, direction TLT @@ -55,6 +58,7 @@ TEST 2: pgf: \pgfpathlineto ....\special{dvisvgm:raw } ....\special{color pop} ....\glue 0.0 plus 1.0fil minus 1.0fil +..\special{dvisvgm:bbox unlock} ! OK. \ENDPGFTEST ...th =\maxdimen \showbox \PGFTESTBOX \endgroup \ENDTEST diff --git a/testfiles/pgf002.latexdvisvgm.tlg b/testfiles/pgf002.latexdvisvgm.tlg index f338f0d1a..6bb8d40b9 100644 --- a/testfiles/pgf002.latexdvisvgm.tlg +++ b/testfiles/pgf002.latexdvisvgm.tlg @@ -7,6 +7,7 @@ TEST 1: tikz: matrix \hbox(20.1619+0.0)x44.16382, direction TLT .\hbox(20.1619+0.0)x44.16382, direction TLT ..\special{dvisvgm:bbox 44.16382 20.1619} +..\special{dvisvgm:bbox lock} ..\hbox(20.1619+0.0)x44.16382, direction TLT ...\glue 22.08191 ...\hbox(0.0+0.0)x0.0, shifted -10.08095, direction TLT @@ -144,6 +145,7 @@ TEST 1: tikz: matrix ....\special{dvisvgm:raw } ....\special{color pop} ....\glue 0.0 plus 1.0fil minus 1.0fil +..\special{dvisvgm:bbox unlock} ! OK. \ENDTIKZTEST ...h =\maxdimen \showbox \PGFTESTBOX \endgroup \ENDTEST diff --git a/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def b/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def index a08960118..428ff155d 100644 --- a/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def +++ b/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def @@ -127,7 +127,7 @@ \dp#1=0pt% \leavevmode% \pgf@xa=\pgf@trimleft@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi% - \raise-\pgf@ya\hbox{\ifpgf@sys@svg@inpicture\else\special{dvisvgm:bbox \pgf@sys@tonumber\pgf@picmaxx\space\pgf@sys@tonumber\pgf@picmaxy}\fi\box#1}% + \raise-\pgf@ya\hbox{\ifpgf@sys@svg@inpicture\box#1\else\special{dvisvgm:bbox \pgf@sys@tonumber\pgf@picmaxx\space\pgf@sys@tonumber\pgf@picmaxy}\special{dvisvgm:bbox lock}\box#1\special{dvisvgm:bbox unlock}\fi}% \pgf@xa=\pgf@trimright@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi% } From 60a017a21843a39b5380d301b29a3bc654154a8d Mon Sep 17 00:00:00 2001 From: agrahn Date: Wed, 20 Sep 2023 17:09:53 +0200 Subject: [PATCH 2/2] Update tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def Co-authored-by: Yukai Chou --- tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def b/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def index 428ff155d..3df6de6d6 100644 --- a/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def +++ b/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def @@ -127,7 +127,15 @@ \dp#1=0pt% \leavevmode% \pgf@xa=\pgf@trimleft@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi% - \raise-\pgf@ya\hbox{\ifpgf@sys@svg@inpicture\box#1\else\special{dvisvgm:bbox \pgf@sys@tonumber\pgf@picmaxx\space\pgf@sys@tonumber\pgf@picmaxy}\special{dvisvgm:bbox lock}\box#1\special{dvisvgm:bbox unlock}\fi}% + \raise-\pgf@ya\hbox{% + \ifpgf@sys@svg@inpicture + \box#1% + \else + \special{dvisvgm:bbox \pgf@sys@tonumber\pgf@picmaxx\space\pgf@sys@tonumber\pgf@picmaxy}% + \special{dvisvgm:bbox lock}% + \box#1% + \special{dvisvgm:bbox unlock}% + \fi}% \pgf@xa=\pgf@trimright@final\relax \ifdim\pgf@xa=0pt \else\kern\pgf@xa\fi% }