# Bounding box and umlaut issue in text decoration

In the above TikZ picture, how can I

• extend the bounding box to include the text decoration without manual tinkering (the only solution I was able to find is fiddle with the border or margin class options, see here)?
• avoid the error Package inputenc Error: Unicode char from the sharp s "ß" on line 24?

Code

\documentclass[tikz,svgnames]{standalone}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usetikzlibrary{positioning,decorations.text}

\renewcommand{\familydefault}{\sfdefault}

\tikzset{
entity/.style={fill=#1!70,text=white},
action/.style={->,postaction={decorate,decoration={raise=2pt,text along path,text align=center,text={|\scriptsize|#1}}}}
}

\begin{document}
\begin{tikzpicture}

% Entities
\node[entity=DarkGreen] (A) {A};

\node[entity=DarkBlue,right=2 of A] (B) {B};

% Actions
\draw[action=schließen] (A) to [bend left]  (B);
\end{tikzpicture}
\end{document}

• Oops. I guess I should have said it is related only insofar as the questioner, not the content :^) I will delete my comment so as not to confuse. – Steven B. Segletes Sep 29 '17 at 11:35
• I am not sure there is a general solution of detecting the real bounding box, but for the unicode question action=schlie{ß}en works. – David Carlisle Sep 29 '17 at 11:45
• For the bounding box issue try using the text effects along path decoration: decoration={raise=2pt, text effects along path, text align=center, text={#1}, text effects/.cd, text along path} – Mark Wibrow Sep 29 '17 at 12:51
• @Casimir Yep, you can use the /pgf/decoration/text effects/every character style. There are various shorthands for this described in the manual p.596 - 603 (for version 3.0.1a) – Mark Wibrow Sep 29 '17 at 14:53
• To change the size of the decoration, this works: text effects={characters={font=\scriptsize}} – Ross Sep 30 '17 at 2:30

This adds an invisible line above the decorations. If you make the line visible, you will see that the bounding box is slightly larger than needed.

I played around with all the suggestions regarding \scriptsize and concluded that the OP solution is best.

\documentclass[tikz,svgnames]{standalone}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usetikzlibrary{positioning,decorations.text,calc}

\renewcommand{\familydefault}{\sfdefault}

\tikzset{
entity/.style={fill=#1!70,text=white},
action/.style={->,postaction={decorate,decoration={raise=2pt,text along path,
text align=center,text={|\scriptsize|#1}
}}}}

\newlength{\mybuffer}
\sbox0{\scriptsize\strut}
\setlength{\mybuffer}{\dimexpr 2pt+\ht0+\dp0}

\begin{document}

\begin{tikzpicture}
% Entities
\node[entity=DarkGreen] (A) {A};

\node[entity=DarkBlue,right=2 of A] (B) {B};

% Actions
\draw[action={schlie{ß}en}] (A) to [bend left]  (B);
\path ($(A)+(0pt,\mybuffer)$) to [bend left] ($(B)+(0pt,\mybuffer)$);
%\draw[red] ($(A)+(0pt,\mybuffer)$) to [bend left] ($(B)+(0pt,\mybuffer)$);
\end{tikzpicture}
\end{document}