File: makecard

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 (60 lines) | stat: -rwxr-xr-x 1,179 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
#!/bin/bash
resolution=72
pixwidth=$((resolution*50/10))
linerwidth=$((resolution*4))
liner=0
if [ -e $1-card.txt ]; then
    title=$(head -1 $1-card.txt)
else
    title=$2
fi
if [ "$title" = "" ] ; then
    echo Oops - no album title in .txt file or on command line
    exit
fi
rm -f ~/.grunch/tmp/$1.ps
cat << STOP > ~/.grunch/tmp/$1.ps
%!
/Palatino-Bold findfont
10 scalefont
setfont
420 ($title) stringwidth pop 2 div sub 470 moveto
($title) show
90 rotate
92 -600 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
[1 4] 0 setdash
0 setlinewidth
372 0 moveto
372 600 lineto
390 0 moveto
390 600 lineto
-15 0 moveto
-15 600 lineto
-33 0 moveto
-33 600 lineto
stroke
[] 0 setdash
statusdict begin
/manualfeed true def
/manualfeedtimeout 20 def
showpage
STOP
cat ~/.grunch/tmp/$1.ps
rm -f ~/.grunch/tmp/$1.ps