Title+Picture might make you guess my question:

My goal is to modify the tikz-style companion such that in this example the text along path-decoration will only be shown if it fits, i.e. between a,b but not between b,c.
More precisely, I want the style to
- compute the length
Leof the edge it is applied to, - compute the length
Ldof its decoration-text, - check, whether
Le ≥ Ld + cholds, wherecis some constant for a minimal margin) and - only if that is the case, apply the decoration.
Minimal standalone source:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.text,arrows}
\begin{document}
\begin{tikzpicture}[companion/.style={->,
postaction={
decorate,decoration={raise=2pt,text along path,text color=purple!60!black,text={|\tiny|companion},text align=center}
}
},node distance=1.2cm,>=stealth',auto]
\node[draw] (t3) at (1,0) {$c$};
\node[draw] (t1) at (0,0) {$b$} edge[companion] (t3);
\node[draw] (t2) at (-2,0) {$a$} edge[companion,bend left] (t1);
\end{tikzpicture}
\end{document}
I hope there is an elegant but dynamic solution.

comapnion? – percusse Aug 16 '12 at 20:52