Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to add text on the paths on the left side with font size continuously adjusted from \Huge to \tiny to achieve a perspective like effect. The font size steps shouldn't be \Huge, \huge, \LARGE, … \tiny, but font size should take values between the listed sizes too.

I'd like to achieve something like this:

And put it on the paths on the first figure.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}

\begin{document}

\begin{tikzpicture}[y=0.80pt,x=0.80pt,yscale=-1, inner sep=0pt, outer sep=0pt]
% BOTTOM_1
\path [decorate,%
    decoration={text along path,%
    text={|\tiny|~~Lorem ipsum dolor sit amet, dona abstulit meis~||},%
    text align={fit to path stretching spaces}}]
        (373.7500, 406.2500) -- (586.2500, 406.2500);

% BOTTOM_2
\path [decorate,%
    decoration={text along path,%
    text={|\scriptsize|~~commendet' permansit in. Adhibitis amor est~||},%
    text align={fit to path stretching spaces}}]
        (366.6667,413.3333) -- (593.3333,413.3333);

% BOTTOM_3
\path [decorate,%
    decoration={text along path,%
    text={|\footnotesize|~amet constanter determinatio debitis torporis~||},%
    text align={fit to path stretching spaces}}]
        (358.5714,421.4286) -- (601.4286,421.4286);

% BOTTOM_4
\path [decorate,%
    decoration={text along path,%
    text={|\small|~quin. Suam ad quia ei quoque sed dominum oculo~||},%
    text align={fit to path stretching spaces}}]
        (349.2308,430.7692) -- (610.7692,430.7692);

% BOTTOM_5
\path [decorate,%
    decoration={text along path,%
    text={|\normalsize|~capillos quam aniculae morsque nutricem valeas~||},%
    text align={fit to path stretching spaces}}]
        (338.3333,441.6667) -- (621.6667,441.6667);

% BOTTOM_6
\path [decorate,%
    decoration={text along path,%
    text={|\large|~Apollonium contigit cum. Taliarchum in modo~||},%
    text align={fit to path stretching spaces}}]
        (325.4545,454.5455) -- (634.5454,454.5455);

% BOTTOM_7
\path [decorate,%
    decoration={text along path,%
    text={|\Large|~invenit iuvenem patre ad quia illum ille~||},%
    text align={fit to path stretching spaces}}]
        (310.0000,470.0000) -- (650.0000,470.0000);

% BOTTOM_8
\path [decorate,%
    decoration={text along path,%
    text={|\LARGE|~illum decidat quam dicentes multa prima~||},%
    text align={fit to path stretching spaces}}]
        (291.1111,488.8889) -- (668.8889,488.8889);

% BOTTOM_9
\path [decorate,%
    decoration={text along path,%
    text={|\huge|~donatoris substantiae. Esse deprecor~||},%
    text align={fit to path stretching spaces}}]
        (267.5000,512.5000) -- (692.6609,512.5000);

% BOTTOM_10
\path [decorate,%
    decoration={text along path,%
    text={|\Huge|~cum magna Dianam Interposito eum.||},%
    text align={fit to path stretching spaces}}]
        (237.1429,542.8571) -- (722.8571,542.8571);

% LEFT_6
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,280.7209) -- (940.1713,332.1807);

% LEFT_5
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,368.2026) -- (940.1713,368.2026);

% LEFT_4
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,455.6843) -- (940.1713,404.2245);

% LEFT_3
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,543.1661) -- (940.1713,440.2464);

% LEFT_2
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,630.6478) -- (940.1713,476.2683);

% LEFT_1
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,718.1295) -- (940.1713,512.2902);

% BOTTOM_LEFT
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,805.6112) -- (940.1713,548.3120);

    % BOTTOM_RIGHT
\path[draw, cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (1300.3902,548.3120) -- (1557.6894,805.6112);

% path3109
\path[cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}},draw=black,line
  join=miter,line cap=butt,line width=0.800pt] (682.8721,805.6112) --
  (682.8721,280.7209);

% path3111
\path[cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}},draw=black,line
  join=miter,line cap=butt,line width=0.800pt] (940.1713,332.1807) --
  (940.1713,548.3120);

% path3113
\path[cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}},draw=black,line
  join=miter,line cap=butt,line width=0.800pt] (940.1713,548.3120) --
  (1300.3902,548.3120);

% path3126
\path[cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}},draw=black,line
  join=miter,line cap=butt,line width=0.800pt] (940.1713,332.1807) --
  (1300.3902,548.3120);

% path3902
\path[cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}},draw=black,fill=black]
  (940.9426,440.5375) -- (940.9426,333.5818) -- (941.8770,334.0818) .. controls
  (943.1031,334.7380) and (1296.8461,547.1006) .. (1297.0831,547.3227) ..
  controls (1297.1831,547.4165) and (1217.0924,547.4932) .. (1119.1038,547.4932)
  -- (940.9426,547.4932) -- (940.9426,440.5375) -- cycle;

\end{tikzpicture}
\end{document}

Edit #1

Using \foreach in TikZ I've managed to get almost the desired effect for one character.

\newcommand\myfontsize[1]{\fontsize{#1}{10}\selectfont}

\begin{tikzpicture}
    \foreach \x in {22.82086,...,6.80565}
    {
        \draw (-\x, 0) node {\myfontsize{\x}a};
    }
\end{tikzpicture}

But still I don't know how to apply this for a series of characters (e.g. a sentence), and put the text on the path.


Edit #2

Reading further the TikZ manual I found out that I can iterate through two variables simultaneously. This allows me to use different font sizes for each character in the iteration.

\begin{tikzpicture}
    \foreach \i/\char in {22.82086/a,18.8170575/b,14.813255/c,10.8094525/d,6.80565/e}
    {
        \draw (-\i, 0) node {\myfontsize{\i}\char};
    }
\end{tikzpicture}

However I have to specify the step size explicitly in the \foreach loop. So this raises the question that how can I calculate the step size depending on the number of characters I want to print.

share|improve this question
2  
I have no automated solution but \scalebox{<factor>}{content} from the graphicx package allows you to scale in small steps. –  Uwe Ziegenhagen Nov 28 '12 at 13:37
2  
I don't think changing font size is a good idea. As seen in your example, you're getting different design sizes with vastly different glyph shapes, which doesn't suit the "perspective" idea at all. Hence, I second @UweZiegenhagen s idea of using \scalebox. Maybe \resizebox is even better because you can give the desired length. –  Stephan Lehmke Nov 28 '12 at 13:49
3  
Have a look at Asymptote. It's able to draw TeX on almost any surface, see the gallery, e.g. the Klein bottle. –  Alex Nov 28 '12 at 19:04
add comment

1 Answer

up vote 3 down vote accepted

I've found the answer for my problem at the question Text spirals with TikZ. All credit goes to the original answer.

After including the following macro you can use the text path start scale=2.4 and text path end scale=0.5 key-value pairs in the decoration options.

\makeatletter

\let\pgf@lib@dec@text@dobox@original=\pgf@lib@dec@text@dobox%

\def\pgf@lib@dec@text@dobox{%
    \pgf@lib@dec@text@dobox@original%
    \ifpgfdecorationtextalongpathscaletext%
    \pgfmathparse{\pgf@lib@dec@text@endscale+(\pgf@lib@dec@text@startscale-\pgf@lib@dec@text@endscale)*\pgfdecoratedremainingdistance/\pgfdecoratedpathlength}%
    \setbox\pgf@lib@dec@text@box=\hbox{\scalebox{\pgfmathresult}{\box\pgf@lib@dec@text@box}}%
    \fi%
}
\newif\ifpgfdecorationtextalongpathscaletext
\def\pgf@lib@dec@text@startscale{1}
\def\pgf@lib@dec@text@endscale{1}

\pgfkeys{/pgf/decoration/.cd,
    text path start scale/.code={%
        \pgfdecorationtextalongpathscaletexttrue%
        \def\pgf@lib@dec@text@startscale{#1}%
    },
    text path end scale/.code={%
        \pgfdecorationtextalongpathscaletexttrue%
        \def\pgf@lib@dec@text@endscale{#1}%
    }
}

See LEFT_1 path in the question and replace it with the following:

% LEFT_1
\path[decorate,%
    decoration={text along path,%
    text path start scale=2.4,
    text path end scale=0.5,
    text={vso nbl dsfn klijvb sodvn},%
    text align={fit to path stretching spaces}},%
    cm={{0.55521796,0.0,0.0,0.55521796,(-142.0,95.56731)}}]
    (682.8721,718.1295) -- (940.1713,512.2902);

The oputput will be:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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