How to fill letters only partially?

I propose three ways, plus one variant that actually uses the positioning library. The first way is simpler, but the second and third ones have more knobs and allow you to specify the desired color in a central place (you could also do that with \colorlet, but this is done in the spirit of \pgfkeys here). All three ways give the exact same output. The variant with the positioning library gives slightly different letter placement, but this can of course be further adjusted.

screenshot

Since your letter placement technique doesn't use the positioning library, I have removed \usetikzlibrary{positioning} in the first three examples. At the end, I'll show you a way that uses the library and a different way to scale the font.

Simpler way

\documentclass[border=30pt]{standalone}
\usepackage[rm,medium]{roboto}
\usepackage[outline]{contour}
\usepackage{tikz}

\definecolor{bittersweet}{HTML}{FE6F5E}

\makeatletter
\let\myFirstOfOne\@firstofone
\makeatother

\begin{document}

\pagecolor{black}
\begin{tikzpicture}[
  font=\sffamily,
  pics/my letters/.style={code={
    \begin{scope}[nodes={scale=15}]
       \node                                   (F) at (-7.8,0)   {#1{F}};
       \node[node distance=2mm, right of=F]    (E)               {#1{E}};
       \node[node distance=2.721mm, below of=F, xshift=.3pt] (B) {#1{B}};
       \node[node distance=2mm, right of=B]    (R)               {#1{R}};
       \node[node distance=2mm, right of=R]    (U)               {#1{U}};
       \node[node distance=2.721mm, below of=B]  (A)             {#1{A}};
       \node[node distance=2mm, right of=A]    (r)               {#1{R}};
       \node[node distance=2mm, right of=r]    (Y)               {#1{Y}};
    \end{scope}
  }},
 pics/my letters/.default=\myFirstOfOne]

\begin{scope}[overlay]
  \pic {my letters={\color{black}\contour{bittersweet}}};
  \begin{scope}
    \clip (-9,2) -- (0,-10) |- cycle;
    \pic {my letters={\color{bittersweet}\contour{bittersweet}}};
  \end{scope}
\end{scope}

\draw[very thick, bittersweet] (-9,2)--(0,-10);
\end{tikzpicture}

\end{document}

Flexible way (1)

\documentclass[border=30pt]{standalone}
\usepackage[rm,medium]{roboto}
\usepackage[outline]{contour}
\usepackage{tikz}

\definecolor{bittersweet}{HTML}{FE6F5E}

\makeatletter
\newif\ifmylettersdrawoutline

\tikzset{
  pics/my letters/.style={code={
    \begin{scope}[nodes={scale=15}]
       \ifmylettersdrawoutline
         \edef\myLettersHandler{%
           % You might want to use /tikz/color instead of
           % /tikz/pics/my letters/inside.
           \noexpand\color{\pgfkeysvalueof{/tikz/pics/my letters/inside}}%
           \noexpand\contour{\pgfkeysvalueof{/tikz/pics/my letters/outline}}}
       \else
         \let\myLettersHandler\@firstofone
       \fi
       %
       \node (F) at (-7.8,0)                             {\myLettersHandler{F}};
       \node[node distance=2mm, right of=F]     (E)      {\myLettersHandler{E}};
       \node[node distance=2.721mm, below of=F, xshift=.3pt]
                                                (B)      {\myLettersHandler{B}};
       \node[node distance=2mm, right of=B]     (R)      {\myLettersHandler{R}};
       \node[node distance=2mm, right of=R]     (U)      {\myLettersHandler{U}};
       \node[node distance=2.721mm, below of=B] (A)      {\myLettersHandler{A}};
       \node[node distance=2mm, right of=A]     (r)      {\myLettersHandler{R}};
       \node[node distance=2mm, right of=r]     (Y)      {\myLettersHandler{Y}};
    \end{scope}
  }, my letters/.cd, #1},
  pics/my letters/outline/.initial=bittersweet,
  pics/my letters/inside/.initial=black,
  % This one sets both colors in one go
  pics/my letters/outline and inside/.style={
    /tikz/pics/my letters/.cd, outline=#1, inside=#1},
  pics/my letters/draw outline/.is if=mylettersdrawoutline,
  pics/my letters/draw outline=false, % initial value
}
\makeatother

\begin{document}

\pagecolor{black}
% /tikz/my logo color determines the color of the letters *and* the line
\begin{tikzpicture}[font=\sffamily,
                    my logo color/.style={
                      color={#1},
                      pics/my letters/outline and inside={#1}},
                    my logo color=bittersweet]

\coordinate (upper left)  at (-9,2);
\coordinate (lower right) at (0,-10);

\begin{scope}[overlay, pics/my letters/draw outline]
  \pic {my letters={inside=black}}; % override the inside color here
  \begin{scope}
    \clip (upper left) -- (lower right) |- cycle;
    \pic {my letters};
  \end{scope}
\end{scope}

\draw[very thick] (upper left) -- (lower right);
\end{tikzpicture}

\end{document}

Flexible way (2)

\documentclass[border=30pt]{standalone}
\usepackage[rm,medium]{roboto}
\usepackage[outline]{contour}
\usepackage{tikz}

\definecolor{bittersweet}{HTML}{FE6F5E}

\makeatletter
\newif\ifmylettersdrawoutline

\tikzset{
  pics/my letters/.style={code={
    \begin{scope}[nodes={scale=15}]
       \ifmylettersdrawoutline
         \edef\myLettersHandler{%
           % You might want to use /tikz/color instead of
           % /tikz/pics/my letters/inside.
           \noexpand\color{\pgfkeysvalueof{/tikz/pics/my letters/inside}}%
           \noexpand\contour{\pgfkeysvalueof{/tikz/pics/my letters/outline}}}
       \else
         \let\myLettersHandler\@firstofone
       \fi
       %
       \node (F) at (-7.8,0)                             {\myLettersHandler{F}};
       \node[node distance=2mm, right of=F]     (E)      {\myLettersHandler{E}};
       \node[node distance=2.721mm, below of=F, xshift=.3pt]
                                                (B)      {\myLettersHandler{B}};
       \node[node distance=2mm, right of=B]     (R)      {\myLettersHandler{R}};
       \node[node distance=2mm, right of=R]     (U)      {\myLettersHandler{U}};
       \node[node distance=2.721mm, below of=B] (A)      {\myLettersHandler{A}};
       \node[node distance=2mm, right of=A]     (r)      {\myLettersHandler{R}};
       \node[node distance=2mm, right of=r]     (Y)      {\myLettersHandler{Y}};
    \end{scope}
  }, my letters/.cd, #1},
  pics/my letters/outline/.initial=bittersweet,
  pics/my letters/inside/.initial=black,
  % This one sets both colors in one go
  pics/my letters/outline and inside/.style={
    /tikz/pics/my letters/.cd, outline=#1, inside=#1},
  pics/my letters/draw outline/.is if=mylettersdrawoutline,
  pics/my letters/draw outline=false, % initial value
}
\makeatother

\begin{document}

\pagecolor{black}
% /tikz/my logo color determines the color of the letters *and* the line
\begin{tikzpicture}[font=\sffamily, my logo color/.initial=bittersweet]

\coordinate (upper left)  at (-9,2);
\coordinate (lower right) at (0,-10);

\begin{scope}[overlay,
              pics/my letters/.cd, draw outline,
              outline and inside/.expanded={%
                \pgfkeysvalueof{/tikz/my logo color}}]
  \pic {my letters={inside=black}}; % override the inside color here
  \begin{scope}
    \clip (upper left) -- (lower right) |- cycle;
    \pic {my letters};
  \end{scope}
\end{scope}

\draw[very thick, color=\pgfkeysvalueof{/tikz/my logo color}] (upper left) -- (lower right);
\end{tikzpicture}

\end{document}

Using the positioning library

If you want to use the positioning library, placement works differently. In this case, I removed the scale=15 and used font={\sffamily\fontsize{150}{150}\selectfont} instead. Also, I used node distance=-4mm to make the letters closer to each other, and adjusted the lower right coordinate a bit.

\documentclass[border=30pt]{standalone}
\usepackage[rm,medium]{roboto}
\usepackage[outline]{contour}
\usepackage{tikz}
\usetikzlibrary{positioning}

\definecolor{bittersweet}{HTML}{FE6F5E}

\makeatletter
\newif\ifmylettersdrawoutline

\tikzset{
  pics/my letters/.style={code={
    \begin{scope}[nodes={font={\sffamily\fontsize{150}{150}\selectfont},
                         node distance=-4mm}]
       \ifmylettersdrawoutline
         \edef\myLettersHandler{%
           % You might want to use /tikz/color instead of
           % /tikz/pics/my letters/inside.
           \noexpand\color{\pgfkeysvalueof{/tikz/pics/my letters/inside}}%
           \noexpand\contour{\pgfkeysvalueof{/tikz/pics/my letters/outline}}}
       \else
         \let\myLettersHandler\@firstofone
       \fi
       %
       \node (F) at (-7.8,0)      {\myLettersHandler{F}};
       \node[right=of F]      (E) {\myLettersHandler{E}};
       \node[below right=0.7mm and 0mm of F.south west] (B)
                                  {\myLettersHandler{B}};
       \node[right=-6mm of B] (R) {\myLettersHandler{R}};
       \node[right=of R]      (U) {\myLettersHandler{U}};
       \node[below right=0.7mm and 0mm of B.south west] (A)
                                  {\myLettersHandler{A}};
       \node[right=of A]      (r) {\myLettersHandler{R}};
       \node[right=-5mm of r] (Y) {\myLettersHandler{Y}};
    \end{scope}
  }, my letters/.cd, #1},
  pics/my letters/outline/.initial=bittersweet,
  pics/my letters/inside/.initial=black,
  % This one sets both colors in one go
  pics/my letters/outline and inside/.style={
    /tikz/pics/my letters/.cd, outline=#1, inside=#1},
  pics/my letters/draw outline/.is if=mylettersdrawoutline,
  pics/my letters/draw outline=false, % initial value
}
\makeatother

\begin{document}

\pagecolor{black}
% /tikz/my logo color determines the color of the letters *and* the line
\begin{tikzpicture}[my logo color/.style={
                      color={#1},
                      pics/my letters/outline and inside={#1}},
                    my logo color=bittersweet]

\coordinate (upper left)  at (-9,2);
\coordinate (lower right) at (0.3,-10.2);

\begin{scope}[overlay, pics/my letters/draw outline]
  \pic {my letters={inside=black}}; % override the inside color here
  \begin{scope}
    \clip (upper left) -- (lower right) |- cycle;
    \pic {my letters};
  \end{scope}
\end{scope}

\draw[very thick] (upper left) -- (lower right);
\end{tikzpicture}

\end{document}

variant using positioning

You may of course further adjust the placement of individual letters to your taste. :-)


This is just a short comment. I do not see why one cannot just type the text as text (rather than decomposing it into letters).

\documentclass[border=30pt]{standalone}
\usepackage{tikz}
\definecolor{bittersweet}{HTML}{FE6F5E} 
\usepackage[rm,medium]{roboto}
\usepackage[outline]{contour}
\begin{document}
\pagecolor{black}
\begin{tikzpicture}[font=\sffamily]
\begin{scope}
\def\mytxt{\contour{bittersweet}{FE}\\[-0.75ex] 
\contour{bittersweet}{BRU}\\[-0.75ex]
\contour{bittersweet}{ARY}}
\node[scale=15,align=left](txt) {\mytxt};
\clip ([xshift=3em]txt.north west) -- ([xshift=-3em]txt.south east)  |- cycle;
\node[scale=15,align=left,text=bittersweet](txt2) {\mytxt};
\end{scope}
\draw[very thick,bittersweet,shorten >=3em,shorten <=3em] ([xshift=3em]txt.north west) --
([xshift=-3em]txt.south east);
\end{tikzpicture}
\end{document}

enter image description here


Too easy with MetaFun.

\setupbodyfont[ss,20pt]
\definecolor[bittersweet][x=FE6F5E]

\starttext

\setMPtext
    {stack}
    {\vbox{
        \offinterlineskip
        \lineskip=1pt
        \halign{\alignmark\cr FE\cr BRU\cr ARY\cr}}}

\startMPpage
drawoptions(withcolor \MPcolor{bittersweet}) ;
picture p ;

p := outlinetext.b(\MPstring{stack})()() ;
clip p to (ulcorner p) -- (lrcorner p) -- (urcorner p) -- cycle ;
draw p ;

p := outlinetext.p(\MPstring{stack}) ;
clip p to (ulcorner p) -- (lrcorner p) -- (llcorner p) -- cycle ;
draw p ;

draw (ulcorner p) -- (lrcorner p) ;

p := currentpicture ;
fill bbox currentpicture withcolor black ;
draw p ;
\stopMPpage

\stoptext

enter image description here

Tags:

Tikz Pgf