===============================================================
XFIG - Facility for Interactive Generation of figures under X11
===============================================================


Xfig is a menu-driven tool that allows the user to draw and manipulate objects
interactively in an X window.  The resulting pictures can be saved, printed
on postscript printers or converted to a variety of other formats (e.g. to
allow inclusion in LaTeX documents).

This file contains some notes about installing xfig, the directory
'Examples' contains some example figures and the 'Doc' directory contains
some further documentation including the manual in troff -man format
and PostScript.

***************************************************************************
Please refer any questions/bug fixes/contributions etc. about TransFig or 
xfig to me.

Brian Smith
Lawrence Berkeley National Laboratory
bvsmith@lbl.gov
***************************************************************************

Note that although I work at Lawrence Berkeley National Laboratory (LBNL)
I don't speak for LBNL nor do I represent LBNL with respect to my work on
TransFig and xfig, nor does LBL make any representations about the suitability
of this software for any purpose.

Here is the legal part:

THE LAWRENCE BERKELEY NATIONAL LABORATORY DISCLAIMS ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
______________________________________________________________________________

NOTE 1: Because Unisys has stated that they will not charge royalties for the
	use of the LZW compression algorithm in FREE programs, xfig will
	continue to support importing and exporting of GIF images.
	However, be aware that if you sell xfig, for example as part of
	a CD-ROM package with freeware, you may be liable for paying royalties
	to Unisys.
	The authors of xfig and the Lawrence Berkeley Laboratory cannot be held
	responsible in any case.

NOTE 2: Because of the patent/licensing issue with Unisys and the LZW compression
	algorithm used in GIF files, the author of Ghostscript has decided to
	remove GIF support from that program.
	xfig will now use PCX output from Ghostscript when importing EPS files.
	This means that you must compile Ghostscript with the pcx256 and pbmraw
	drivers.
	Additionally, there is a bug in the pcx driver in Aladdin Ghostscript
	versions prior to 3.32, which writes an incorrect pcx file for images
	with odd width (not even).  There is a compile-time flag called PCXBUG
	set (the default) in the Imakefile to make xfig add one pixel to the
	width of an odd-width image when it reads in the pcx output from
	Ghostscript.
	If you have Aladdin Ghostscript 3.32 or newer (which wasn't released
	as of this writing) you may comment out that flag and your images will
	have the proper width.  However, one pixel extra in width shouldn't
	matter for most imported eps files.

++++++++++++++++++++++
NOTE about version 3.0

  An error in version 3.0 incorrectly positioned objects on the canvas
  when reading older fig files.  New objects entered with 3.0 are
  correctly positioned.  A warning will popup when you load a version 3.0
  file with version 3.1 that says you might need to offset your figure by
  14 fig units in X and Y when you load it.  This is done by setting the
  X and Y offset in the popup File panel.
  I apologize for the inconvenience.

  This is also why the file version number has changed.

++++++++++++++++++++++

===================
INSTALLATION NOTES:
===================

1. Edit the Imakefile if you need to customize it (see following notes).
	For a 3D look, see NOTE below.
	If you already have the jpeg library on your system uncomment
	the "#define USEINSTALLEDJPEG" line in the Imakefile.
	You must have version 5b or newer of the jpeg library.
2. Type "xmkmf" to create the Makefile from the Imakefile.
3. Type "make"         (**** This MUST be done before "make install" ****).
	Note: The "configure" script will be automatically run in the jpeg
	directory if you are using the jpeg library supplied with xfig.
	This will create the Makefile in that directory from your system
	configuration.  
4. Type "make install"
	If you don't do this step, be sure to install the app-defaults files
	Fig.ad and Fig-color.ad and the CompKeyDB file in the directory
	specified by XFIGLIBDIR (default: /usr/local/lib/X11/xfig).
5. Type "make install.man".
6. For X11R5 and later color implementations, specify "*customization: -color"
	in your .Xdefaults or .Xresources file.
	NOTE: this only works under X11R5 and later.

If you have the XPM3 package (X11 color pixmaps) you can export your figures
   in that format.  Also, you can import xpm files as picture objects.
   Uncomment the XPMDEFINES and related variables in the Imakefile in that case.
   You need version 3.4c or newer.  This is available from ftp.x.org in
   /contrib/libraries.
If you have Ghostscript, enable the -DGSBIT flag in the Imakefile and xfig will
   attempt to use it to interpret any encapsulated Postscript (EPS) files you
   import.  Ghostscript must be compiled with with the "pcx256" and "pbmraw"
   drivers.  The pbm driver is used when you run xfig on a monochrome display
   and the pcx256 driver is used on a color display.
   See NOTE 2 above about the pcx driver in Ghostscript.
If your system doesn't have strstr(), add the flag -DNOSTRSTR in the Imakefile
   in the DEFINES line.
If your system doesn't have strcasecmp() and/or strncasecmp(), uncomment the
   lines in the Imakefile with HAVE_NO_STRCASECMP and HAVE_NO_STRNCASECMP.
If you have an input tablet and your X server supports the XInputExtension
   uncomment the lines that define TABLIB and USETAB in the Imakefile.
   Start xfig with -tablet or define the resource Fig.Tablet to use it.
 
NOTE:	For a 3D look, I recommend using Kaleb Keithley's 3D Athena Widget set,
	a direct replacement for the Xaw library.  After you compile and install that
	package, and after step 1 above, just uncomment the definition of XAWLIB in
	the Imakefile and it will use the 3D widget set.
	This set is available from ftp.x.org.

NOTE:	The Display PostScript code is not supported anymore until some kind
	user can debug it for me, as I have no access to a server with DPS
	extensions.  Use Ghostscript for rendering your EPS files.  It gives
	a color image on the xfig canvas now anyway.

The maximum width of the top ruler is set to 1020 pixels and the height of the
side ruler to 860 pixels.  If your server can handle pixmaps larger than this
and you need longer/taller rulers, you may set the maximum allowed in your
Imakefile with -DMAX_TOPRULER_WD=1160 (or whatever value you wish) and 
-DMAX_SIDERULER_HT=1024 (or whatever value you wish).

The SMOOTHMOTION option toggles between two methods for tracking the
cursor.  The first way (SMOOTHMOTION) just uses the (x,y) information given
in the X pointer motion event.  If your display server doesn't implement
motion compression this is very slow for large movements of the mouse
pointer because X sends back lots of small movement events, each of which
causes the rubberband box to be erased and redrawn.  The alternative
way (not SMOOTHMOTION) queries the position of the X cursor whenever
a motion event is received and if you make a large movement and then
stop actually turns out to involve less work even though the XQueryPointer
call is quite slow.

The SMOOTHMOTION flag MIGHT be necessary for older versions of OpenWindows on
certain machines if the performance is slow when moving or drawing objects.

The pattern shading (e.g. bricks, shingles, etc.) only work for PostScript,
GIF, JPEG, XPM and X11 Bitmap output.

Unless you have an image (picture object) in your figure, you may not gain
very much by exporting in JPEG over GIF because of the nature of compression
used in both methods.  GIF is usually better for line drawings or drawings
with large blocks of continuous color (e.g. filled polygons).  JPEG is usually
better for compressing images.

----------------------
Printing your figures:
----------------------

The program to translate your figure into one of many printer languages
(Postscript, LaTex, etc) is called fig2dev and is part of the TransFig
package put together by Micah Beck and maintained by Brian Smith.
It is available from ftp.x.org in /contrib/applications/drawing_tools/transfig.
See the man pages for more information.

If you have a SYSV system but use BSD-style printing (lpr instead of lp) you
must define -DBSDLPR in the Imakefile/Makefile.

You may also need to uncomment the following string in the Fig.ad
app-defaults file:

!Fig*job_params*string:		-T PS

-------------
Solaris users
-------------

You should have:

#define SystemV YES
#define SystemV4 YES

in your imake machine config file (usually in /usr/lib/X11/config or something
like that).

Add "-lc" to the LOCAL_LIBRARIES variable in the Imakefile to link with 
/usr/lib/libc for the directory operations.

Some people have had trouble with the Sun cc 3.0.1 compiler and optimization.
You may need to shut off optimization.
A common symptom is that xfig just core dumps when starting.

-------------
XFree86 Users
-------------

Version 3.1 of XFree86 causes problems.  Get version 3.1.1 or newer.

----------------------------------------------
Possible problems encountered installing xfig:
----------------------------------------------

PROBLEM:
	When using LaTeX fonts in Xfig I always end up with postscript
	fonts instead rather than, say, Computer Modern. 

POSSIBLE CAUSE AND SOLUTION:
	To put fonts under the control of LaTeX when generating PS, you must
	tag the text object as "special" and then use the pstex output mode.
	This mode forces special text objects to be passed through to LaTeX,
	allowing the use of Math mode and CM fonts among other things.
________________________________________________________________________________
PROBLEM:
	On a DEC Alpha the compiler may complain about something like: ".mask
	must have pcreg from .frame set if any bits are set in .mask or .fmask"
	in the file u_bound.c.

POSSIBLE CAUSE AND SOLUTION:
	Set the optimization level to -O1 at least for that file.
________________________________________________________________________________
PROBLEM:
	On Sun machines the linker may give erroneous error messages about 
	the following symbols being undefined:

	ld: Undefined symbol
	   _get_applicationShellWidgetClass
	   _get_wmShellWidgetClass

	This may be ignored as it is a problem with the Sun shared libraries
	and the way X11 builds the shared Xmu library.  It doesn't affect the
	operation of xfig.

	Or you may compile with "-Bstatic -lXmu -Bdynamic".
	To really solve the problem if you are using OpenWindows 3.0
	(X11R4-based Xt), please contact your local Sun office and request the
	following patches:

        Patch i.d.      Description
        100512-02       4.1.x OpenWindows 3.0 libXt Jumbo patch
        100573-03       4.1.x OpenWindows 3.0 undefined symbols when using
                                shared libXmu

	A source patch for use with the MIT X11R4 libraries was developed by
	Conrad Kimball (cek@sdc.boeing.com); it retrofits into R4 some fixes
	made in R5 to get around this problem. The patch is on export in [1/93]
	contrib/X11R4_sunos4.1.2_patch_version3.Z".

	The other option is to use X11R5 or X11R6.
________________________________________________________________________________
PROBLEM:
	The window oscillates and fights with the window manager when
	I click on a mode button or try to resize the xfig window.

POSSIBLE CAUSE AND SOLUTION:
 	Perhaps the following resource has been set
 		*allowShellResize: true
	because another program requires it to be true.
	Change the resource to be specific to the programs which need it,
	or set the following resource:
 		Fig*allowShellResize: false
	Note: this is in the Fig.ad file that comes with xfig, which is 
	      installed when you do a "make install".
________________________________________________________________________________
PROBLEM:
	Openwindows sometimes loses track of xfig's icon.

POSSIBLE CAUSE AND SOLUTION:
	Cause unknown, here is a temporary kludge. Place the line:
		Fig*iconPixmap:               ..../your_lib_area/fig.icon.X
	in your .Xdefaults file and copy fig.icon.X into your lib area.
________________________________________________________________________________
PROBLEM:
	When compiling on an HP 750 running HP-UX 8.05, the compiler dies with
	a bus error in the file u_undo.c.

POSSIBLE CAUSE AND SOLUTION:
	There is a bug in the HP compiler.  Workaround the problem by adding
	an extra statement between two statements in u_undo.c:

	Original:

	undo_glue()
	{
	    list_delete_compound(&objects.compounds, saved_objects.compounds);
	    tail(&objects, &object_tails);

	New:

	undo_glue()
	{
	    list_delete_compound(&objects.compounds, saved_objects.compounds);
>>>	    /* HP-UX 8.05 compiler bug fix -- don't ask */
>>>	    last_action = last_action;
	    tail(&objects, &object_tails);
________________________________________________________________________________
PROBLEM:
	On HP machines, the capitalization of some letters in the text window 
	in the edit popup for text objects are wrong.

POSSIBLE CAUSE AND SOLUTION:
	Make sure that the CompKeyDB file has the lowercase letter definitions
	BEFORE the uppercase definitions.  This should be the case for the 
	CompKeyDB file shipped with xfig 2.1.5 and later.
________________________________________________________________________________
PROBLEM:
	On some HP computers using native cc compiler there is a problem with
	level 3 optimization.

POSSIBLE CAUSE AND SOLUTION:
	Use +O2 instead of +O3 or get patch from HP for the compiler from
	http://support.mayfield.hp.com/
	Choose: Patch Browsing and Downloading

________________________________________________________________________________
PROBLEM:
	On Linux machines xfig crashes.

POSSIBLE CAUSE AND SOLUTION:
	On linux you need to have gcc version 2.6.2 or newer.
