Letterspacing in TiKZ text decorations

I have a drawing of a circle with some text following the curve, as below:

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{fontspec}

\usetikzlibrary{decorations.text}

\setmainfont{Times New Roman}

\begin{document}

\fontspec{Times New Roman}

\begin{tikzpicture}

\draw [
thick,
postaction={
decorate,
decoration={
raise=-4.5ex,
text along path,
reverse path,
text align={left},
text={A bunch of text}
}
},
] (0,0) circle (3.5cm);

\end{tikzpicture}

\end{document}


What I want, obviously, is expanded spacing between letters, but it looks like TiKZ is treating each word as a letter, and increasing the space between words. Is there a way to get letterspacing in this situation, and if so what is it?

• Do you want to fill the entire path of the circle or just part of it? If it is the entire path you have two options: text align = fit to path or text align = fit to path stretching spaces. If you only want to fill part of the circle you need a new path and then chose either of the above text align options. See p596 of the TikZ manual. – Ross Jul 21 '17 at 3:10
• I think an explanation of this strange tikz behavior is given here: tex.stackexchange.com/a/358705/101651. – CarLaTeX Jul 21 '17 at 4:12
• @Ross That worked; if you want the credit, post as an answer & I'll accept. – crmdgn Jul 21 '17 at 12:35

Two text alignment options are available for the decoration key in TikZ that permit fitting text to a path. fit to path decorates the path by adjusting the spacing between characters. fit to path stretching spaces decorates the path by increasing the spacing between words.

The MWE provides and illustration of both these options, first using fit to path and the second example with fit to path stretching spaces. The third example demonstrates how to format text along the path. See the comments in the MWE for details.

This is the output:

This is the MWE, which must be compiled with XeLaTex or LuaLaTex because fontspec is loaded to use Time New Roman font:

% !TeX program = xelatex
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{fontspec}
\usetikzlibrary{decorations.text}
\setmainfont{Times New Roman}

\begin{document}

\fontspec{Times New Roman}
%    \addfontfeature{LetterSpace=50.0} <- Not applicable here

\begin{tikzpicture}

\draw [ rotate=145, % <- add rotation to get "A" at the top
thick,
postaction={
decorate,
decoration={
raise=-4.5ex,
text along path,
reverse path,
text align=fit to path, % <- spaces added between each character
text={ {\qquad} %<- Creates space between the first and last letter
A bunch of text
}
}
},
] (0,0) circle (3.5cm);
\end{tikzpicture}%
\begin{tikzpicture}
\draw [ rotate=180,
thick,
postaction={
decorate,
decoration={
raise=-4.5ex,
text along path,
reverse path,
text align=fit to path stretching spaces, % <- spaces between words increased
A bunch of text
}
}
},
] (0,0) circle (3.5cm);
\end{tikzpicture}%
\begin{tikzpicture}
\draw [ rotate=180,
thick,
postaction={
decorate,
decoration={
raise=-4.5ex,
text along path,
reverse path,
text align=fit to path,
text={ {\qquad} % <- enclose macro in {}
|\Large\color{blue}| % <- Define the formatting of the text enclosed by |
A bunch
|\LARGE\bfseries\color{red}| % <- Change the formatting
of text
}
}
},
] (0,0) circle (3.5cm);
\end{tikzpicture}

\end{document}