# Filling Text with Pattern

Text can be colored:

\documentclass{standalone}
\usepackage{xcolor}
\begin{document}
{\textcolor{green}{\Large I}}
\end{document}


Areas can be filled with patterns:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\draw[pattern=bricks, pattern color=green] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
\end{tikzpicture}
\end{document}


How could you fill letters or symbols with a pattern?

For example, an "I" filled with green bricks would look something like this:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
% shouldn't need to trace a symbol!
\draw[pattern=bricks, pattern color=green] (0,0) -- (3,0) -- (3,1) -- (2,1) -- (2,3) -- (3,3) -- (3,4) -- (0, 4) -- (0,3) -- (1,3) -- (1,1) -- (0,1) -- cycle;
\end{tikzpicture}
\end{document}


Conceptually this is very similar to this answer.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\newcommand\textpattern[2][pattern=bricks]{%
\node [text=transparent!0,scale=10,font=\bfseries\sffamily] {#2};
\begin{tikzpicture}
\node [opacity=0,scale=10,font=\bfseries\sffamily] (aux) {#2};
(aux.south west) rectangle (aux.north east);
\end{tikzpicture}}
\textpattern{Hello}

\textpattern[pattern=bricks,pattern color=green]{world!}
\end{document}


• Thank you very much for your answer! I want to make sure I understand your method. You create a fading that is transparent except over the text. Then you make a node with the same text which you later use to size the rectangle you draw along the faded path. The patterns that are drawn in the rectangle come from #1 and the text comes from #2. Is this correct? Aug 7, 2019 at 19:48
• @anonymous_pigeon Yes, more or less. #1 are keys that control the pattern, and the default is pattern=bricks. #2 is the text, as you say. There are many ways in which you could write the command, and one may use pgf keys to make it more flexible.
– user121799
Aug 7, 2019 at 20:22
• @anonymous_pigeon BTW, it is not too difficult to add the contour to the characters. You essentially need to add the tricks that are used here. (The more original posts are linked there.)
– user121799
Aug 7, 2019 at 23:46