summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/page-mrk.mkiv
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-04-22 22:14:39 +0000
committerKarl Berry <karl@freefriends.org>2016-04-22 22:14:39 +0000
commitfc4466b32ed330a956ac603b00fd145524cff49a (patch)
tree2c50e2b8de13aa9233b2c76dffe201558f169e86 /Master/texmf-dist/tex/context/base/mkiv/page-mrk.mkiv
parent50e2368597d5f6fe2057195d0ae6a9f2044923e4 (diff)
context (22apr16)
git-svn-id: svn://tug.org/texlive/trunk@40691 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/page-mrk.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/page-mrk.mkiv206
1 files changed, 206 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/page-mrk.mkiv b/Master/texmf-dist/tex/context/base/mkiv/page-mrk.mkiv
new file mode 100644
index 00000000000..0cd615f8acc
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkiv/page-mrk.mkiv
@@ -0,0 +1,206 @@
+%D \module
+%D [ file=page-mrk,
+%D version=2011.05.23, % moved from page-lay
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Cutmarks and Colorbars,
+%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.
+
+\writestatus{loading}{ConTeXt Page Macros / Cutmarks and Colorbars}
+
+%D This module depends on \METAPOST.
+
+\unprotect
+
+% \def\pagecutmarksymbol {\the\realpageno}
+% \let\pagecutmarktoptext \empty
+% \let\pagecutmarkbottomtext \empty
+
+\def\pagecutmarklength {5mm}
+\def\pagecutmarkoffset {3mm} % slightly larger than before, and now a fixed size
+\def\pagecutmarkmargin{10cm}
+
+\newconditional\c_page_marks_add_more_color
+\newconditional\c_page_marks_add_more_marking
+\newconditional\c_page_marks_add_more_lines
+\newconditional\c_page_marks_add_page_lines
+\newconditional\c_page_marks_add_more_number
+
+\newcount\c_page_marks_nx
+\newcount\c_page_marks_ny
+
+\startuniqueMPgraphic{print:color}{w,h,l,o}
+ if unknown context_crop : input mp-crop.mpiv ; fi ;
+ page_marks_add_color(\MPvar w,\MPvar h,\MPvar l,\MPvar o) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{print:marking}{w,h,l,o}
+ if unknown context_crop : input mp-crop.mpiv ; fi ;
+ page_marks_add_marking(\MPvar w,\MPvar h,\MPvar l,\MPvar o) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{print:lines}{w,h,l,o,x,y}
+ if unknown context_crop : input mp-crop.mpiv ; fi ;
+ page_marks_add_lines(\MPvar w,\MPvar h,\MPvar l,\MPvar o,\MPvar x,\MPvar y) ;
+\stopuniqueMPgraphic
+
+\startuseMPgraphic{print:number}{w,h,l,o,n}
+ if unknown context_crop : input mp-crop.mpiv ; fi ;
+ page_marks_add_number(\MPvar w,\MPvar h,\MPvar l,\MPvar o,\MPvar n) ;
+\stopuseMPgraphic
+
+\def\page_marks_add_color
+ {\setlayoutcomponentattribute{\v!print:\v!color}%
+ \setbox\scratchbox\hpack \layoutcomponentboxattribute\bgroup
+ \uniqueMPgraphic
+ {print:color}%
+ {w=\the\scratchwidth,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_marking
+ {\setlayoutcomponentattribute{\v!print:\v!marking}%
+ \setbox\scratchbox\hpack \layoutcomponentboxattribute\bgroup
+ \uniqueMPgraphic
+ {print:marking}%
+ {w=\the\scratchwidth,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_lines
+ {\setlayoutcomponentattribute{\v!print:\v!lines}%
+ \setbox\scratchbox\hpack \layoutcomponentboxattribute\bgroup
+ \uniqueMPgraphic
+ {print:lines}%
+ {w=\the\scratchwidth,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset,%
+ x=\the\c_page_marks_nx,y=\the\c_page_marks_ny}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_number
+ {\setlayoutcomponentattribute{\v!print:\v!number}%
+ \setbox\scratchbox\hpack \layoutcomponentboxattribute\bgroup
+ \useMPgraphic
+ {print:number}%
+ {w=\the\scratchwidth ,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset,%
+ n=\number\ifcase\arrangeno\realpageno\else\arrangeno\fi}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_page_indeed#1%
+ {\setbox#1\hpack\bgroup
+ \resetvisualizers
+ \let\objectoffset\pagecutmarkmargin
+ %\infofont
+ \scratchwidth \wd#1%
+ \scratchheight\ht#1%
+ \scratchdepth \dp#1%
+ \box#1\relax
+ \ifconditional\c_page_marks_add_page_lines
+ \page_marks_add_lines
+ \fi
+ \egroup}
+
+\def\page_marks_add_more_indeed#1%
+ {\setbox#1\hbox\bgroup
+ \resetvisualizers
+ \let\objectoffset\pagecutmarkmargin
+ \infofont
+ \scratchwidth \wd#1% these can move out
+ \scratchheight\ht#1%
+ \scratchdepth \dp#1%
+ \box#1\relax
+ \ifconditional\c_page_marks_add_more_color
+ \page_marks_add_color
+ \fi
+ \ifconditional\c_page_marks_add_more_marking
+ \page_marks_add_marking
+ \fi
+ \ifconditional\c_page_marks_add_more_lines
+ \page_marks_add_lines
+ \fi
+ \ifconditional\c_page_marks_add_more_number
+ \page_marks_add_number
+ \fi
+ \egroup}
+
+\let\page_marks_add_page\gobbleoneargument
+\let\page_marks_add_more\gobbleoneargument
+
+\installcorenamespace{layoutmarking}
+
+\unexpanded\def\installpagecutmark#1#2%
+ {\setvalue{\??layoutmarking#1}{#2}}
+
+% \installpagecutmark\v!off
+% {}
+
+% \installpagecutmark\v!text
+% {\settrue\c_page_marks_add_more_lines
+% \settrue\c_page_marks_add_more_number
+% \let\pagecutmarksymbol\empty
+% \let\pagecutmarkbottomtext\extrapagecutmarkbottomtext}
+
+\installpagecutmark\v!on
+ {\settrue\c_page_marks_add_page_lines
+ \settrue\c_page_marks_add_more_lines
+ \settrue\c_page_marks_add_more_number}
+
+\installpagecutmark\v!page % todo
+ {\settrue\c_page_marks_add_more_lines
+ \settrue\c_page_marks_add_more_number}
+
+\installpagecutmark\v!empty
+ {\settrue\c_page_marks_add_page_lines
+ \settrue\c_page_marks_add_more_lines}
+
+\installpagecutmark\v!color
+ {\settrue\c_page_marks_add_page_lines
+ \settrue\c_page_marks_add_more_lines
+ \settrue\c_page_marks_add_more_color
+ \settrue\c_page_marks_add_more_marking
+ \settrue\c_page_marks_add_more_number}
+
+\appendtoks
+ \setfalse\c_page_marks_add_page_lines
+ \setfalse\c_page_marks_add_more_color
+ \setfalse\c_page_marks_add_more_marking
+ \setfalse\c_page_marks_add_more_lines
+ \setfalse\c_page_marks_add_more_number
+ \begincsname\??layoutmarking\layoutparameter\c!marking\endcsname
+ \ifconditional\c_page_marks_add_page_lines
+ \let\page_marks_add_page\page_marks_add_page_indeed
+ \else
+ \let\page_marks_add_page\gobbleoneargument
+ \fi
+ % we can get a double set of (overlayed) lines .. needs to be redone (too many objects anyway)
+ \ifconditional\c_page_marks_add_more_lines
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else\ifconditional\c_page_marks_add_more_color
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else\ifconditional\c_page_marks_add_more_marking
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else\ifconditional\c_page_marks_add_more_number
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else
+ \let\page_marks_add_more\gobbleoneargument
+ \fi\fi\fi\fi
+\to \everysetuplayout
+
+\setuplayout
+ [\c!marking=\v!off]
+
+\protect \endinput