
	Here are my diffs to psview, which add scrollbars, enlargement and
reduction, and a "size box". There are a few other minor differences, none of
which should cause problems.
	This shar file also contains the necessary files to use psview for
previewing the output of Arbortext's DVILASER/PS driver.

WARNING:
	NO WARRANTY OF ANY KIND IS PROVIDED WITH THIS SOFTWARE. USE AT YOUR OWN
RISK. NO LIABILITY FOR LOSS OF DATA OR DAMAGE IS ACCEPTED BY THE AUTHOR.

N.B.
	This was also my first attempt at using LiteItems and overlay canvases,
perhaps some experienced NeWS programmer would care to look over this code and
tell me what (if anything) is wrong with it.
	You may do whatever you want to with this stuff, but I would like some
acknowledgement if you use them in a product. (Please?)

-------------------------------------------------------------------------------

Installation:
	To make the new psview, do
	
	cd /usr/NeWS/clientsrc/client
	patch psview.c <psview.c.diff
	patch psview.cps <psview.cps.diff

	and then "make" it. psview should be installed in /usr/NeWS/bin. For
DVILASER previewing, psmung should be compiled by

	cc -O -o psmung psmung.c

	then psmung and dviview should be installed in /usr/NeWS/bin, and
dvips.opt and dvips.pro should be installed in /usr/NeWS/lib. Your local
dvips.fnt should also be copied or linked into /usr/NeWS/lib.

-------------------------------------------------------------------------------

PS previewing:
	The files psview.c.diff and psview.cps.diff contain diffs for the new
version of psview. The differences from the original version are --

o	Scrollbars are placed by the viewing area. At normal or reduced sizes,
	These scrollbars have no effect, but at enlarged sizes they allow
	panning around the page.

o	Enlarge, Reduce, and Normal Size entries are available on the client
	menu, and the e, r, and n keys can be used as accelerators. Enlargement
	and reduction is by a factor of 1.41 (approx. sqrt(2)). Normal Size
	rescales the page to fit in the current window size.

o	A "Box mode" cycler is in the bottom right corner. This can be cycled
	between off, in, pt, and cm. When box mode is on, the left mouse button
	can be used to point and size a box around part of the view, and the
	dimensions and offset of the box (from the lower left corner of the
	page) will be displayed continuously underneath the view window. The
	dimensions of the box are displayed in inches, PostScript points
	(1/72in), or centimetres. The middle button can be used to move the
	box without altering its' size. The box is only shown on the page on
	which it was drawn, i.e. if you move to another page while the box is
	visible it will disappear, and re-appear if you move back to its' page.
	I find this useful for getting offsets and sizes of PostScript pictures
	for inclusion in TeX documents.

o	European paper sizes can be specified by "-A#" on the command line,
	where # is in the range 0 to 5. The paper is normally in portrait
	orientation, but landscape can be selected by appending "L" to the
	option.

o	%%Page is accepted as a page separator, instead of %%Page:, but
	%%Pages is rejected. This change was done because the version of
	DVILASER/PS we are using produces %%Page as a page separator. This
	change was done before I wrote "psmung", which should probably alter
	%%Page to %%Page:. Also, it will wrongly accept %%PagePrologue as a
	separator at the moment.

o	A test is made to see if a DVILASER output file is being viewed. These
	files require the prologue download after the page has been resized.
	Unfortunately, some other files require the prologue download before
	page sizing, so both possibilities must be available.

o	psview now accepts input on the stdin stream. This was coded in
	the original source code, but had been disabled for some inexplicable
	reason.

o	The message "Please Wait" is now displayed while loading the prologue.
	The munged DVILASER prologue is quite slow to load, because it
	includes all of the font definitions used in the file.

o	The complete list of possible options to psview is given here:
	Option		Function				Example
	-#,#-#,#	page offset and size (in)		-1,1-8,11
	-b#,#,#		background colour (hsb)			-b0,.99,.9
	-bh#s#b#						-bh0s0.9b0.87
	-br#g#b#	background colour (rgb)			-br0g0.9b0.87
	-B		turn off page outline			-B
	-c		default background colour		-c
	-f#,#,#		foreground colour (hsb)			-f0,.99,.9
	-fh#s#b#						-fh0s0.9b0.87
	-fr#g#b#	foreground colour (rgb)			-fr0g0.9b0.87
	-l		landscape slide size 7x11		-l
	-s		slide height 6.8			-s
	-S		slide height 5.7			-S
	-v		verbose					-v
	-a#		European page sizes a0-a5		-a4
	-a#l		European page sizes a0-a5, landscape	-a3l

