更简单的方法

更简单的方法

在此处输入图片描述

\documentclass[border=30pt]{standalone}
\usepackage[dvipsnames,x11names]{xcolor}
\definecolor{bittersweet}{HTML}{FE6F5E} 
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\usepackage[rm,medium]{roboto}
\usepackage[outline]{contour}
\begin{document}
\pagecolor{black}
\begin{tikzpicture}[font=\sffamily]
\clip (-9.5,-10) rectangle (0,2.5);
\begin{scope}[overlay]
\node[scale=15,even odd rule] (F) at (-7.8,0) {\color{black}\contour{bittersweet}{F}};
\node[scale=15,node distance=2mm,right of= F] (E) {\color{black}\contour{bittersweet}{E}};
\node[scale=15,node distance=2.6mm,below of= F,xshift=.3pt] (B) {\color{black}\contour{bittersweet}{B}};
\node[scale=15,node distance=2mm,right of= B] (R) {\color{black}\contour{bittersweet}{R}};
\node[scale=15,node distance=2mm,right of= R] (U) {\color{black}\contour{bittersweet}{U}};
\node[scale=15,node distance=2.6mm,below of= B] (A) {\color{black}\contour{bittersweet}{A}};
\node[scale=15,node distance=2mm,right of= A] (r) {\color{black}\contour{bittersweet}{R}};
\node[scale=15,node distance=2mm,right of= r] (Y) {\color{black}\contour{bittersweet}{Y}};
\end{scope}
%\draw[red!50,step=5mm] (-9,-10) grid (8,10) ;
\draw[very thick,bittersweet] (-9,2)--(0,-10);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

我提出了三种方法,外加一种实际使用positioning库的变体。第一种方法比较简单,但第二种和第三种方法有更多的旋钮,并允许您在中心位置指定所需的颜色(您也可以使用 来执行此操作\colorlet,但这样做是出于此处的精神\pgfkeys)。所有三种方式都提供完全相同的输出。使用positioning库的变体给出的字母位置略有不同,但这当然可以进一步调整。

截屏

由于您的字母放置技术不使用positioning库,因此我在前三个示例中删除了\usetikzlibrary{positioning}。最后,我将向您展示一种使用库的方法以及一种不同的字体缩放方法。

更简单的方法

\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}

灵活的方式 (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}

灵活的方式 (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}

使用positioning

如果您想使用该positioning库,放置方式会有所不同。在这种情况下,我删除了 ,scale=15而改用font={\sffamily\fontsize{150}{150}\selectfont}。此外,我曾经node distance=-4mm让字母彼此更接近,并lower right稍微调整了坐标。

\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}

使用定位的变体

当然,您可以根据自己的喜好进一步调整单个字母的位置。:-)

答案2

这只是一条简短的评论。我不明白为什么不能直接将文本作为文本输入(而不是将其分解为字母)。

\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}

在此处输入图片描述

答案3

使用 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

在此处输入图片描述

相关内容