Mercurial > hg > xemacs-beta
comparison etc/gnusrefcard/makelogo @ 161:28f395d8dc7a r20-3b7
Import from CVS: tag r20-3b7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:42:26 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
160:1c55655d6702 | 161:28f395d8dc7a |
---|---|
1 #!/bin/csh -f | |
2 # Copies gnuslogo.ps to gnuslogo.tmp and fixes the image | |
3 # by the scale specified in $1.tex | |
4 | |
5 echo Scaling-down gnuslogo.ps to gnuslogo.$1 | |
6 set bb = `grep "^%%BoundingBox:" gnuslogo.ps` | |
7 if ($bb[2] != 0 || $bb[3] != 0) then | |
8 echo Please make gnuslogo.ps have zero-based coordinates | |
9 exit 1 | |
10 endif | |
11 set logowidth = $bb[4] | |
12 set logoheight = $bb[5] | |
13 set logoscale = \ | |
14 `grep "\\def\\logoscale{" $1.tex |sed -e "s/\\def\\logoscale{\([^}]*\)}/\1/"` | |
15 # check if a program is present | |
16 alias executable '(\!* </dev/null >&/dev/null)' | |
17 executable calc 0 | |
18 if ($status != 1) then # calc is demented and returns 2 on success | |
19 # -p is "precision" | |
20 set newwidth = `calc -p1 $logowidth \* $logoscale` | |
21 set newheight = `calc -p1 $logoheight \* $logoscale` | |
22 else if ( { executable dc } ) then | |
23 # the k command of dc doesn't seem to have much of an effect | |
24 set newwidth = `echo 0 k $logowidth $logoscale \* p | dc` | |
25 set newheight = `echo 0 k $logoheight $logoscale \* p | dc` | |
26 else if ( { executable bc } ) then | |
27 # nor does the scale variable of bc. This will lead to fractional numbers | |
28 # in the %%BoundingBox statement of the EPS file. | |
29 # Let's hope your dvips doesn't have a problem with it. | |
30 set newwidth = `echo "scale=0; $logowidth * $logoscale" | bc` | |
31 set newheight = `echo "scale=0; $logoheight * $logoscale" | bc` | |
32 endif | |
33 sed -e"/%%BoundingBox/{s/$logowidth/$newwidth/;s/$logoheight/$newheight/;}"\ | |
34 -e"/scale/{s/$logowidth.0/$newwidth/;s/$logoheight.0/$newheight/;}"\ | |
35 gnuslogo.ps >! gnuslogo.$1 |