Using some symbol other than braces for path decoration

In tikz, we can do path replacing decoration with braces.

Is it possible to do this with some other symbol instead? (eg: square bracket). In the manuals, there is no direct method for this is given. I have a feeling that this is not possible directly. I would like to make sure this.

Note that here i am interested in one long symbol as a path: NOT repeated symbols along a path (as in Putting repeated symbols along a path with decorations? ).

May be, something like text along path will do; is it so? (if one can 'kind of rotate' the text along a path, that would suffice). But, I suppose that would be hard to do.

Thank you

update: @marmot's answer was an eye-opener. After all, the idea of having a rotated text stretched along a path may not work. I thank @marmot for the effort he put in (i can never do latex code like that :< ). Yet, the stretching of the symbol this way kills it as pointed out by @sebastiano. But, for some symbols there may be better ways to do it. For example, this question for square brackets: Is there a TikZ equivalent to the PSTricks \ncbar command? as pointed out by @marmot in his answer.

• The answer to the question "Is it possible to use some symbol other than braces for path decoration?" is "Yes, if you are willing to define such a decoration.". A square bracket is almost trivial, other symbols may be more challenging. If you ask a concrete question of the sort "How can one get square brackets instead of braces?", I guess you will get an answer with a code. – user121799 Dec 17 '18 at 20:50
• Am I using @ symbol wrong here? If so, please let me know. This one got me confused. – Cyriac Antony Dec 18 '18 at 5:20

I do not know if that is the answer you are looking for but of course you can replace any straight line by a symbol that gets stretched accordingly. (Of course this won't produce nice looking braces or brackets. Nice brackets can be produced with this answer, and nice braces can be made using decorations.pathreplacing, as you pointed out yourself.)

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\tikzset{replace path by symbol/.style={to path={%
let
\p1=($(\tikztotarget)-(\tikztostart)$),\n1={veclen(\y1,\x1)},\n2={\n1/width("#1")}
in \pgfextra{\pgfmathsetmacro{\mywidth}{width("#1")}
\typeout{\n1,\n2,\mywidth}}
(\tikztotarget) -- (\tikztostart) node [midway,sloped,xscale=\n2]{#1}
}},
replace path by rotated symbol/.style={to path={%
let
\p1=($(\tikztotarget)-(\tikztostart)$),\n1={veclen(\y1,\x1)},\n2={\n1/height("#1")}
in \pgfextra{\pgfmathsetmacro{\mywidth}{width("#1")}
\typeout{\n1,\n2,\mywidth}}
(\tikztotarget) -- (\tikztostart) node [midway,sloped,rotate=90,yscale=\n2]{#1}
}}}
\begin{tikzpicture}
\path (0,0) coordinate (A) (2,1) coordinate (B) (4,0) coordinate (C) (6,1) coordinate (D);
\path[replace path by symbol=t] (A) to (B);
\path[replace path by rotated symbol={]}] (C) to (D);
\end{tikzpicture}
\end{document}


• What is this? :-) An antenna? You know how much the left image looks like a car wiper blade? :) – Sebastiano Dec 17 '18 at 21:32