MetaFun - Pragma ADE
MetaFun - Pragma ADE MetaFun - Pragma ADE
206 By default the shapes are filled after they are drawn. This has the advantage that in characters built out of pieces, disturbing lines fragments are covered. The drawback is that you get only half the linewidth. You can reverse the drawing order by adding the reversefill directive. The previous graphic then comes out as: graphictext "\bf Fun" scaled 4 zscaled (1,1.5) reversefill withdrawcolor blue withfillcolor .5white withpen pencircle scaled 5pt The reversefill directive can be countered by outlinefill. The next example is taken from the MAKEMPY manual. It demonstrates that you can combine TEX's powerful line breaking with METAPOST's graphic capabilities. \startuseMPgraphic{quotation} picture one ; one := image ( graphictext \MPstring{text} scaled 1.5 withdrawcolor .625blue withfillcolor .625white withpen pencircle scaled 1pt ; ) ; picture two ; two := image ( graphictext \MPstring{author} scaled 2 withdrawcolor .625red withfillcolor .625white withpen pencircle scaled 2pt ; ) ; currentpicture := one ; addto currentpicture also two shifted lrcorner one shifted - 1.125 lrcorner two shifted (0, - 1.250 * ypart urcorner two) ; setbounds currentpicture to boundingbox currentpicture enlarged 3pt ; \stopuseMPgraphic Special effects Outline fonts
In this graphic, we have two text fragments, the first one is a text, the second one the name of the author. We combine the quotation and author into this graphic using the following definitions: \setMPtext{text} {\vbox{\hsize 8.5cm \input zapf }} \setMPtext{author}{\hbox{\sl Hermann Zapf}} These definitions assume that the file zapf.tex is present on the system (which is the case when you have installed CONTEXT). The graphic can now be typeset using the following call: \placefigure {A text does not need to be an outline in order to be typeset in an outline font.} {\useMPgraphic{quotation}} Figure 8.9 A text does not need to be an outline in order to be typeset in an outline font. The quality of the output depends on how the glyphs are constructed. For instance, in TEX, math symbols are sometimes composed of glyph fragments and rules. graphictext "$$\sqrt{1+x}$$" scaled 8 Outline fonts Special effects 207
- Page 159 and 160: 6 Page backgrounds Especially in in
- Page 161 and 162: As soon as you want to make an elec
- Page 163 and 164: do_it (1,4,false) ; do_it (5,4,fals
- Page 165 and 166: gigigi Watch how the bounding boxes
- Page 167 and 168: You can test this concept yourself
- Page 169 and 170: StartPage ; fill Area[Text][Text] s
- Page 171 and 172: fi ; Main := Main enlarged 6pt ; pi
- Page 173 and 174: ulcorner Field[Text] [Text] -urcorn
- Page 175 and 176: The left picture demonstrates what
- Page 177 and 178: There are two more operators: inner
- Page 179 and 180: 7 Shapes, symbols and buttons One c
- Page 181 and 182: Table 7.1 demonstrates how scratch
- Page 183 and 184: for i := 1 upto \MPvar{n} : xpos :=
- Page 185 and 186: This table is defined as: \bTABLE[f
- Page 187 and 188: Since we have collected some nice b
- Page 189 and 190: 8 Special effects Sometimes we want
- Page 191 and 192: Because of this implementation, sha
- Page 193 and 194: test_shade(origin shifted (.25cm,0)
- Page 195 and 196: fill p shifted (3cm,0) withcolor .5
- Page 197 and 198: \definecolor [tred] [r=1,t=.5,a=exc
- Page 199 and 200: Figure 8.4 Another clipped cow. \pl
- Page 201 and 202: withpen pencircle scaled 4mm withco
- Page 203 and 204: Because this graphic is the result
- Page 205 and 206: The resulting PDF file can be inclu
- Page 207 and 208: Including another METAPOST graphic,
- Page 209: After these examples your are proba
- Page 213 and 214: } {}} Here we feed some MATHML int
- Page 215 and 216: 9 Functions METAPOST provides a wid
- Page 217 and 218: 9.2 Grids Some day you may want to
- Page 219 and 220: 13 13 13 13 Figure 9.1 Quick and di
- Page 221 and 222: 2 − ×10 1 − 1 0×100 Figure 9.
- Page 223 and 224: Figure 9.3 By using transparent col
- Page 225 and 226: There are enough applications out t
- Page 227 and 228: Of course we could extend this LUA
- Page 229 and 230: 10 Typesetting in METAPOST It is sa
- Page 231 and 232: Meta is a female lion! Figure 10.2
- Page 233 and 234: We use the low level CONTEXT macro
- Page 235 and 236: So, now we have: M etaPostisFun! Wh
- Page 237 and 238: n := n + 1 ; len[n] := \the\wd\MPbo
- Page 239 and 240: ap := point at of RotPath ; ad := d
- Page 241 and 242: \startoverlay {\startuseMPgraphic{f
- Page 243 and 244: \startuseMPgraphic{text draw} draw
- Page 245 and 246: vsize := ypart urcorner p - ypart l
- Page 247 and 248: We are now ready for an attempt to
- Page 249 and 250: We can manipulate the heigth and de
- Page 251 and 252: \strutheight) ; % height of first l
- Page 253 and 254: w := h := 6cm ; o := 6pt ; path p ;
- Page 255 and 256: Donald Knuth has spent the past sev
- Page 257 and 258: Donald Knuth has spent the past sev
- Page 259 and 260: 11 Debugging Those familiar with CO
In this graphic, we have two text fragments, the first one is a text, the second one the name of the<br />
author. We combine the quotation and author into this graphic using the following definitions:<br />
\setMPtext{text} {\vbox{\hsize 8.5cm \input zapf }}<br />
\setMPtext{author}{\hbox{\sl Hermann Zapf}}<br />
These definitions assume that the file zapf.tex is present on the system (which is the case when<br />
you have installed CONTEXT). The graphic can now be typeset using the following call:<br />
\placefigure<br />
{A text does not need to be an outline in order to be<br />
typeset in an outline font.}<br />
{\useMPgraphic{quotation}}<br />
Figure 8.9 A text does not need to be an<br />
outline in order to be typeset in an outline font.<br />
The quality of the output depends on how the glyphs are constructed. For instance, in TEX, math<br />
symbols are sometimes composed of glyph fragments and rules.<br />
graphictext<br />
"$$\sqrt{1+x}$$"<br />
scaled 8<br />
Outline fonts Special effects<br />
207