File: texttocard

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 (25 lines) | stat: -rwxr-xr-x 630 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
#!/usr/bin/perl
$lines = 0;
$fontsize = 12;
$linespace = 4;
$totheight = 5 * 72;
while (<>) {
	chop;
	s/\\/\\\\/g;
	s/\(/\\(/g;
	s/\)/\\)/g;
	$text[$lines] = $_;
	$lines++;
}
printf "%% Got $lines lines\n";
$textheight = ($lines * $fontsize) + (($lines - 1) * $linespace);
printf "%% Text height is $textheight points\n";
$spareheight = $totheight - $textheight;
$elevation = $totheight - ($spareheight / 2) - $fontsize;
$leftpoint = 36;
printf "(Courier) findfont $fontsize scalefont setfont\n";
foreach $line (@text) {
	printf "$leftpoint $elevation moveto\n";
	printf "($line) show\n";
	$elevation -= $fontsize + $linespace;
}