Consider this MWE:
\documentclass[varwidth]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\pagecolor{yellow!15}
\begin{document}
\begin{tikzpicture}
\makeatletter
\pgfdeclareshape{testshape}{ %
\inheritsavedanchors[from={rectangle}] %
\inheritbackgroundpath[from={rectangle}] %
\inheritanchorborder[from={rectangle}] %
\foreach \x in {center,north,north east,north west,south,south east,south west,east,west}{ %
\inheritanchor[from={rectangle}]{\x} %
} %
%\backgroundpath{} %
\foregroundpath{ %
\draw[] (\tikz@fig@name.south west) -- (\tikz@fig@name.north east)
(\tikz@fig@name.north west) -- (\tikz@fig@name.south east);
}
}
\makeatother
\tikzstyle{mynode} = [testshape,draw=gray,line width=2pt,inner sep=2pt, outer sep=5pt, minimum width=2cm,minimum height=0pt,align=center]
\node[mynode] (Starter) {Testing the node\\(a bit)};
\node[mynode] (Ender) [right=2cm of Starter] {Also test\\(even more)};
\node[mynode,draw=none] (tester) [below=2pt of Starter] {\phantom{Trying to measure this one}};
\path let \p1=(tester.north east), \p2=(tester.south west)
in coordinate (testerSize) at (\x1-\x2,\y1-\y2);
\pgfpointanchor{testerSize}{center} % "returns"/sets a (last) pgfpoint
\pgfgetlastxy{\testerWidth}{\testerHeight} % ... and globalize:
\global\let\testerWidth\testerWidth
\global\let\testerHeight\testerHeight
\typeout{tester size is: \testerWidth\space X \testerHeight}
\end{tikzpicture}
tester size is: \testerWidth\ X \testerHeight
\end{document}
Here I'm trying to output the tester node invisibly, because I'm trying to measure its final size (btw, is there a more straightforward way to do that, than coordinate -> pgfpointanchor -> pgfgetlastxy?); however, as you can see on the output image:
... I can't really hide it with draw=none, because it's a custom node - and if I try to draw it "offscreen" - the tikzpicture simply stretches and its dimensions are changed.
So is there a way to "draw" a node with all its styling "invisibly" for purposes of measurement, even if it is a custom shape in general, without these artefacts -- a "phantom" environment for TikZ nodes, so to speak?

