pack-fen.mkiv /size: 3345 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=pack-fen,
3%D        version=2011.07.21,
4%D          title=\CONTEXT\ Packaging Macros,
5%D       subtitle= Fences for Ruled Content,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt Packaging Macros / Fences for Ruled Content}
15
16%D \startbuffer
17%D \useMPlibrary[meta-imp-hooks.mkiv]
18%D
19%D \framed[frame=off,bottomframe=righthook]{Bottom right hook}
20%D \stopbuffer
21%D
22%D \typebuffer
23%D
24%D \startlinecorrection
25%D \getbuffer
26%D \stoplinecorrection
27
28\unprotect
29
30\def\installleftframerenderer#1#2%
31  {\setvalue{\??framedleft\v!on#1}{\whateverleftframe{#2}}%
32   \expandafter\let\csname\??framedleft\v!off#1\expandafter\endcsname\csname\??framedleft\v!on#1\endcsname}
33
34\def\installrightframerenderer#1#2%
35  {\setvalue{\??framedright\v!on#1}{\whateverrightframe{#2}}%
36   \expandafter\let\csname\??framedright\v!off#1\expandafter\endcsname\csname\??framedright\v!on#1\endcsname}
37
38\def\installtopframerenderer#1#2%
39  {\setvalue{\??framedtop\v!on#1}{\whatevertopframe{#2}}%
40   \expandafter\let\csname\??framedtop\v!off#1\expandafter\endcsname\csname\??framedtop\v!on#1\endcsname}
41
42\def\installbottomframerenderer#1#2%
43  {\setvalue{\??framedbottom\v!on#1}{\whateverbottomframe{#2}}%
44   \expandafter\let\csname\??framedbottom\v!off#1\expandafter\endcsname\csname\??framedbottom\v!on#1\endcsname}
45
46\ifdefined \pack_framed_overlay_initialize_indeed
47
48    \let\setinstalledframedimensions\pack_framed_overlay_initialize_indeed
49
50\else
51
52    \def\setinstalledframedimensions
53      {\d_overlay_width       \frameddimenwd
54       \d_overlay_height      \dimexpr\frameddimenht+\frameddimendp\relax
55       \d_overlay_depth       \frameddimendp
56       \d_overlay_linewidth   \ruledlinewidth
57       \edef\overlaycolor    {\framedparameter\c!backgroundcolor}%
58       \edef\overlaylinecolor{\framedparameter\c!framecolor}}
59
60\fi
61
62\newbox\b_framed_rendered
63
64\def\whateverleftframe#1%
65  {\setinstalledframedimensions
66   \setbox\b_framed_rendered\vpack to \d_overlay_height{\vss#1\vss}%
67   \setbox\b_framed_rendered\hpack to \zeropoint{\box\b_framed_rendered\hss}%
68   \ht\b_framed_rendered\zeropoint
69   \dp\b_framed_rendered\zeropoint
70   \box\b_framed_rendered}
71
72\def\whateverrightframe#1%
73  {\setinstalledframedimensions
74   \setbox\b_framed_rendered\vpack to \d_overlay_height{\vss#1\vss}%
75   \setbox\b_framed_rendered\hpack to \zeropoint{\hss\box\b_framed_rendered}%
76   \ht\b_framed_rendered\zeropoint
77   \dp\b_framed_rendered\zeropoint
78   \box\b_framed_rendered}
79
80\def\whatevertopframe#1%
81  {\setinstalledframedimensions
82   \setbox\b_framed_rendered\hpack to \d_overlay_width{\hss#1\hss}%
83   \setbox\b_framed_rendered\vpack to \zeropoint{\box\b_framed_rendered\vss}%
84   \ht\b_framed_rendered\zeropoint
85   \dp\b_framed_rendered\zeropoint
86   \box\b_framed_rendered
87   \nointerlineskip}
88
89\def\whateverbottomframe#1%
90  {\setinstalledframedimensions
91   \setbox\b_framed_rendered\hpack to \d_overlay_width{\hss#1\hss}%
92   \setbox\b_framed_rendered\vpack to \zeropoint{\vss\box\b_framed_rendered}%
93   \ht\b_framed_rendered\zeropoint
94   \dp\b_framed_rendered\zeropoint
95   \box\b_framed_rendered}
96
97\protect \endinput
98