Closed agrahn closed 4 years ago
dvisvgmtest.zip
dvisvgmtest.zip
Test files dvisvgmtest.tex
, addtobbox.tex
and some graphics files.
Inside the unzipped directory, run
latex dvisvgmtest
latex dvisvgmtest
dvisvgm --zoom=-1 --font-format=woff --exact dvisvgmtest
latex addtobbox
latex addtobbox
dvisvgm --zoom=-1 --font-format=woff --exact addtobbox
The resulting dvisvgmtest.svg
, addtobbox.svg
can be opened in a web browser.
The zipped test files were updated in https://github.com/latex3/graphics-def/pull/20#issuecomment-480237732 because the zip file also contains dvisvgm.def
from the forked repo that has changed in the meantime.
Yes, it helps dvisvgm
to update the bounding box of the SVG output to encompass some kind of content, such as embedded PNG, rotated and/or scaled text. (By default, dvisvgm produces output with a bbox that tightly encloses the page content, similar to the standalone package). dvisvgm
is smart enough to do this on its own for embedded PostScript (text, graphical objects), but fails to do so for low-level svg code inserted with the dvisvgm:raw
special. (As my and the original dvisvgm.def
does in order to embed PNG and SVG files, for example.)
The effect of the provided user command can be watched by compiling the example file addtobbox.tex
, contained in the zip file of my comment https://github.com/latex3/graphics-def/pull/20#issuecomment-480237732 .
I figured that's what it is doing but conceptually is that different from
\includegraphics[bb=2 3 4 5]{foo.eps}
asserting that the bounding box
should be 2 3 4 5 rather than whatever is in the EPS?
Or to put it another way, if \addtobbox was added to the graphics package, would it be possible to give it any sensible definition outside of svg usage?
while it doesn't always work in practice, the "ideal" behaviour is that documents should "just work" if you change the back end driver option from one back end to another.
On Thu, 11 Apr 2019 at 16:32, agrahn notifications@github.com wrote:
Yes, it helps dvisvgm to update the bounding box of the SVG output to encompass some kind of content, such as embedded PNG, rotated and/or scaled text. (By default, dvisvgm produces output with a bbox that tightly encloses the page content, similar to the standalone package). dvisvgm is smart enough to do this on its own for embedded PostScript (text, graphical objects), but fails to do so for low-level svg code inserted with the dvisvgm:raw special. (As my and the original dvisvgm.def does in order to embed PNG and SVG files, for example.)
The effect of the provided user command can be watched by compiling the example file addtobbox.tex, contained in the zip file of my comment #20 (comment) https://github.com/latex3/graphics-def/pull/20#issuecomment-480237732 .
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/latex3/graphics-def/pull/20#issuecomment-482163953, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNcAr52p19WAgDOOEEM81mS9FNza9sIks5vf1V1gaJpZM4cesDr .
I figured that's what it is doing but conceptually is that different from
\includegraphics[bb=2 3 4 5]{foo.eps}
asserting that the bounding box should be 2 3 4 5 rather than whatever is in the EPS
It is different. It pushes the margins of the enclosing document to fully show what it gets as its argument.
As I said before, the effect is demonstrated with the example document addtobbox.tex
. To see the difference, uncomment the line
%defined in dvisvgm.def; uncomment to nullify effect
%\def\addtobbox#1{#1}
inside the file and re-compile (latex
+dvisvgm --font-format=woff --zoom=-1
).
bb=...
is still availabe and works as usual (setting the viewport of the embedded file).
Or to put it another way, if \addtobbox was added to the graphics package, would it be possible to give it any sensible definition outside of svg usage?
Maybe not. It was provided for convenience to handle cases such as those contained in the example document addtobbox.tex
. The command is not mandatory for the driver's functionality and can be ommited, if desired.
This pull request adds support for PDF file inclusion to the
dvisvgm
driver. As of v2.6.3,dvisvgm
provides PDF file inclusion through thepdffile
\special
. Bitmap inclusion was improved by fixing the wrong scaling upon inclusion.