3

Consider the code:

\documentclass{article}
\usepackage[sfdefault]{cabin}
\usepackage[english]{babel}
\usepackage{tikz} 
\usetikzlibrary{fadings}
\usepackage{scalefnt}
\definecolor{DarkRed}{RGB}{139,0,0}
\definecolor{PureGold}{RGB}{255,215,0}


\def\theLetterSpace{0.5pt}
\def\theWordSpace{1.5\LocalLetterSpace}
\newlength\LocalLetterSpace
\newcommand\spaceout[2][\theLetterSpace]{%
  \setlength\LocalLetterSpace{#1}\expandafter\spaceouthelpA#2 \relax\relax}
\def\spaceouthelpA#1 #2\relax{%
  \spaceouthelpB#1\relax\relax%
  \ifx\relax#2\else\ \kern\theWordSpace\spaceouthelpA#2\relax\fi
}
\def\spaceouthelpB#1#2\relax{%
  #1%
  \ifx\relax#2\else
    \kern\LocalLetterSpace\spaceouthelpB#2\relax%
  \fi
}

 
\usetikzlibrary{decorations.text}
\tikzset{mydecor/.style 2 args={decoration={text along path,
        text align={left indent=1.5em},
        text={|\bfseries\tiny|#2},
        },
      yshift=#1,
      decorate}}
      
      
\newcommand{\mytitle}[1]% #1 = title
{\bgroup
\huge
\sbox0{\parbox{\columnwidth}{\centering\textbf{\color{black}#1}}}%
\sbox1{\parbox{\columnwidth}{\centering\textbf{\color{PureGold}#1}}}%
\usebox0\llap{\raisebox{1.37pt}{\usebox1}}
\egroup}
      
\begin{document}
\thispagestyle{empty}

\begin{center}
\begin{tikzpicture}
\begin{scope}
\draw[color=PureGold,fill=DarkRed] (0,0) circle (3.5cm);
\draw[color=PureGold,fill=PureGold] (0,0) circle (2.6cm);
\draw[color=PureGold,fill=PureGold] (0,0) circle (2.43cm);
\end{scope}

\path [postaction={decorate,decoration={raise=-1.5ex,text along path, 
reverse path,text align=center, text={|\LARGE\spaceout[3.5pt]\bfseries\color{PureGold}|RED AND GOLD}}}] (-30:3.05cm) arc (-30:210:3.05cm);
\end{tikzpicture}
\end{center}


\begin{center}
\begin{tikzpicture}
\begin{scope}
\draw[color=DarkRed,fill=DarkRed] (0,0) circle (3.5cm);
\draw[color=PureGold,fill=PureGold] (0,0) circle (2.6cm);
\draw[color=PureGold,fill=PureGold] (0,0) circle (2.43cm);
\end{scope}

\path [postaction={decorate,decoration={raise=-1.5ex,text along path, 
reverse path,text align=center, text={|\LARGE\spaceout[3.5pt]|{\mytitle{RED AND GOLD}}}}}] (-30:3.05cm) arc (-30:210:3.05cm);
\end{tikzpicture}
\end{center}
\end{document}

which produces the output

enter image description here

As you can see, when I shadow the title and try to arch it (as I have successfully done in the first case), I do not succeed.

QUESTION: Can someone point out how I may modify the code in order to have the shadowed title (generated by \mytitle) appear arched within the red-shaded ring of the disk?

I compile the code with pdflatex. Incidentally, this question uses a graphic very similar to that in the post Providing an Authentic Finish to a TIKZ Gold Plate.

Thank you.

4
  • Off-topic: don't use scalefnt with fontspec. It is for type1 and bitmap fonts.
    – cfr
    Commented Jun 14 at 2:36
  • @cfr How is one supposed to scale fonts when using \fontspec?
    – DDS
    Commented Jun 14 at 2:37
  • Let us continue this discussion in chat.
    – cfr
    Commented Jun 14 at 2:51
  • We should tidy up here ... ;).
    – cfr
    Commented Jun 14 at 3:34

2 Answers 2

4

I think you are making this way too complicated. You can use the decoration text along path twice: first in black, second in gold, shifted up from the first. The code text={|\color{black}\bfseries\sffamily\LARGE\,|#1}}} adds a thin space (\,) between each character.

enter image description here

\documentclass{article}
\usepackage[sfdefault]{cabin}
\usepackage[english]{babel}
\usepackage{tikz} 
\usetikzlibrary{decorations.text}
\definecolor{DarkRed}{RGB}{139,0,0}
\definecolor{PureGold}{RGB}{255,215,0}
 
\tikzset{
    mydecor/.style={line width=9mm, DarkRed,
        postaction={decorate, decoration={text along path, text align=center, raise=-1.8ex, text={|\color{black}\bfseries\sffamily\LARGE\,|#1}}}, 
        postaction={decorate, decoration={text along path, text align=center, raise=-1.5ex, text={|\color{PureGold}\bfseries\sffamily\LARGE\,|#1}}}
}}

\begin{document}

\begin{center}
\begin{tikzpicture}
\draw[mydecor=RED AND GOLD] (180:3.05)arc(180:0:3.05);
\draw[mydecor={}] (180:3.05)arc(180:360:3.05);
\fill[PureGold] (0,0) circle (2.6cm);
\end{tikzpicture}
\end{center}
\end{document}

\end{document}
4
  • 1
    Why did you change \bfseries to \bf? \bf ought not be used in LaTeX. The OP's use of \bfseries was correct. \bf is not even defined by all classes.
    – cfr
    Commented Jun 14 at 4:54
  • @cfr: It's in the tikz-pgf manual in the description of /pgf/decoration/text=⟨text⟩, section 50.7 Text Decorations. I thought it was something specific to the text along path decoration, but maybe it's just a holdover from an old version of the manual. I changed my code at any rate. Thanks for the info.
    – Sandy G
    Commented Jun 14 at 13:47
  • Thank you once again for a your fine answer.
    – DDS
    Commented Jun 14 at 14:03
  • Thanks for editing! The manual shouldn't do it either in LaTeX examples. But it would be fine in plain.
    – cfr
    Commented Jun 14 at 14:59
2

You need to decorate two slightly different paths to approximate the shadow with the first. It is easier to do this (at least for me) if I'm not calculating angles and points from a point somewhere in the southeast quadrant, but from the origin, and that I arrange things so there is no need to reverse paths. That makes it easy to shift the shadowing a little to the left without getting entangled in pgfmath.

I removed scalefnt. It is designed for use with postscript type1 and bitmap fonts. It explicitly tests whether the font scaled is postscript or bitmap. (At least, I think that's what it does.) If neither, it does nothing, so it is probably merely pointless rather than positively injurious.

\documentclass[tikz]{standalone}
\usepackage[sfdefault]{cabin}
\usepackage[english]{babel}% better to specify variant
\definecolor{DarkRed}{RGB}{139,0,0}
\definecolor{PureGold}{RGB}{255,215,0}

\def\theLetterSpace{0.5pt}
\def\theWordSpace{1.5\LocalLetterSpace}
\newlength\LocalLetterSpace
\newcommand\spaceout[2][\theLetterSpace]{%
  \setlength\LocalLetterSpace{#1}\expandafter\spaceouthelpA#2 \relax\relax}
\def\spaceouthelpA#1 #2\relax{%
  \spaceouthelpB#1\relax\relax%
  \ifx\relax#2\else\ \kern\theWordSpace\spaceouthelpA#2\relax\fi
}
\def\spaceouthelpB#1#2\relax{%
  #1%
  \ifx\relax#2\else
  \kern\LocalLetterSpace\spaceouthelpB#2\relax%
  \fi
}


\usetikzlibrary{decorations.text}
\tikzset{mydecor/.style 2 args={decoration={text along path,
      text align={left indent=1.5em},
      text={|\bfseries\tiny|#2},
    },
    yshift=#1,
    decorate}}

\begin{document}
\begin{tikzpicture}
  \begin{scope}
    \draw[color=PureGold,fill=DarkRed] (0,0) circle (3.5cm);
    \draw[color=PureGold,fill=PureGold] (0,0) circle (2.6cm);
  \end{scope}
  \coordinate (a) at (182:3.05cm);
  \coordinate(b) at (-3.05cm,0);
  \path [%
    decorate,decoration={raise=-2ex,text along path,text align=center, text={|\LARGE\spaceout[3.5pt]\bfseries|RED AND GOLD}}] (a) arc (182:2:3.05cm);
  \path [%
    decorate,decoration={raise=-1.25ex,text along path,text align=center, text={|\LARGE\spaceout[3.5pt]\bfseries\color{PureGold}|RED AND GOLD}}] (b) arc (180:0:3.05cm);
\end{tikzpicture}
\end{document}

shadowed text on path

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .