File: makesheet

package info (click to toggle)
grunch 1.3-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 204 kB
  • ctags: 25
  • sloc: sh: 830; ansic: 155; perl: 91; makefile: 69
file content (180 lines) | stat: -rwxr-xr-x 2,824 bytes parent folder | download
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
resolution=72
pixwidth=$((resolution*50/10))
linerwidth=$((resolution*4))
liner=0
rm -f ~/.grunch/tmp/$1.ps
if [ -e $1-card.txt ]; then
    title=$(head -1 $1-card.txt)
else
    title=$2
fi
if [ "$title" = "" ] ; then
   echo "No CD title given on command line or in $1-card.txt file" >&2
   exit 1
fi

cat << STOP > ~/.grunch/tmp/$1.ps
%!
gsave
130 400 translate
0 0 moveto
gsave
STOP
tifftopnm $1-a-autojoin.tif | ppmtopgm | \
  pnmscale -xysize $pixwidth  $pixwidth | \
  pnmtops -width 5 -height 5 -dpi 300 -noturn | \
  fgrep -v showpage >> ~/.grunch/tmp/$1.ps
cat << STOP >> ~/.grunch/tmp/$1.ps
grestore

/left 10 def
/bottom 5 def
/right 350 def
/top 345 def

/margin 10 def

[1 4] 0 setdash
0 setlinewidth

left  margin sub bottom moveto
right margin add bottom lineto
stroke

left  margin sub top moveto
right margin add top lineto
stroke

left  bottom margin sub  moveto
left  top    margin add  lineto
stroke

right  bottom margin sub  moveto
right  top    margin add  lineto
stroke

[] 0 setdash
grestore

gsave

%
% Now do the J-card
%

130 34 translate
0 0 moveto
gsave
STOP
if [ -e $1-card.txt ]; then
    texttocard < $1-card.txt >>  ~/.grunch/tmp/$1.ps
else
cardfile=$1-b-autojoin.tif
if [ -e $1-card.tif ] ; then
  cardfile=$1-card.tif
fi
tifftopnm $cardfile | ppmtopgm | \
  pnmscale -xysize $pixwidth  $pixwidth | \
  pnmtops -width 5 -height 5 -dpi 300 -noturn | \
  fgrep -v showpage >> ~/.grunch/tmp/$1.ps
fi
cat << STOP >> ~/.grunch/tmp/$1.ps
grestore

/Palatino-Bold findfont
10 scalefont
setfont

[1 4] 0 setdash
0 setlinewidth

/left -17 def
/bottom 10 def
/right 375 def
/top 345 def

/margin 10 def

/edge 17 def

[1 4] 0 setdash
0 setlinewidth

left  margin sub bottom moveto
right margin add bottom lineto
stroke

left  margin sub top moveto
right margin add top lineto
stroke

left  bottom margin sub  moveto
left  top    margin add  lineto
stroke

right  bottom margin sub  moveto
right  top    margin add  lineto
stroke

left  edge sub bottom margin sub  moveto
left  edge  sub top    margin add  lineto
stroke

right edge add bottom margin sub  moveto
right edge add top    margin add  lineto
stroke

[] 0 setdash

%
% Now label the outer edge of the jewel card
%

/stringheight 10 def
/stringdescend 2 def

/Palatino-Bold findfont
stringheight scalefont
setfont
($title) stringwidth /stringy exch def /stringx exch def

gsave

edge stringheight sub 2 div right add stringdescend add

top bottom add stringx add 2 div

translate

0 0 moveto

-90 rotate

($title) show

grestore

gsave

edge stringheight sub 2 div left edge sub add stringdescend add

top bottom add stringx add 2 div

translate

0 0 moveto

-90 rotate

($title) show

grestore

statusdict begin
% /manualfeed true def
% /manualfeedtimeout 20 def
showpage
STOP
cat ~/.grunch/tmp/$1.ps
rm -f ~/.grunch/tmp/$1.ps