meta-imp-fen.mkiv /size: 6121 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=meta-imp-fen,
3
%D version=2011.07.21,
4
%D title=\METAPOST\ Graphics,
5
%D subtitle=Fences,
6
%D author=Wolfgang Schuster & 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
%D The shape and background example code was posted by Wolfgang on the
15
%D \CONTEXT\ list and due to request by Aditya has been turned into
16
%D library.
17 18
\startMPextensions
19
vardef
BasicBraceSymbol
(
expr
rotation
)
=
20
save
p
;
path
p
;
21
z
1
=
(
-233
,
0
)
;
22
z
2
=
(
-220
,
22
)
;
23
z
3
=
(
-155
,
211
)
;
24
z
4
=
(
-200
,
690
)
;
25
z
5
=
(
-142
,
1033
)
;
26
z
6
=
(
-97
,
1106
)
;
27
z
7
=
(
-71
,
1125
)
;
28
z
8
=
(
-61
,
1104
)
;
29
z
9
=
(
-80
,
1077
)
;
30
z
10
=
(
-108
,
1002
)
;
31
z
11
=
(
-129
,
666
)
;
32
z
12
=
(
-117
,
207
)
;
33
z
13
=
(
-197
,
19
)
;
34
z
14
=
(
-208
,
0
)
;
35
z
15
=
(
-197
,
-19
)
;
36
z
16
=
(
-117
,
-207
)
;
37
z
17
=
(
-129
,
-666
)
;
38
z
18
=
(
-108
,
-1026
)
;
39
z
19
=
(
-80
,
-1077
)
;
40
z
20
=
(
-61
,
-1104
)
;
41
z
21
=
(
-71
,
-1125
)
;
42
z
22
=
(
-97
,
-1106
)
;
43
z
23
=
(
-143
,
-1031
)
;
44
z
24
=
(
-199
,
-673
)
;
45
z
25
=
(
-155
,
-211
)
;
46
z
26
=
(
-220
,
-22
)
;
47
p
:
=
z
1
for
i
=
2
upto
14
:
..
z
[
i
]
endfor
48
&
z
14
for
j
=
15
upto
26
:
..
z
[
j
]
endfor
49
..
z
1
50
&
cycle
;
51
p
:
=
p
rotated
rotation
;
52
p
:
=
p
ysized
100
;
53
p
shifted
-
center
p
54
enddef
;
55
vardef
RawLeftBraceSymbol
=
56
fill
BasicBraceSymbol
(
0
)
ysized
OverlayHeight
withcolor
OverlayColor
;
57
enddef
;
58
vardef
RawRightBraceSymbol
=
59
fill
BasicBraceSymbol
(
180
)
ysized
OverlayHeight
withcolor
OverlayColor
;
60
enddef
;
61
vardef
RawTopBraceSymbol
=
62
fill
BasicBraceSymbol
(
270
)
xsized
OverlayWidth
withcolor
OverlayColor
;
63
enddef
;
64
vardef
RawBottomBraceSymbol
=
65
fill
BasicBraceSymbol
(
90
)
xsized
OverlayWidth
withcolor
OverlayColor
;
66
enddef
;
67
vardef
LeftBraceSymbol
=
68
save
p
,
b
;
path
p
,
b
;
b
:
=
fullsquare
xscaled
OverlayWidth
yscaled
OverlayHeight
;
69
setbounds
currentpicture
to
b
;
70
p
:
=
BasicBraceSymbol
(
0
)
ysized
OverlayHeight
;
71
fill
p
shifted
(
-
xpart
lrcorner
currentpicture
+
xpart
lrcorner
p
,
0
)
withcolor
OverlayColor
;
72
setbounds
currentpicture
to
b
;
73
enddef
;
74
vardef
RightBraceSymbol
=
75
save
p
,
b
;
path
p
,
b
;
b
:
=
fullsquare
xscaled
OverlayWidth
yscaled
OverlayHeight
;
76
setbounds
currentpicture
to
b
;
77
p
:
=
BasicBraceSymbol
(
180
)
ysized
OverlayHeight
;
78
fill
p
shifted
(
xpart
lrcorner
currentpicture
-
xpart
lrcorner
p
,
0
)
withcolor
OverlayColor
;
79
setbounds
currentpicture
to
b
;
80
enddef
;
81
vardef
TopBraceSymbol
=
82
save
p
,
b
;
path
p
,
b
;
b
:
=
fullsquare
xscaled
OverlayWidth
yscaled
OverlayHeight
;
83
setbounds
currentpicture
to
b
;
84
p
:
=
BasicBraceSymbol
(
270
)
xsized
OverlayWidth
;
85
fill
p
shifted
(
0
,
ypart
ulcorner
currentpicture
-
ypart
ulcorner
p
)
withcolor
OverlayColor
;
86
setbounds
currentpicture
to
b
;
87
enddef
;
88
vardef
BottomBraceSymbol
=
89
save
p
,
b
;
path
p
,
b
;
b
:
=
fullsquare
xscaled
OverlayWidth
yscaled
OverlayHeight
;
90
setbounds
currentpicture
to
b
;
91
p
:
=
BasicBraceSymbol
(
90
)
xsized
OverlayWidth
;
92
fill
p
shifted
(
0
,
ypart
lrcorner
currentpicture
-
ypart
lrcorner
p
)
withcolor
OverlayColor
;
93
setbounds
currentpicture
to
b
;
94
enddef
;
95
\stopMPextensions
96 97
\startuniqueMPgraphic
{
raw_brace_left
}
RawLeftBraceSymbol
;
\stopuniqueMPgraphic
98
\startuniqueMPgraphic
{
raw_brace_right
}
RawRightBraceSymbol
;
\stopuniqueMPgraphic
99
\startuniqueMPgraphic
{
raw_brace_top
}
RawTopBraceSymbol
;
\stopuniqueMPgraphic
100
\startuniqueMPgraphic
{
raw_brace_bottom
}
RawBottomBraceSymbol
;
\stopuniqueMPgraphic
101 102
\startuniqueMPgraphic
{
brace_left
}
LeftBraceSymbol
;
\stopuniqueMPgraphic
103
\startuniqueMPgraphic
{
brace_right
}
RightBraceSymbol
;
\stopuniqueMPgraphic
104
\startuniqueMPgraphic
{
brace_top
}
TopBraceSymbol
;
\stopuniqueMPgraphic
105
\startuniqueMPgraphic
{
brace_bottom
}
BottomBraceSymbol
;
\stopuniqueMPgraphic
106 107
\defineoverlay
[
leftbrace
]
[
\uniqueMPgraphic
{
brace_left
}
]
108
\defineoverlay
[
rightbrace
]
[
\uniqueMPgraphic
{
brace_right
}
]
109
\defineoverlay
[
topbrace
]
[
\uniqueMPgraphic
{
brace_top
}
]
110
\defineoverlay
[
bottombrace
][
\uniqueMPgraphic
{
brace_bottom
}
]
111 112
\installleftframerenderer
{
brace
}{
\uniqueMPgraphic
{
raw_brace_left
}
}
113
\installrightframerenderer
{
brace
}{
\uniqueMPgraphic
{
raw_brace_right
}
}
114
\installtopframerenderer
{
brace
}{
\uniqueMPgraphic
{
raw_brace_top
}
}
115
\installbottomframerenderer
{
brace
}{
\uniqueMPgraphic
{
raw_brace_bottom
}
}
116 117
\continueifinputfile
{
meta
-
imp
-
fen
.
mkiv
}
118 119
\starttext
120 121
\startTEXpage
[
offset
=
1
0
pt
]
122 123
\framed
124
[
offset
=
1
ex
,
125
leftframe
=
brace
,
126
rightframe
=
brace
,
127
topframe
=
brace
,
128
bottomframe
=
brace
,
129
background
=
color
,
130
backgroundcolor
=
red
]
131
{
OEPS
}
132 133
\stopTEXpage
134 135
\startTEXpage
\uniqueMPgraphic
{
brace_left
}
\stopTEXpage
136
\startTEXpage
\uniqueMPgraphic
{
brace_right
}
\stopTEXpage
137
\startTEXpage
\uniqueMPgraphic
{
brace_top
}
\stopTEXpage
138
\startTEXpage
\uniqueMPgraphic
{
brace_bottom
}
\stopTEXpage
139 140
\framedtext
141
[
frame
=
off
,
142
offset
=
2
em
,
143
background
=
{
leftbrace
,
rightbrace
,
topbrace
,
bottombrace
}
,
144
backgroundcolor
=
red
]
{
\input
{
knuth
}}
145 146
\setupTABLE
[
frame
=
off
,
offset
=
1
ex
]
147
\setupTABLE
[
row
][
each
][
align
=
{
middle
,
lohi
}
]
148 149
\bTABLE
150
\bTR
151
\bTD
[
nr
=
3
,
background
=
leftbrace
]
drei
\eTD
152
\bTD
[
nr
=
2
,
background
=
leftbrace
]
zwei
\eTD
153
\bTD
f
\eTD
154
\bTD
o
\eTD
155
\bTD
u
\eTD
156
\bTD
r
\eTD
157
\bTD
[
nr
=
3
,
background
=
rightbrace
]
three
\eTD
158
\eTR
159
\bTR
160
\bTD
[
background
=
leftbrace
]
eins
\eTD
161
\bTD
[
background
=
{
topbrace
,
bottombrace
}
]
null
\eTD
162
\bTD
[
background
=
rightbrace
]
one
\eTD
163
\bTD
[
nr
=
2
,
background
=
rightbrace
]
two
\eTD
164
\eTR
165
\bTR
166
\bTD
v
\eTD
167
\bTD
i
\eTD
168
\bTD
e
\eTD
169
\bTD
r
\eTD
170
\eTR
171
\eTABLE
172 173
\stoptext
174