2

I’m trying to emulate in TikZ a title page which I’ve previously drawn in SVG. The image below is from the SVG version, where the shadowed text is achieved using a feGaussianBlur filter. But everything I’ve found regarding filters and shadows and such with TikZ seems not to apply to text.

Is there a way to achieve this result?

Current code (translated by hand from the SVG and adapted to my book layout):

\documentclass[11pt,extrafontsizes]{memoir}

\setstocksize{9in}{6in}
\settrimmedsize{\stockheight}{\stockwidth}{*}
\medievalpage[12]
\checkandfixthelayout

%\usepackage{fontspec}
%\newfontfamily\gingerfont{RM Ginger}
%\newcommand*{\ginger}[1]{\gingerfont\fontsize{#1}{#1}\selectfont}
\newcommand*{\ginger}[1]{\normalfont\fontsize{#1}{#1}\selectfont}

\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc,positioning,decorations.text}
\tikzset{x=1in,y=1in}

\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay,shift={($ (current page.south west) + (0.5, 0.5) $)}]

  \node at (2.5, 7) [font=\ginger{31.5}, anchor=base] {Unshadowed Text};

  \draw[shift={(0, 5.75)}, decorate,
      decoration={text along path, text align=center,
      text={|\ginger{40.5}|The Long Title}}]
    (0, 0) .. controls (1, 0.5) and (1.625, 0.625) .. (2.5, 0.625)
      .. controls (3.375, 0.625) and (4, 0.5) .. (5, 0);

  \node at (2.5, 6.125) [font=\ginger{31.5}, anchor=base] {of};

  \draw[shift={(0, 5)}, decorate,
      decoration={text along path, text align=center,
      text={|\ginger{81}|the Book}}]
    (0, 0) .. controls (1, 0.5) and (1.625, 0.625) .. (2.5, 0.625)
      .. controls (3.375, 0.625) and (4, 0.5) .. (5, 0);

  \node at (2.5, 4.25) [font=\ginger{47.25}, anchor=base] {A. U. Thor};

  \node at (2.5, 3) [font=\ginger{31.5}, anchor=base] {More unshadowed text};

  \node at (2.5, 2.5) [font=\ginger{27}, anchor=base] {and some more};
\end{tikzpicture}
\end{document}

What the SVG version looks like: Example title page with SVG blur

  • (Yes, the example text overlaps in a not-pretty way. The actual title looks just fine.) – J. C. Salomon Nov 12 '17 at 23:07
  • You can turn the text into a picture and manipulate it. For example, by using the text to define a shading or fading. Or you can do certain things to characters in text using the decorations.text library. But if you want Gaussian shadings, stick with a tool that gives you Gaussian shadings. Is there really any reason to redo this in TikZ? – cfr Nov 13 '17 at 0:21
  • The main reason for the reimplementation is that I’m not satisfied with the quality of the SVG-to-PDF transformation I get from Inkscape. The secondary reason is that I want to learn TikZ better. – J. C. Salomon Nov 13 '17 at 1:48
  • 1
    Well, I don't think you'll get your Gaussian blur. Not unless you implement it directly using some plot of a function or something. (If that's even how it works.) You can maybe do something vaguely similar and hackish. However, note that the results may not print correctly or display correctly in all PDF viewers. (Some printers work better than others for this kind of thing; some PDF viewers work better than others. Transparency and shading affects are rather unpredictable.) – cfr Nov 13 '17 at 1:55
  • 1
    Applying a Gaussian blur using a graphics editor can be time consuming, so imagine how long it would take a dancing bear like TikZ to do it. – John Kormylo Nov 13 '17 at 16:26

Your Answer

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

Browse other questions tagged or ask your own question.