尝试使用 tikz 使曲线文本工作,曲线文本工作正常,但我无法为文本设置轮廓或颜色。我使用 XeLaTeX 是因为 fontspec 并且能够使用我自己的自定义字体。
以下是我所拥有的:
\documentclass[11pt]{article}
\usepackage[active, tightpage]{preview}
\usepackage{tikz}
\usepackage{fontspec}
\usetikzlibrary{decorations.text}
\usepackage{color}
\usepackage[outline]{contour}
\setlength\PreviewBorder{0.2pt}%
\setmainfont[ExternalLocation=/path/to/fonts/]{"HelveticaLTStd-Roman.ttf"}
\begin{document}
\begin{preview}
\begin{center}
\begin{tikzpicture}
\node (Start) at (-3,0) {};
\node (End) at (3,0) {};
\draw [decorate,decoration={text along path,text align=center,text={SOME LONG TEXT}}] (Start) to [bend right=45] (End);
\end{tikzpicture}
\end{center}
\end{preview}
\end{document}
答案1
如果您只想更改文本颜色,可以添加text color=...
命令text={...}
。要为文本设置轮廓,您可以使用和编辑以下代码。
\documentclass[11pt]{article}
\usepackage[active, tightpage]{preview}
\usepackage{tikz}
\usepackage{fontspec}
\usetikzlibrary{decorations.text}
\usepackage[outline]{contour}
\setlength\PreviewBorder{0.2pt}%
\setmainfont[ExternalLocation=/path/to/fonts/]{"HelveticaLTStd-Roman.ttf"}
\begin{document}
\begin{preview}
\begin{center}
\begin{tikzpicture}
\def\mycontour#1{\textcolor{white}{\contour{blue}{#1}}}
\node (Start) at (-3,0) {};
\node (End) at (3,0) {};
\draw [decorate,decoration={text along path,text align=center,text={SOME LONG TEXT},text effects along path,text effects/.cd, characters={character command=\mycontour, font=\tiny}}] (Start) to [bend right=45] (End);
\end{tikzpicture}
\end{center}
\end{preview}
\end{document}