5

I am trying to hunt down some bugs in pgf-blur, some of which have been reported here already (this for example).

All the following experiments are done with TL 2016.

There are two bugs:

  1. Bug: Multiple drop shadows
  2. Bug: Inclusion in XeLaTeX

ad 1. Bug: Multiple drop shadows

As mentioned a few times on TeX StackExchange (e.g., here, multiple usage of drop shadows in xelatex is broken.

See included file mwe-graphic.tex. With xelatex it produces wrong shadows, but with lualatex or pdflatex perfectly fine ones:

\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\draw[blur shadow](-2,0)circle(1);
\draw[blur shadow](0,0)rectangle(3,2);
\end{tikzpicture}
\end{document}

Possible solution: Fixes incorporated into pst-blur by Andrew Stacey in http://bazaar.launchpad.net/~tex-sx/tex-sx/development/files

With this file, multiple shadows work, but different problems reappeared:

ad 2. Bug: Inclusion in XeLaTeX

Consider the following file mwe.tex

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{center}
\includegraphics{mwe-graphic.pdf}
\end{center}
\end{document}

a. Using default pgf-blur from CTAN or TeX Live

  1. luatex mwe-graphic.tex; xelatex mwe.tex produces a correct graphic, but the xelatex run is corrupted:

    xdvipdfmx:fatal: Loop in object hierarchy detected. Broken PDF file?

  2. xelatex mwe-graphic.tex; xelatex mwe.tex produces output woth incorrect shadows, see above

b. Using the version linked above

  1. luatex mwe-graphic.tex; xelatex mwe.tex
  2. xelatex mwe-graphic.tex; xelatex mwe.tex

    both produces a correct graphic, but the xelatex on mwe run is corrupted:

    xdvipdfmx:fatal: Loop in object hierarchy detected. Broken PDF file?


Now my question: Can anyone provide a version that fixes all these problems? I will contact also the original author, but I am not overly optimistic.

Thanks

Norbert

norbert
  • 8,235
  • Are you interested in more bugs or just these? ;) (I'm thinking of the Beamer problem.) – cfr Jul 22 '16 at 03:37
  • I need those fixed, but I would like to see some development around pgf-blur, which seems to be stagnant by now. – norbert Jul 22 '16 at 03:38
  • One idea is seeing up a collaborative repository for those interested. – norbert Jul 22 '16 at 03:41
  • 1
    For those interested, I had contact with the original author and he is fine if development continues somewhere else, he will not develop pgf-blur anymore. I have set up a github project and I hope that some people will contribute: https://github.com/norbusan/pgf-blur – norbert Jul 26 '16 at 13:56
  • @loop-space I heard from Martin that you helped a lot in development of pgf-blur. Are you interested in a collaborative developement of pgf-blur? Can you contact me per email or any other way. – norbert Jul 26 '16 at 15:47
  • You can't ping somebody who hasn't participated in this discussion. So your message is pinging me, instead. (Because we're the only two to comment here, so it assumes you want to ping me and just ignores the @.) You should try pinging in the chat room or ask one of the moderators to send a 'super ping' from chat if you're not able to. (We can only ping people who've chatted recently. The mods can ping any user from chat.) – cfr Jul 26 '16 at 15:53
  • @norbert Was there any update on this matter? I've just bumped into this issue with xelatex. After some debugging it seems that when using multiple fadings the bounding box correction part gives this Loop in object hierarchy message. I don't understand why it works that way. I can compile it with a single fading or after removing this specific line with multiple fadings, though with broken shadows of course. – Karol J. Piczak Mar 01 '18 at 00:04
  • @KarolJ.Piczak unfortunately no. After the initial trials I didn't manage to fix anything, though. And nobody else contributed. So well, the status is still as it is. – norbert Mar 02 '18 at 01:09
  • Same here. Unfortunately, my knowledge of xelatex internals is not sufficient to fix this in a reasonable time frame, so I had to concede to some limited workarounds. – Karol J. Piczak Mar 02 '18 at 12:17
  • @KarolJ.Piczak I found out that with lualatex I don't face the loop problems anymore. – norbert Aug 14 '18 at 04:35

2 Answers2

4

The patch I suggested in https://tex.stackexchange.com/a/445321/2388 works for the multiple drop shadow here too:

\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\makeatletter
\newcounter{shadowblurcount}
\tikzset{
  /tikz/render blur shadow/.code={
   \stepcounter{shadowblurcount}%
    \pgfbs@savebb
    \pgfsyssoftpath@getcurrentpath{\pgfbs@input@path}%
    \pgfbs@compute@shadow@bbox
    \pgfbs@process@rounding{\pgfbs@input@path}{\pgfbs@fadepath}%
    \pgfbs@apply@canvas@transform
    \colorlet{pstb@shadow@color}{white!\pgfbs@opacity!black}%
    \pgfdeclarefading{shadowfading\the\c@shadowblurcount}{\pgfbs@paint@fading}%
    \pgfsetfillcolor{black}%
    \pgfsetfading{shadowfading\the\c@shadowblurcount}%
       {\pgftransformshift{\pgfpoint{\pgfbs@midx}{\pgfbs@midy}}}%
    \pgfbs@usebbox{fill}%
    \pgfbs@restorebb
  },
  }
\makeatother
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\draw[blur shadow](-2,0)circle(1);
\draw[blur shadow](0,0)rectangle(3,2);
\end{tikzpicture}
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
  • Hi Ulrike, thanks for that, it is the same fix (in principle) as Andrew Stacey did in the file I linked above (he used \newcount etc but the content is the same). But even with only these changes for multiple shadows applied, the inclusion of one pdf in another is still broken when using xelatex - I am not sure whether this is a problem of pgf-blur or more of xelatex. Fortunately recent luatex(whatever) changes at least make it work with lualatex, both the multiple shadows as well as the inclusion. – norbert Aug 14 '18 at 04:31
  • You get the inclusion error also with simple fadings. Two fadings like in my linked answer is already enough, if you compile the graphic with pdflatex even one fading lets xdvipdfmx complain. As none of the other engines nor preflight has a problem with the pdfs I would suspect a xdvipdfmx bug and would suggest to ask Akira. – Ulrike Fischer Aug 14 '18 at 07:58
  • Good point, I will report this to Akira and the rest of the Japanese developers who nowadays care for dvipdfm in all its variants ;-) BTW, I will upload a new version of pgf-blur these days with fixes for the multiple shadows as well as stuff and Andrew. – norbert Aug 15 '18 at 09:09
3

To give a definitive answer: The changes Ulrike mentioned have been in the version of Andrew Stacey and are now incorporated into the package. The error with xelatex is a problem with (x)dvipdfm(x) and are already fixed in our development repository and fixed binaries will appear in TL2019.

Furthermore, Martin Giese agreed to transfer maintainership to me, and I have uploaded a fixed version to CTAN today, which means it will be in TeX Live in a few days.

For futher bug reports/pull request/etc, please use the Github development page: https://github.com/norbusan/pgf-blur

norbert
  • 8,235