4

I'm trying to get more white halo around text. I'm using tikz and contour package. I know that I should use \contournumber{X} to change the numbers of copies. But I can't figure out how to use the command.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{contour}

\begin{document}
    \begin{tikzpicture}
    \filldraw[fill=blue!40!white, draw=black] (-5,-5) rectangle (5,5);
    \draw (0, 0) node[]     {\contour{white} {I CAN FEEL YOUR HALO HALO HALO!!}};
    \end{tikzpicture}
\end{document}

%   \contournumber{64}
5

The number of copies does not make the white halo larger, but smoother. The larger white area can be achieved by increasing the contour length. The following example sets both:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{contour}
\contournumber{64}% default is 16, star form uses 32
\contourlength{.06em}% default is 0.03em

\begin{document}
    \begin{tikzpicture}
    \filldraw[fill=blue!40!white, draw=black] (-5,-5) rectangle (5,5);
    \draw (0, 0) node[] {\contour{white} {I CAN FEEL YOUR HALO HALO HALO!!}};
    \end{tikzpicture}
\end{document}

Result contour

Implementation via package pdfrender that uses a PDF feature for vector fonts. Therefore, it is limited to PDF mode of pdfTeX and LuaTeX (recent LuaTeX also requires package luatex85). The advantage is that the text is drawn twice only. The first time it is stroked with a thick line width in white, then it is overprinted in black.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pdfrender}
\newcommand*{\contour}[2]{%
  \leavevmode
  \rlap{%
    \textpdfrender{
      TextRenderingMode=Stroke,
      StrokeColor=white,
      LineWidth=.12em,
    }{#2}%
  }%
  \mbox{#2}%
}
\begin{document}
    \begin{tikzpicture}
    \filldraw[fill=blue!40!white, draw=black] (-5,-5) rectangle (5,5);
    \draw (0, 0) node[] {\contour{white} {I CAN FEEL YOUR HALO HALO HALO!!}};
    \end{tikzpicture}
\end{document}

Result pdfrender

The width of the white halo in comparison: 2 * contour length = 1 * line width of pdfrender.

2
  • Oooh, I didn't think of putting the command in the pre-maple. I was trying to put with the sentence. - Great, I like the pdf render method. Thanks!
    – Bjartmar
    Apr 8 '17 at 18:41
  • Dear Heiko, would you mind to print the link to this answer into the manual of pdfrender.sty? Because from reading the manual I didn't get any idea what the whole package was good for.
    – Keks Dose
    Apr 8 '17 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.