-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtc-dvips.def
160 lines (160 loc) · 5.46 KB
/
tc-dvips.def
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
% \begin{macrocode}
%<!COPYRIGHT>
\ProvidesFile{tc-dvips.def}[2019/01/04 v2.2 Clipping driver for dvips]
% \end{macrocode}
%
% \begin{macro}{\@cliptoboxdim}[1]{box register to clip}
% Clips to official box dimension.
%
% The following clipping code was suggested by
% Joseph Wright (LaTeX3 project), but slightly modified
% for this package.
% \begin{macrocode}
\def\@cliptoboxdim#1{%
\setbox#1=\hbox{%
\adjcalc@settobp\WIDTH{\wd#1}%
\adjcalc@settobp\DEPTH{\dp#1}%
\adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
\special{%
ps:
/mtrxc matrix currentmatrix def
currentpoint gsave
translate
Resolution 72 div VResolution 72 div
scale
newpath
0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
newpath
mtrxc setmatrix
}%
\hbox to 0pt{\copy#1\hss}%
\special{ps: grestore }%
\hskip\wd#1%
}%
}
%
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@clipcornersofbox}[5]{<box register}{<upper left>}{<upper right>}{<lower left>}{<lower right>}
% Clips round corners off.
% \begin{macrocode}
\def\@clipcornersofbox#1#2#3#4#5{%
\setbox#1=\hbox{%
\adjcalc@settobp\DEPTHmRADIUSBL\@tempdima
\adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
\adjcalc@settobp\HEIGHT{-\ht#1}%
\adjcalc@settobp\DEPTH{\dp#1}%
\adjcalc@settobp\WIDTH{\wd#1}%
\adjcalc@settobp\RADIUSTL{#2}%
\adjcalc@settobp\RADIUSTR{#3}%
\adjcalc@settobp\RADIUSBL{#4}%
\adjcalc@settobp\RADIUSBR{#5}%
\adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
\adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
\adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}%
\adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#5}%
\adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#5}%
\adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#4}%
\special{%
ps:
/mtrxc matrix currentmatrix def
currentpoint gsave
translate
Resolution 72 div VResolution 72 div
scale
newpath
%0 \DEPTH neg translate
%0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
0 \RADIUSTLmHEIGHT\space moveto
\RADIUSTL\space \RADIUSTLmHEIGHT\space \RADIUSTL\space 180 -90 arc
\WIDTHmRADIUSTR\space \HEIGHT\space lineto
\WIDTHmRADIUSTR\space \RADIUSTRmHEIGHT\space \RADIUSTR\space -90 0 arc
\WIDTH\space \DEPTHmRADIUSBR\space lineto
\WIDTHmRADIUSBR\space \DEPTHmRADIUSBR\space \RADIUSBR\space 0 90 arc
\RADIUSBL\space \DEPTH\space lineto
\RADIUSBL\space \DEPTHmRADIUSBL\space \RADIUSBL\space -270 -180 arc
closepath
%gsave 0.5 0 0 setrgbcolor stroke grestore
clip
newpath
mtrxc setmatrix
}%
\hbox to 0pt{\copy#1\hss}%
\special{ps: grestore }%
\hskip \wd#1%
}%
}
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\@rndframearoundbox}[6]{<box register}{<upper left>}{<upper right>}{<lower left>}{<lower right>}{<clip>}
% Clips round corners off.
% \begin{macrocode}
\def\@rndframearoundbox#1#2#3#4#5#6{%
\setbox#1=\hbox{%
\adjsetlength\@tempdima{\fboxsep+.5\fboxrule}%
\@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
\adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
\adjcalc@settobp\HEIGHT{-\ht#1}%
\adjcalc@settobp\DEPTH{\dp#1}%
\adjcalc@settobp\WIDTH{\wd#1}%
\adjcalc@settobp\RADIUSTL{#2}%
\adjcalc@settobp\RADIUSTR{#3}%
\adjcalc@settobp\RADIUSBR{#5}%
\adjcalc@settobp\RADIUSBL{#4}%
\adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
\adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
\adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}%
\adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#5}%
\adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#5}%
\adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#4}%
\adjcalc@settobp\LINEWIDTH{\fboxrule}%
\edef\@tempa{#6}%
\ifx\@empty\@tempa\else
\@clipcornersofbox{#1}{#2}{#3}{#4}{#5}%
\fi
%
\hbox to 0pt{\copy#1\hss}%
\hbox to 0pt{%
\color@setgroup
\adjbox@rndframe@color
\special{%
ps:
/mtrxc matrix currentmatrix def
currentpoint gsave
translate
Resolution 72 div VResolution 72 div
scale
newpath
%0 \DEPTH neg translate
%0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
0 \RADIUSTLmHEIGHT moveto
\RADIUSTL \RADIUSTLmHEIGHT \RADIUSTL 180 -90 arc
\WIDTHmRADIUSTR \HEIGHT lineto
\WIDTHmRADIUSTR \RADIUSTRmHEIGHT \RADIUSTR -90 0 arc
\WIDTH \DEPTHmRADIUSBR lineto
\WIDTHmRADIUSBR \DEPTHmRADIUSBR \RADIUSBR 0 90 arc
\RADIUSBL \DEPTH lineto
\RADIUSBL \DEPTHmRADIUSBL \RADIUSBL -270 -180 arc
closepath
\LINEWIDTH setlinewidth
stroke
newpath
mtrxc setmatrix
grestore
}%
\color@endgroup
}%
\hskip \wd#1%
}%
\adjsetlength\@tempdima{.5\fboxrule}%
\@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
}
% \end{macrocode}
% \end{macro}
%
%^^A vim: ft=tex