2

How to do automatic raising text?

1pt-2pt-3pt ... 12pt

enter image description here

Related to: https://www.tug.org/texshowcase/diminuendo.tex

Özgür
  • 3,270

3 Answers3

4

A version with expl3 and looping of \str variable.

\documentclass{article}
\usepackage{graphicx}

\usepackage{xparse}


\ExplSyntaxOn
\cs_new:Nn \resize_me:nn {
  \str_set:Nx \l_tmpa_str {#2}
  \fp_set:Nn \l_tmpa_fp {1.0}
  \int_step_inline:nnnn {1}{1}{\str_count:N \l_tmpa_str}{%
    \scalebox{\fp_use:N \l_tmpa_fp}{\str_item:Nn \l_tmpa_str {##1}}
    \fp_add:Nn \l_tmpa_fp {#1}
  }
}

\newcommand{\raisetext}[2][0.5]{%
\resize_me:nn{#1}{#2}
}
\ExplSyntaxOff
\begin{document}

\raisetext[0.3]{A very long useless text}

\end{document}

enter image description here

2

The decorations.text library for TikZ allows to decorate arbitrary paths with text or create paths from mutated text. The manual has an example describing your exact query.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[decoration={text effects along path,
    text={text effects along path!},
    text effects/.cd,
    path from text,
    character count=\i, character total=\n,
    characters={text along path, scale=\i/\n+0.5}}]
  \path [decorate] (0,0);
\end{tikzpicture}
\end{document}

enter image description here

Henri Menke
  • 109,596
1

Here is a version using OPmac:

\input opmac

\def\grow{\futurelet\next\growA}
\def\growA{\expandafter\ifx\space\next \space\fi \growB}
\def\growB#1{\ifx.#1.\else#1\textfontscale[1100]\expandafter\grow\fi}

\grow This is text.

\bye
wipet
  • 74,238