Closed agrahn closed 2 years ago
I've pushed a quick implementation to branch tmp
. If you like, please test if the changes work as expected with your examples. I'm currently a bit busy and have only done a few rough tests so far.
Thank you @Martin, it works like charm! I am adding a simple test case below. Would you please merge this into master, so that it could be included in TL-22? That would be great.
\documentclass{article}
\usepackage[a6paper]{geometry}
\begin{document}
x\hbox to 52bp {\vrule width 0pt height 52bp\special{pdffile="example.pdf" llx=10 lly=10 urx=62 ury=62}\hss}x\quad
x\hbox to 52bp {\vrule width 0pt height 52bp\special{pdffile="example.pdf" llx=10 lly=10 urx=62 ury=62 clip}\hss}x
\end{document}
Great to hear that it works properly. I've merged the changes into master. I'm not sure, though, when I'll find the time to prepare a new release. It might take a couple of days.
Currently, clipping of embedded PS and PDF files is implemented in the
PSfile
andpdffile
specials through<clipPath>
and theclip-path
attribute.Unfortunately, this significantly impairs the rendering performance in Firefox. It becomes apparent for animations produced with the
animate
package where frame rates needed for smooth playback cannot be achieved if clipped graphics were embedded.Consider the following example (
latex
+dvisvgm --zoom=-1
):rainbow2.pdf
dvisvgm.def.new.zip
The average frame rates during the animation loops are printed to the JavaScript console in Firefox (Ctrl+⇧+I)
Therefore, I'd like to suggest the
svg overflow="hidden"
method for implementing rectangular clipping of embedded graphics. I did this on the LaTeX level in the driver filedvisvgm.def.new
which I attached asdvisvgm.def.new.zip
. To make use of it, unzip the file and uncomment the commented code lines in the example. With thesvg overflow="hidden"
method for clipping, the animation performs much better in Firefox.