我想使用带有白色轮廓的字体但似乎不起作用。
\usepackage{color}
\usepackage[outline]{contour}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\font\f=cmr17 at20pt;
\node (inicio) at (-3.9cm, -0.95cm) {};
\node (fin) at (4.1cm,-0.75cm) {};
\draw[decoration={text along path,
text={|\f|\contour{red}|This is a long sample text|||},
text align={center}},decorate] (inicio) to [out=-2,in=520] (fin);
\end{tikzpicture}
\end{document}
有什么帮助吗?
答案1
您可以使用text effects along path
装饰将命令应用\contour
到每个角色。
\documentclass{standalone}
\usepackage{color}
\usepackage[outline]{contour}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\def\mycontour#1{\contour{red}#1}
\node (inicio) at (-3.9cm, -0.95cm) {};
\node (fin) at (4.1cm,-0.75cm) {};
\draw[
decoration={text effects along path,
text={This is a long sample text},
text align=center,
text effects/.cd,
text along path,
every character/.style={font=\huge,character command=\mycontour}
},decorate
] (inicio) to [out=-2,in=160] (fin);
\end{tikzpicture}
\end{document}
编辑:这是一个更好的版本。
\documentclass[tikz]{standalone}
\usepackage{lmodern}
\usepackage[outline]{contour}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\def\mycontour#1{\textcolor{white}{\contour{red}{#1}}}
\node (inicio) at (-3.9cm, -0.95cm) {};
\node (fin) at (4.1cm,-0.75cm) {};
\draw[
decoration={text effects along path,
text={This is a long sample text},
text align=center,
text effects/.cd,
text along path, scale text to path,
characters={font=\Huge,character command=\mycontour},
},decorate,
] (inicio) to [out=-2,in=160] (fin);
\end{tikzpicture}
\end{document}