29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ulcorner Field[Text] [Text] -urcorner<br />

Field[OuterMargin][Text] -- cycle ;<br />

\includeMPgraphic{draw page}<br />

StopPage ;<br />

\stopreusableMPgraphic<br />

Watch how we used a reusable graphic first and a simple usable one next. Actually, the next<br />

graphic is not a stand alone graphic.<br />

\startuseMPgraphic{draw page}<br />

Main := Main enlarged 6pt ;<br />

pickup pencircle scaled 2pt ;<br />

fill Page withcolor .625white ;<br />

fill Main withcolor .850white ;<br />

draw Main withcolor .625red ;<br />

\stopuseMPgraphic<br />

We have seen some predefined paths and locations. Apart from the Page path, they take two<br />

arguments that specify their position on the layout grid.<br />

path Area [][] an area similar to a CONTEXT one<br />

pair Location [][] the position of this area<br />

path Field [][] the area positioned at the right place<br />

path Page the page itself<br />

Some less used and more obscure variables are the following.<br />

numeric Hstep [] the horizontal distance to the previous area<br />

numeric Vstep [] the vertical distance to the previous area<br />

numeric Hsize [] the width of an area<br />

numeric Vsize [] the height of an area<br />

The array variables are accessed by using constants:<br />

horizontal vertical<br />

LeftEdge Top<br />

LeftEdgeSeparator TopSeparator<br />

LeftMargin Header<br />

LeftMarginSeparator HeaderSeparator<br />

Text Text<br />

RightMarginSeparator FooterSeparator<br />

RightMargin Footer<br />

RightEdgeSeparator BottomSeparator<br />

RightEdge Bottom<br />

In addition to these, there are Margin, InnerMargin and OuterMargin which adapt themselves to<br />

the current odd or even page. The same is true for Edge, InnerEdge and OuterEdge, although<br />

these will seldom be used, since interactive documents are always single sided.<br />

We started this chapter with spending a lot of code to simulate the page areas. It will be clear now<br />

that in practice this is much easier using the mechanism described here.<br />

Crossing borders Page backgrounds<br />

169

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!