-------------------------------------------------------------------------------

DVI previewing:
	The other files (psmung.c, dviview, dvips.opt, dvips.fnt, and
dvips.pro) are used to preview PostScript output from Arbortext's DVILASER/PS
driver. This previewing option is slow to start up, but fast enough when it's
going. The big advantage is that PostScript pictures or overlays included in
the TeX document can be previewed.
	To preview, DVILASER/PS must be run with special option, prologue, and
font files, and the output must be run through the "psmung" filter before
viewing. The shell script "dviview" will execute this process. Some points to
note --

o	Check your version of DVILASER/PS. I have been told that the latest
	version produces conforming PostScript, and so the psmung filter will
	be unnecessary with this version. psmung takes the font and character
	definitions and puts them at the end of the prologue. See the comments
	in psmung for the format of the sections which are moved.

o	You should alter the dvips.opt file to reflect your local setup. The
	important points to note are the printer definition line and the
	download and reverse option lines. Make the printer parameter
	"memoryavailable" large enough so that DVILASER/PS won't purge fonts;
	this saves time and space. The "resolution" parameter should NOT be
	scaled; NeWS runs into conversion errors if you use Arbortext's
	suggested scalings.

o	When imaging 300 dpi fonts onto a Sun screen, a lot of detail is lost.
	It would be better to build low-resolution versions of the TeX fonts
	for previewing, at (say) 118 dpi. The resolution option should be
	changed to reflect this, as should the font file. I just haven't got
	around to doing this yet. Alternatively, if anyone knows how to alter
	the scaling procedures to increase the density of the reduced image, I
	would like to hear about it (but I suspect that this is impossible).

o	Occasionally characters get dropped, and don't appear properly until
	the NeWS server is exited and restarted. This seems to happen only
	when the server has been running for some time, and many documents
	have been previewed. I have no idea what causes this.

o	On a different tack, I have a perl script (for v2p18) which will build
	a new font file, given an option file, and the old font file. It
	searches for all accessible fonts, sorts the sizes found, inserts the
	design sizes from the tfm files, cross-references the pk/gf/pxl files
	with tfm files, while preserving the order, downloading options and
	PostScript fonts given in the original font file. Mail me if
	interested.

(And thanks to David Rodgers of Arbortext for allowing me to redistribute the
altered DVILASER/PS prologue.)

-------------------------------------------------------------------------------

Problems encountered:
	Here is a list of some of the problems encountered, and the solutions
adopted (if any).

o	Error messages. If an error occurs during page display, the message
	"Page Display Error" is printed at the centre of the current page. I
	had tried to use a popup error message, but this caused problems when
	using a non-retained (e.g. colour) display; the popup caused damage to
	the page, which redisplayed, causing an error which popped up a
	message, which damaged the page... ad infinitum. I haven't cleaned up
	the message display yet; if the page routine rotates and scales the
	page, the message comes out rotated and scaled, and on top of whatever
	is already on the page.

o	Reshaping items and overlays. I had problems with sending /reshape
	message to items. For some types of item (e.g. scrollbars) it worked
	as expected, but for others (e.g. cycleitems, messageitems), the text
	within the item boundary was moved relative to the item frame by the x
	and y amounts, rather than moving the whole item relative to its'
	parent canvas. I used a /reshape with 0, 0, width, height arguments and
	then a /move to get this to work. I couldn't get overlay canvases to
	reshape at all, and had to resort to creating a new overlay each time
	the parent was reshaped.
 
o	NeWS font machinery. The NeWS setfont operator requires an object of
	type 'fonttype', and will not accept even well-formed font
	dictionaries. There were also problems with the matrix supplied to the
	imagemask operator.

o	Entries in FontDirectory. Entries for previewing fonts are created in
	FontDirectory, and are not removed (because of the lack of a complete
	save/restore implementation in NeWS). Programs which look through
	FontDirectory may get clogged up with previewer fonts. Only the
	characters which are used by a document will be defined in these
	fonts, so trying to select them for other use will cause problems.

-------------------------------------------------------------------------------

	Have fun,
		Angus
--
Angus Duggan, Department of Computer Science,	| <This space for hire>
University of Edinburgh, JCMB,			| USENET: ajcd@lfcs.ed.ac.uk
The King's Buildings, Mayfield Road,		| JANET:  ajcd@uk.ac.ed.lfcs
Edinburgh, EH9 3JZ, Scotland.	| OR:  ajcd%lfcs.ed.ac.uk@nsfnet-relay.ac.uk

