%D \module %D [ file=meta-pag, %D version=1999.07.10, %D title=\METAPOST\ Graphics, %D subtitle=Initialization, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. %D These definitions used to be part of the old \type %D {core-mps} file, later changed into \type {meta-ini}, but %D keeping them separate is cleaner. \writestatus{loading}{MetaPost Graphics / Page Data Management} \unprotect %D The next few macros tell \METAPOST\ how the \CONTEXT\ %D pagebody looks. \startMPextensions boolean PageStateAvailable,OnRightPage,InPageBody; PageStateAvailable:=true; \stopMPextensions \startMPinitializations OnRightPage:=true; InPageBody:=\ifinpagebody true \else false \fi; \stopMPinitializations \startMPinitializations def LoadPageState = OnRightPage:=\MPonrightpage; OnOddPage:=\MPonoddpage; RealPageNumber:=\the\realpageno; PageNumber:=\the\pageno; NOfPages:=\lastpage; PaperHeight:=\the\paperheight; PaperWidth:=\the\paperwidth; PrintPaperHeight:=\the\printpaperheight; PrintPaperWidth:=\the\printpaperwidth; TopSpace:=\the\topspace; BottomSpace:=\the\bottomspace; BackSpace:=\the\backspace; CutSpace:=\the\cutspace; MakeupHeight:=\the\makeupheight; MakeupWidth:=\the\makeupwidth; TopHeight:=\the\topheight; TopDistance:=\the\topdistance; HeaderHeight:=\the\headerheight; HeaderDistance:=\the\headerdistance; TextHeight:=\the\textheight; FooterDistance:=\the\footerdistance; FooterHeight:=\the\footerheight; BottomDistance:=\the\bottomdistance; BottomHeight:=\the\bottomheight; LeftEdgeWidth:=\the\leftedgewidth; LeftEdgeDistance:=\the\leftedgedistance; LeftMarginWidth:=\the\leftmarginwidth; LeftMarginDistance:=\the\leftmargindistance; TextWidth:=\the\textwidth ; RightMarginDistance:=\the\rightmargindistance; RightMarginWidth:=\the\rightmarginwidth; RightEdgeDistance:=\the\rightedgedistance; RightEdgeWidth:=\the\rightedgewidth; InnerMarginDistance:=\the\innermargindistance; InnerMarginWidth:=\the\innermarginwidth; OuterMarginDistance:=\the\outermargindistance; OuterMarginWidth:=\the\outermarginwidth; InnerEdgeDistance:=\the\inneredgedistance; InnerEdgeWidth:=\the\inneredgewidth; OuterEdgeDistance:=\the\outeredgedistance; OuterEdgeWidth:=\the\outeredgewidth; PageOffset:=\the\pageoffset; PageDepth:=\the\pagedepth; LayoutColumns:=\the\layoutcolumns; LayoutColumnDistance:=\the\layoutcolumndistance; LayoutColumnWidth:=\the\layoutcolumnwidth; enddef; \stopMPinitializations \def\MPonrightpage{true} \def\MPonoddpage {true} \def\freezeMPpagelayout {\edef\MPonrightpage{\doifbothsides {tru}{tru}{fals}e}% \edef\MPonoddpage {\doifoddpageelse {tru}{fals}e}} %D We need to freeze the pagelayout before the backgrounds %D are build, because the overlay will temporarily become %D zero (overlay). \appendtoks \freezeMPpagelayout \to \everybeforepagebody %D By freezing these value every graphic, we can use layout %D variables that change halfways a page, whatever use that %D has. % obsolete (but keep the code) % % \prependtoks % \calculatereducedvsizes % this is really needed % \freezeMPpagelayout % \freezeMPlayout % to be used grouped % \to \everyMPgraphic \prependtoks \calculatereducedvsizes % this is really needed \to \everyMPgraphic %D The next feature provides information about for instance %D column positions. This is an experimental feature, %D introduced when we needed backgrounds in columns (fill||in %D questions as implemented in a private module). %D %D See \type {mp-page.mp} for the definition of the macros: %D %D \starttabulate[|tl|l|p|] %D \NC ResetTextAreas \NC no arguments \NC %D reset areas on page \NC \NR %D \NC RegisterTextArea \NC x, y, w, h \NC %D adds area to the list \NC \NR %D \NC TextAreaX,Y,W,H,XY,WH \NC x and/or y \NC %D reports offsets and dimensions \NC \NR %D \stoptabulate %D %D The \type {TextArea*} macros can be used to determine %D overlap. \newcount\currentMPtextareadata \newtoks\MPsavedtextareadata \newtoks\MPtextareadata \newtoks\MPlocaltextareadata \newtoks\MPregionareadata % optimaliseren voor herhaling \newif\iftracetextareas \unexpanded\def\globalregisterMPtextarea{\normalexpanded{\global\MPtextareadata{\the\MPtextareadata RegisterTextArea(\MPxywhd\currentMPtextarea);}}} \unexpanded\def\localregisterMPtextarea{\normalexpanded{\global\MPlocaltextareadata{% RegisterLocalTextArea(\MPxywhd\currentMPtextarea);}}} \unexpanded\def\registerMPtextareaindeed#1#2% {\ifpositioning \begingroup \global\advance\currentMPtextareadata\plusone \edef\currentMPtextarea{gbd:\the\currentMPtextareadata}% \hpos\currentMPtextarea{\iftracetextareas\boxrulewidth1.5pt\ruledhbox\fi{#2}}% #1% \endgroup \else \hbox{#2}% \fi} \unexpanded\def\registerMPtextarea {\registerMPtextareaindeed\globalregisterMPtextarea} \unexpanded\def\registerMPlocaltextarea{\registerMPtextareaindeed\localregisterMPtextarea } \unexpanded\def\resetMPlocaltextarea {\global\MPlocaltextareadata\emptytoks} \startMPinitializations ResetTextAreas; \the\MPsavedtextareadata; SaveTextAreas; ResetTextAreas; \the\MPtextareadata; \the\MPlocaltextareadata; RegisterPlainTextArea(\MPxywhd\textanchor); RegisterRegionTextArea(\MPxywhd\regionanchor); \stopMPinitializations \appendtoks \global\MPsavedtextareadata\MPtextareadata \global\MPtextareadata \emptytoks \global\MPlocaltextareadata\emptytoks \to \everyshipout \protect \endinput