使用 tikz 制作文本边缘和阴影

使用 tikz 制作文本边缘和阴影

我有这个代码:

\documentclass[twoside,fleqn]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{fadings,decorations.text}
\usetikzlibrary{patterns}
\begin{document}
 \begin{tcolorbox}
    \begin{tikzfadingfrompicture}[name=tikz]
    \node[text width=15cm,text=transparent!20]{\fontsize{35}{60}\bfseries My title\\};\end{tikzfadingfrompicture}
    \begin{tikzpicture}
    \node[text width=15cm-3mm,text opacity=0,shade, path fading=tikz,
    fit fading=false,
    top color=red,
    bottom color=yellow]{\fontsize{35}{40}\sffamily\bfseries My title\\};
    \end{tikzpicture}
    \end{tcolorbox}
\end{document}

现在我想给文本添加黑边和阴影,我该怎么做?以下是一个例子。 示例图像

答案1

\documentclass{article}
\usepackage{tikz}
\usepackage{pdfrender}
\usepackage{xcolor}

\begin{document}

\begin{tikzpicture}

\node[opacity=.2] at (0.1,-0.1) {
            \scalebox{2}{\texttt{%
\textpdfrender{%
  TextRenderingMode=2,
  LineWidth=.1ex,
  StrokeColor=darkgray!50,
  FillColor=darkgray!50,
}{\Huge Hello World}}} 
};
\node at (0,0) {
 \scalebox{2}{\texttt{%
    \textpdfrender{%
      TextRenderingMode=2,
      LineWidth=.1ex,
      StrokeColor=blue!30!black,
      FillColor=orange!90,
    }{\Huge Hello World}}} 
};

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容