summaryrefslogtreecommitdiff
path: root/tex/context/base/meta-fig.tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2001-03-27 00:00:00 +0200
committerHans Hagen <pragma@wxs.nl>2001-03-27 00:00:00 +0200
commit2a2e86e6c2022e3925e0ee62f5c7b66bbec03338 (patch)
treee02a419ec09c32da024db4855f46de2b1fa85ead /tex/context/base/meta-fig.tex
parente78478392e9717499b101d0fed642c945c104097 (diff)
downloadcontext-2a2e86e6c2022e3925e0ee62f5c7b66bbec03338.tar.gz
stable 2001.03.27
Diffstat (limited to 'tex/context/base/meta-fig.tex')
-rw-r--r--tex/context/base/meta-fig.tex172
1 files changed, 134 insertions, 38 deletions
diff --git a/tex/context/base/meta-fig.tex b/tex/context/base/meta-fig.tex
index c282f36c7..8cb9c6365 100644
--- a/tex/context/base/meta-fig.tex
+++ b/tex/context/base/meta-fig.tex
@@ -1,85 +1,181 @@
%D \module
%D [ file=meta-fig,
%D version=2000.09.07,
-%D title=\METAPOST\ Graphics,
-%D subtitle=Stand Alone Graphics,
+%D title=\METAPOST\ Graphics,
+%D subtitle=Stand Alone Graphics,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
\writestatus{loading}{MetaPost Graphics / Stand Alone Graphics}
-\unprotect
+\unprotect
%D This module implements a method for defining
%D stand||alone||graphics, that is, each graphic gets is own
%D page. Because graphics are wrapped in a \type {\framed},
%D you can add overlays to the graphic directly, and since the
%D whole \CONTEXT\ machinery is available, you can also add
-%D page backgrounds.
-%D
+%D page backgrounds.
+%D
%D \starttypen
%D \setupMPpage
%D [offset=1pt,
%D background=color,
%D backgroundcolor=green]
-%D
+%D
%D \startMPpage
-%D fill fullcircle scaled 10cm withcolor red ;
+%D fill fullcircle scaled 10cm withcolor red ;
%D \stopMPpage
-%D
+%D
%D \startMPpage
-%D fill fullsquare rotated 45 scaled 8cm withcolor blue ;
+%D fill fullsquare rotated 45 scaled 8cm withcolor blue ;
%D \stopMPpage
%D \stoptypen
-%D
-%D Although this is hardly of any use, you can mix these
+%D
+%D Although this is hardly of any use, you can mix these
%D definitions with the text flow, since all settings are
-%D kept local. The page is clipped to the image size.
+%D kept local. The page is clipped to the image size.
-\presetlocalframed[\??mp]
+% \presetlocalframed[\??mp]
+%
+% \def\setupMPpage%
+% {\dodoubleargument\getparameters[\??mp]}
+%
+% \def\startMPpage%
+% {\dosingleempty\dostartMPpage}
+%
+% \long\def\dostartMPpage[#1]#2\stopMPpage
+% {\pagina
+% \bgroup
+% \setbox\scratchbox=\hbox
+% {\localframed[\??mp][#1]{\startMPcode#2\stopMPcode}}
+% \edef\MPwd{\the\wd\scratchbox}
+% \edef\MPht{\the\ht\scratchbox}
+% \definieerpapierformaat
+% [\s!dummy]
+% [\c!breedte=\MPwd,
+% \c!hoogte=\MPht]
+% \startlocal % keep settings as local as can be
+% \stelpapierformaatin
+% [\s!dummy][\s!dummy]
+% \stellayoutin
+% [\c!breedte=\MPwd,\c!hoogte=\MPht,
+% \c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint,
+% \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint,
+% \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
+% \stoplocal % which saves us the trouble of push/pop
+% \getvalue{\e!start\v!standaard\e!opmaak}%
+% \centerbox{\box\scratchbox}%
+% \getvalue{\e!stop\v!standaard\e!opmaak}%
+% \egroup}
+%
+% \setupMPpage
+% [\c!strut=\v!nee,
+% \c!uitlijnen=,
+% \c!offset=\v!overlay,
+% \c!breedte=\v!passend,
+% \c!hoogte=\v!passend,
+% \c!kader=\v!uit]
-\def\setupMPpage%
- {\dodoubleargument\getparameters[\??mp]}
-
-\def\startMPpage%
- {\dosingleempty\dostartMPpage}
+% generalized, so this belongs in another module
-\long\def\dostartMPpage[#1]#2\stopMPpage
- {\page
+\def\dostartfittingpage[#1][#2]%
+ {\pagina
\bgroup
\setbox\scratchbox=\hbox
- {\localframed[\??mp][#1]{\startMPcode#2\stopMPcode}}
- \edef\MPwd{\the\wd\scratchbox}
- \edef\MPht{\the\ht\scratchbox}
- \definepapersize
+ \bgroup
+ \getparameters[#1][#2]%
+ \schaal[\c!schaal=\getvalue{#1\c!schaal}]\bgroup\localframed[#1]\bgroup}
+
+\def\dostopfittingpage%
+ {\egroup\egroup\egroup
+ \edef\fittingwd{\the\wd\scratchbox}
+ \edef\fittinght{\the\ht\scratchbox}
+ \definieerpapierformaat
[\s!dummy]
- [\c!breedte=\MPwd,
- \c!hoogte=\MPht]
- \startlocal % keep settings as local as can be
- \setuppapersize
+ [\c!breedte=\fittingwd,
+ \c!hoogte=\fittinght]
+ \startlocal % keep settings as local as can be
+ \stelpapierformaatin
[\s!dummy][\s!dummy]
- \setuplayout
- [\c!breedte=\MPwd,\c!hoogte=\MPht,
+ \stellayoutin
+ [\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden,
\c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint,
\c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint,
\c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
\stoplocal % which saves us the trouble of push/pop
- \startstandardmakeup
- \centerbox{\box\scratchbox}
- \stopstandardmakeup
- \egroup}
+ \getvalue{\e!start\v!standaard\e!opmaak}%
+ \centerbox{\box\scratchbox}%
+ \getvalue{\e!stop\v!standaard\e!opmaak}%
+ \egroup}
+
+% MP pages
+
+\presetlocalframed[\??mg]
+
+\def\setupMPpage%
+ {\dodoubleargument\getparameters[\??mg]}
+
+\def\startMPpage%
+ {\dosingleempty\dostartMPpage}
+
+\long\def\dostartMPpage[#1]#2\stopMPpage
+ {\dostartfittingpage[\??mg][#1]%
+ \startMPcode#2\stopMPcode%
+ \dostopfittingpage}
\setupMPpage
- [\c!strut=\v!nee,
+ [\c!schaal=1000,
+ \c!strut=\v!nee,
\c!uitlijnen=,
\c!offset=\v!overlay,
\c!breedte=\v!passend,
\c!hoogte=\v!passend,
\c!kader=\v!uit]
-\protect \endinput
+% tex pages
+
+\presetlocalframed[\??tg]
+
+\def\setupTEXpage%
+ {\dodoubleargument\getparameters[\??tg]}
+
+\def\startTEXpage%
+ {\dodoubleempty\dostartfittingpage[\??tg]}
+
+\def\stopTEXpage%
+ {\dostopfittingpage}
+
+\setupTEXpage
+ [\c!schaal=1000,
+ \c!strut=\v!nee,
+ \c!uitlijnen=\v!normaal, % needed, else problems !
+ \c!offset=\v!overlay,
+ \c!breedte=\v!passend,
+ \c!hoogte=\v!passend,
+ \c!kader=\v!uit]
+
+%D \macros
+%D {MPfigure}
+%D
+%D A bit out of place, here but nevertheless:
+
+\def\MPfigure#1#2% test for dup figure
+ {\bgroup
+ \getfiguredimensions[#1][\c!object=\v!nee]%
+ \freezedimenmacro\naturalfigurewidth
+ \freezedimenmacro\naturalfigureheight
+ \startMPcode
+ externalfigure "#1"
+ xscaled \naturalfigurewidth\space
+ yscaled \naturalfigureheight\space
+ #2 ;
+ \stopMPcode
+ \egroup}
+
+\protect \endinput