(This question follows up How to emulate \pdfstartlink and \pdfendlink with xetex?)
Note: I used the last CVS version of TikZ/PGF.
With xelatex, I would like to create annotations in tikz nodes. The following MWE shows my problem: the location of the second switch (via TikZ) is bad.
\documentclass{article}
\usepackage{ocg-p}
\usepackage{tikz}
\def\mypdfstartlink#1{%
\special{pdf:bann << /Subtype /Link /Border [1 1 1] /A << #1 >> >>}%
}
\def\mypdfendlink{%
\special{pdf:eann}%
}
\long\def\switchocg#1#2{%
\leavevmode%
\mypdfstartlink{ /S/SetOCGState /State %
[/Toggle \csname OCGpdfobj#1\endcsname\space] }%
#2%
\mypdfendlink%
}
\begin{document}
\begin{ocg}{ocg 1}{ocg1}{1}
Some text...
\end{ocg}
\switchocg{ocg1}{text switch}
\tikz\node{\switchocg{ocg1}{tikz switch}};
\end{document}

Result of \listfiles:
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
ocg-p.sty 2012/12/01 v0.3 Optional Content Group in a PDF document
eso-pic.sty 2010/10/06 v2.0c eso-pic (RN)
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
xetex.def 2009/11/22 v0.94 LaTeX color/graphics driver for XeTeX (RRM/JK)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
tikz.sty 2012/08/29 v2.10-cvs (rcs-revision 1.100)
pgf.sty 2008/01/15 v2.10-cvs (rcs-revision 1.12)
pgfrcs.sty 2010/11/07 v2.10-cvs (rcs-revision 1.25)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10-cvs (rcs-revision 1.7)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pgfsys.sty 2012/03/30 v2.10-cvs (rcs-revision 1.38)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10-cvs (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10-cvs (rcs-revision 1.1)
pgffor.sty 2012/08/27 v2.10-cvs (rcs-revision 1.22)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
