In this answer and this answer, an nice method of clipping TikZ stuff against the contours of some characters have been proposed: use the character for tikzfadingfrompicture and then use that fading to clip away stuff that's outside of the contour. Overall, this works great but it seems that at large magnifications some manual shifts are required to obtain the desired result. Consider the MWE (that was triggered by this question)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fadings,positioning}
\usepackage{contour}
\contournumber{32}
\begin{tikzfadingfrompicture}[name=5-0]
\node[transparent!0,scale=15] (5) at (0,0) {5};
\end{tikzfadingfrompicture}
\begin{tikzfadingfrompicture}[name=5-1]
\node[transparent!0,scale=15] (5) at (0,0) {5};
\path (5.south) -- ++ (0,-0.1);
\end{tikzfadingfrompicture}
\begin{document}
\begin{tikzpicture}
\node[white,scale=15] (5-1) {\contour{blue}{5}};
\foreach \x in {1,1.2,...,3.4}
\foreach \y in {0.1,0.4,...,4.5}
{
\path[path fading=5-1,fit fading=false]
({\x-2},{\y-2.5}) node {5};
}
\node[above=0pt of 5-1]{contour shifted by hand};
\end{tikzpicture}
~
\begin{tikzpicture}
\node[white,scale=15] (5-0) {\contour{blue}{5}};
\foreach \x in {1,1.2,...,3.4}
\foreach \y in {0.1,0.4,...,4.5}
{
\path[path fading=5-0,fit fading=false]
({\x-2},{\y-2.5}) node {5};
}
\node[above=0pt of 5-0]{contour not shifted};
\draw[thick,red] ([yshift=-1.9cm]5-0.north) circle (1cm and 3pt)
([yshift=-3.1cm]5-0.north) circle (1cm and 3pt)
([yshift=-4.15cm,xshift=-0.75cm]5-0.north) circle (0.3cm and 3pt)
([yshift=-5.2cm]5-0.north) circle (0.5cm and 3pt);
\end{tikzpicture}
\end{document}
The left contour is what I would call the desired output but it seems to require a manual shift achieved by \path (5.south) -- ++ (0,-0.1); in the corresponding tikzfadingfrompicture. The right contour does not have the manual adjustment, and therefore there are gaps, which are marked in red, as well as overlaps, which are harder to see, and which I did not mark.
Question: Why is that? Am I doing something obviously wrong? And, most importantly, is there a non-manual way to fix this?
Bonus question: Is there a simple way to move the path fading, i.e. to make it work if I place the big 5 at an arbitrary point, not at (0,0)?



