[Thread Prev][Thread Next][Index]

Re: [ferret_users] thicken lines in postscript output



Ferreters,

On the same topic, see below for a tiny C-shell (csh) script that will thicken all Ferret PostScript lines by any integer factor. You'd put it somewhere in your path, and make it executable with "chmod +x ps_thicken". Run "ps_thicken" without arguments for a usage message.

Andrew


#!/bin/csh -f
# Usage: ps_thicken ps_file factor

# get list of all arguments
set args = ($*)

# if not enough arguments, complain.
if ($#args < 2) then
echo "Usage: ps_thicken ps_file factor"
echo "Thickens all lines in a PostScript file by changing the linewidth macro."
echo "Result goes to standard output."
echo "Example: ps_thicken myfile.ps 3 > myfile_thick.ps"
exit 1
endif

sed -e "s/^\/lw {\(.*\) div setlinewidth/\/lw {$2 mul \1 div setlinewidth/" $1




On Fri, 15 Dec 2006, William S. Kessler wrote:

Hi Ferreters -

Another answer, not question.

Many will have noticed that the plot lines produced by Ferret look great in
gif files, but are often too thin in postscript or pdf. Also, the
distinctions between line thicknesses 1,2,3 are not pronounced in postscript.
It is often desirable to thicken the lines. Here are two methods to
automatically edit the postscript output of Fprint to do that, by editing the
"line weight" (lw) lines in the postscript file. Either method accomplishes
exactly the same thing.

Billy K
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
Method 1 (unix sed):

Make a file "double_line_wt", consisting of the following text (between the
dashed lines):
----------------
# script to increase line weights of Ferret output
sed 's_3.000000 lw_6.000000 lw_g' < $1.ps >! foo; \mv foo $1.ps
sed 's_2.000000 lw_4.000000 lw_g' < $1.ps >! foo; \mv foo $1.ps
sed 's_1.000000 lw_2.000000 lw_g' < $1.ps >! foo; \mv foo $1.ps
----------------
Make it executable: chmod a+x double_line_wt

To double the thickness of all lines, call it from the command line with the
filename made by Fprint (omit the .ps):

double_line_wt filename
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
Method 2 (vi):

Make a file "vi_double_line_wt", consisting of the following text (between
the dashed lines):
----------------
:%s_3.000000 lw_6.000000 lw_g
:%s_2.000000 lw_4.000000 lw_g
:%s_1.000000 lw_2.000000 lw_g
:wq
----------------

Use vi to thicken the lines. From the command line:

vi filename.ps -s {vi_double_line_wt}

This will quickly open the file in vi, perform the editing, and close it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
Extensions to stronger line-thickening are obvious.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
William S. Kessler
NOAA / Pacific Marine Environmental Laboratory
7600 Sand Point Way NE
Seattle WA 98115 USA

william.s.kessler@noaa.gov
Tel: 206-526-6221
Fax: 206-526-6744
Home page: http://www.pmel.noaa.gov/people/kessler/



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement