summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/luametafun/luametafun-followtext.tex
blob: 0791315656af3b465738468bbfbc333337a9b6cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% language=us

\environment luametafun-style

\startcomponent luametafun-followtext

\startchapter[title={Followtext}]

Typesetting text along a path started as a demo if communication between \TEX\ and
\METAPOST\ in the early days of \METAFUN. In the meantime the implementation has
been modernized a few times and the current implementation feels okay, especially
now that we have a better user interface. Here is an example:

\startbuffer[1a]
\startMPcode{doublefun}
    draw lmt_followtext [
        text   = "How well does it work {\bf 1}! ",
        path   = fullcircle scaled 4cm,
        trace  = true,
        spread = true,
    ] ysized 5cm ;
\stopMPcode
\stopbuffer

\typebuffer[1a][option=TEX]

Here is the same example but with the text in the reverse order. The results of both examples
are shown in \in {figure} [followtext:1].

\startbuffer[1b]
\startMPcode{doublefun}
    draw lmt_followtext [
        text    = "How well does it work {\bf 2}! ",
        path    = fullcircle scaled 4cm,
        trace   = true,
        spread  = false,
        reverse = true,
    ] ysized 5cm ;
\stopMPcode
\stopbuffer

\typebuffer[1b][option=TEX]

\startplacefigure[reference=followtext:1]
    \startcombination[2*2]
       {\getbuffer[1a]} {}
       {\getbuffer[1b]} {}
    \stopcombination
\stopplacefigure

There are not that many options. One is \type {autoscale} which makes the shape
and text match. \in {Figure} [followtext:2] shows what happens.

\startbuffer[2a]
\startMPcode{doublefun}
    draw lmt_followtext [
        text        = "How well does it work {\bf 3}! ",
        trace       = true,
        autoscaleup = "yes"
    ] ysized 5cm ;
\stopMPcode
\stopbuffer

\typebuffer[2a][option=TEX]

\startbuffer[2b]
\startMPcode{doublefun}
    draw lmt_followtext [
        text        = "How well does it work {\bf 4}! ",
        path        = fullcircle scaled 2cm,
        trace       = true,
        autoscaleup = "max"
    ] ysized 5cm ;
\stopMPcode
\stopbuffer

\typebuffer[2b][option=TEX]

\startplacefigure[reference=followtext:2]
    \startcombination[2*2]
       {\getbuffer[2a]} {}
       {\getbuffer[2b]} {}
    \stopcombination
\stopplacefigure

You can use quite strange paths, like the one show in \in {figure}
[followtext:3]. Watch the parenthesis around the path. this is really needed in
order for the scanner to pick up the path (otherwise it sees a pair).

\startbuffer[3]
\startMPcode{doublefun}
    draw lmt_followtext [
        text        = "\samplefile {zapf}",
        path        = ((3,0) .. (1,0) .. (5,0) .. (2,0) .. (4,0) .. (3,0)),
        autoscaleup = "max"
    ] xsized TextWidth ;
\stopMPcode
\stopbuffer

\typebuffer[3][option=TEX]

\startplacefigure[reference=followtext:3]
    \getbuffer[3]
\stopplacefigure

The small set of options is:

\starttabulate[|T|T|T|p|]
\FL
\BC name          \BC type    \BC default      \BC comment \NC \NR
\ML
\NC text          \NC string  \NC              \NC \NC \NR
\NC spread        \NC string  \NC true         \NC \NC \NR
\NC trace         \NC numeric \NC false        \NC \NC \NR
\NC reverse       \NC numeric \NC false        \NC \NC \NR
\NC autoscaleup   \NC numeric \NC no           \NC \NC \NR
\NC autoscaledown \NC string  \NC no           \NC \NC \NR
\NC path          \NC string  \NC (fullcircle) \NC \NC \NR
\LL
\stoptabulate

\stopchapter

\stopcomponent