summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/pack-fen.mkiv
blob: 7bc8211440c2abf184a4552751375fd6d1d024f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
%D \module
%D   [       file=pack-fen,
%D        version=2011.07.21,
%D          title=\CONTEXT\ Packaging Macros,
%D       subtitle= Fences for Ruled Content,
%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 Packaging Macros / Fences for Ruled Content}

%D \startbuffer
%D \useMPlibrary[meta-imp-hooks.mkiv]
%D
%D \framed[frame=off,bottomframe=righthook]{Bottom right hook}
%D \stopbuffer
%D
%D \typebuffer
%D
%D \startlinecorrection
%D \getbuffer
%D \stoplinecorrection

\unprotect

\def\installleftframerenderer#1#2%
  {\setvalue{\??framedleft\v!on#1}{\whateverleftframe{#2}}%
   \expandafter\let\csname\??framedleft\v!off#1\expandafter\endcsname\csname\??framedleft\v!on#1\endcsname}

\def\installrightframerenderer#1#2%
  {\setvalue{\??framedright\v!on#1}{\whateverrightframe{#2}}%
   \expandafter\let\csname\??framedright\v!off#1\expandafter\endcsname\csname\??framedright\v!on#1\endcsname}

\def\installtopframerenderer#1#2%
  {\setvalue{\??framedtop\v!on#1}{\whatevertopframe{#2}}%
   \expandafter\let\csname\??framedtop\v!off#1\expandafter\endcsname\csname\??framedtop\v!on#1\endcsname}

\def\installbottomframerenderer#1#2%
  {\setvalue{\??framedbottom\v!on#1}{\whateverbottomframe{#2}}%
   \expandafter\let\csname\??framedbottom\v!off#1\expandafter\endcsname\csname\??framedbottom\v!on#1\endcsname}

\ifdefined \pack_framed_overlay_initialize_indeed

    \let\setinstalledframedimensions\pack_framed_overlay_initialize_indeed

\else

    \def\setinstalledframedimensions
      {\d_overlay_width       \frameddimenwd
       \d_overlay_height      \dimexpr\frameddimenht+\frameddimendp\relax
       \d_overlay_depth       \frameddimendp
       \d_overlay_linewidth   \ruledlinewidth
       \edef\overlaycolor    {\framedparameter\c!backgroundcolor}%
       \edef\overlaylinecolor{\framedparameter\c!framecolor}}

\fi

\newbox\b_framed_rendered

\def\whateverleftframe#1%
  {\setinstalledframedimensions
   \setbox\b_framed_rendered\vpack to \d_overlay_height{\vss#1\vss}%
   \setbox\b_framed_rendered\hpack to \zeropoint{\box\b_framed_rendered\hss}%
   \ht\b_framed_rendered\zeropoint
   \dp\b_framed_rendered\zeropoint
   \box\b_framed_rendered}

\def\whateverrightframe#1%
  {\setinstalledframedimensions
   \setbox\b_framed_rendered\vpack to \d_overlay_height{\vss#1\vss}%
   \setbox\b_framed_rendered\hpack to \zeropoint{\hss\box\b_framed_rendered}%
   \ht\b_framed_rendered\zeropoint
   \dp\b_framed_rendered\zeropoint
   \box\b_framed_rendered}

\def\whatevertopframe#1%
  {\setinstalledframedimensions
   \setbox\b_framed_rendered\hpack to \d_overlay_width{\hss#1\hss}%
   \setbox\b_framed_rendered\vpack to \zeropoint{\box\b_framed_rendered\vss}%
   \ht\b_framed_rendered\zeropoint
   \dp\b_framed_rendered\zeropoint
   \box\b_framed_rendered
   \nointerlineskip}

\def\whateverbottomframe#1%
  {\setinstalledframedimensions
   \setbox\b_framed_rendered\hpack to \d_overlay_width{\hss#1\hss}%
   \setbox\b_framed_rendered\vpack to \zeropoint{\vss\box\b_framed_rendered}%
   \ht\b_framed_rendered\zeropoint
   \dp\b_framed_rendered\zeropoint
   \box\b_framed_rendered}

\protect \endinput