# Getting and Installing Xfig and TransFig

You need the fig2dev program in the TransFig package in addition to xfig to be complete. The fig2dev program is the program which allows you to print figures and export them to various languages and formats such as PostScript, GIF, JPEG, etc.

Xfig and TransFig

- Getting and Installing Xfig
- Installing TransFig/fig2dev
- Xfig On Microsoft Windows
- Xfig On the MacIntosh
- Installing Other Software
- Installing Ghostscript's Type 1 fonts under X

Related Software

- Libraries
- Applications

## Getting and Installing Xfig

This is the installation procedure of xfig. See the `README` file for more details. For information about how to use internationalization facility of xfig, see also Internationalization.

1. Get the source of xfig (`xfig.3.2.5c.full.tar.gz`) and gunzip and untar the file:
   Either do:
   1. `gunzip -c xfig.3.2.5c.full.tar.gz | tar xvf -`
      or
   2. `gunzip xfig.3.2.5c.full.tar.gz`
      `tar xvf xfig.3.2.5c.full.tar`

   You can get the source from http://www.xfig.org/xfigdist, ftp://ftp.x.org/contrib/applications/drawing_tools/xfig and its mirror sites or from any CTAN machine ( ftp://ftp.tex.ac.uk/pub/archive/graphics, for example).

2. Edit the `Imakefile` if you need to customize it:
     If you want to install xfig in a directory other than the default X11 binary directory:
       add "BINDIR=<directory>" at the top of the Imakefile, where <directory> is the full path of the directory in which you want xfig to be installed.
       Also, you may have to redefine MKDIRHIER because make looks for it relative to the BINDIR variable.
       Set it to: "MKDIRHIER = /bin/sh <path>/mkdirhier" where <path> is the path to the mkdirhier script or program.
       Finally, uncomment and change XAPPLOADDIR to the directory where you want the app-defaults resource files to go. You will have to use the environment variable XAPPLRESDIR in your shell to point to this directory.
       On Sun systems running Openwindows you probably need to set the environment variable XUSERFILESEARCHPATH to point to your app-defaults directory, and append a "%N" to the path, e.g. /users/me/xfig/app-defaults/%N
     To use JPEG, you must have JPEG library (Version 5b or later). If you already has the JPEG library installed in your system area then make sure the `USEINSTALLEDJPEG` variable is uncommented (the default). If you don't have JPEG installed, get the source from ftp://ftp.uu.net/graphics/jpeg or ftp://ftp.x.org/contrib/libraries and comment out the `USEINSTALLEDJPEG` variable, and set the `JPEGLIBDIR` variable to the directory where source of JPEG library is stored.
     ** Make sure you delete or rename any older version of the JPEG library you might have on your system. Some Linux systems come with an older version which is incompatible with xfig.

     If you don't want JPEG support, comment out ``#define USEJPEG`' using the `XCOMM` comment directive (e.g. `XCOMM #define USEJPEG`).

     You need the PNG library (-lpng) and the zlib (-lz) compression library. You can find the PNG sources at http://www.libpng.org/pub/png/libpng.html and the zlib sources at ftp://ftp.cdrom.com/pub/infozip/zlib.

     To enable XPM support, uncomment ``#define USEXPM`' and modify the definition of `XPMLIBDIR` if necessary. To use XPM, you must have XPM3 package (Version 3.4c or later).

     If you want to use Xaw3d (Three-D Athena Widget) library, uncomment ``#define XAW3D`', and change the ``XAW3DINC` variable to point to the directory where your 3D Athena widget headers are located. When Xaw3d is used instead of Xaw, the buttons will appear 3 dimensional. The Xaw3d library should be compiled without `-DARROW_SCROLLBAR`.

     Small Icons - If you have a small screen (e.g. 800x600 or so) you may want to use the small mode panel buttons for xfig. If so, uncomment the ``#define USESMALLICONS`' line.

     If your system doesn't have `strcasecmp()` and/or `strncasecmp()`, uncomment
       ``HAVE_NO_STRCASECMP = -DHAVE_NO_STRCASECMP`'
     and/or
       ``HAVE_NO_STRNCASECMP = -DHAVE_NO_STRNCASECMP`'.

     If your system doesn't have `strstr()`, uncomment ``#define NOSTRSTR`'.

     If your system doesn't have `strerror()` (but support `sys_errlist`), uncomment ``NEED_STRERROR = -DNEED_STRERROR`'.

     If you have a wheel mouse, see wheel mouse for a description of the wheel functions in xfig.

     If you want to enable internationalization facility of xfig, uncomment "`#define I18N`" (remove (`XCOMM`). See Internationalization for more information.

     Suggestion to Package Maintainers: If you are preparing a package to be distributed to the world in the binary form, it is recommended to enable internationalization facility so that the package can be used also in Japan or Korea.

   Check the `README` file for more information about specific systems.

3. Type `xmkmf` to generate a `Makefile` for your system.

4. Type `make` to compile xfig.

5. After the compilation has finished, type `make install` to copy the files to the appropriate directories.

   If you don't use `make install` and copy files manually, note that:

     the `xfig` executable should go in your command search path,
     `Fig.ad` should go in the `app-defaults` directory with the name `Fig`,
     The `CompKeyDB` file , the `Doc/html` directory, and the `xfig-howto.pdf` and `xfig.pdf` files should be copied into the directory specified by the `XFIGLIBDIR` variable in the `Imakefile`

6. Type `make install.man` to copy the manual pages to the appropriate directory.

## Installing TransFig/fig2dev

Here is the installation procedure for TransFig (fig2dev). See `README` file in for details. For information about how to use internationalization facility of fig2dev, see also Internationalization.

1. Get the source of TransFig (`transfig.3.2.5e.tar.gz`), and untar the file. It should be available at the same site as xfig.

2. You shouldn't need to change the toplevel `Imakefile` or the `Imakefile` in `fig2dev/dev`.
   Edit `fig2dev/Imakefile` if you need to customize it:

     If you don't want to use NFSS2 font selection for LaTeX text, comment out ``DDNFSS = -DNFSS`' using the `XCOMM` directive. If you don't want to use `epsfig` macros as distributes with LaTeX2e, comment out ``DDEPSF = -DEPSF`' in the same way.

     Hint: Users of LaTeX2e will probably want to include both of these options; users of LaTeX 2.09 will probably want to include neither.

     To use JPEG, you must have JPEG library (Version 5b or later). If you already if the JPEG library installed in your system area then make sure the `USEINSTALLEDJPEG` variable is uncommented (the default). If you don't have JPEG installed, get the source from ftp://ftp.uu.net/graphics/jpeg or ftp://ftp.x.org/contrib/libraries

     If you don't want JPEG support, comment out ``#define USEJPEG`' using the `XCOMM` comment directive (e.g. `XCOMM #define USEJPEG`).

     You need the PNG library (-lpng) and the zlib (-lz) compression library. You can find the PNG sources at http://www.libpng.org/pub/png/libpng.html and the zlib sources at ftp://ftp.cdrom.com/pub/infozip/zlib.

     To enable XPM support, uncomment ``#define USEXPM`' and change `XPMLIBDIR` if necessary. To use this facility, you must have XPM3 package (Version 3.4c or later).

     If your system doesn't have `strcasecmp()` and/or `strncasecmp()`, uncomment
       ``HAVE_NO_STRCASECMP = -DHAVE_NO_STRCASECMP`'
     and/or
       ``HAVE_NO_STRNCASECMP = -DHAVE_NO_STRNCASECMP`'.

     If your system doesn't have `strstr()`, uncomment ``#define NOSTRSTR`'.

     If your system doesn't have `strerror()` (but support `sys_errlist`), uncomment ``NEED_STRERROR = -DNEED_STRERROR`'.

     On Solaris 2, you must add `-lnsl` to `LOCAL_LIBRARIES`. On HP-UX, you may need to reduce optimization level to `+O2`.

     If you want to enable internationalization facility of fig2dev, uncomment "`#define I18N`" (remove (`XCOMM`). See Internationalization for more information.

   See `README` and `Imakefile` for more details.

3. Type `xmkmf` to generate the `Makefile`.

4. Type `make Makefiles` to generate the `Makefile`s. Note the "s" in "Makefiles".

5. Type `make` to compile TransFig and fig2dev.

6. Type `make install` to copy the executable and files to the appropriate directories.

7. Type `make install.man` to copy the manual pages to the appropriate directory.

## Xfig On Microsoft Windows

There is a version of xfig ported to run under Microsoft Windows using the Cygnus X server. See Wayne Wang's xfig for Windows.

Both need an X server (e.g. Hummingbird Exceed, or Cygwin/X to run. See: http://www.cygwin.com/xfree/)

## Xfig On the MacIntosh

There is a version of xfig ported to run on the MacIntosh under MacPorts. See: http:macports.org

## Installing Other Software

In addition to xfig and transfig (fig2dev). you will also need to install GhostScript and netpbm,

- xfig invokes GhostScript (the `gs` command) when displaying PostScript images, and exporting in bitmap formats (e.g. JPEG, XPM, etc).

  GhostScript must be compiled with pbmraw, ppmraw, pcx256, jpeg, and tiff24nc driver.

  GhostScript can be found at ftp://prep.ai.mit.edu/pub/gnu and its mirror sites, or at ftp.cs.wisc.edu/ghost/aladdin.

- fig2dev invokes commands in the netpbm package when exporting in some formats.

  Commands that may actually be used are: pbmtoxbm, pgmtopbm, pnmdepth, pnmscale, pnmtopng, pnmtotiff, ppmquant, ppmtoacad, ppmtogif, ppmtopcx, ppmtopgm, ppmtojpeg and ppmtoxpm.

  netpbm can be found at http://download.sourceforge.net/netpbm/ or ftp://ftp.x.org/contrib/graphics or its mirror sites in `/contrib/graphics`.
  Be sure that it includes ppmtojpeg. This may be found only in the newer releases, such as 9.0 and 9.1

## Installing Ghostscript's Type 1 fonts under X

You can use Ghostscript's high quality Type 1 fonts on your X server (and therefore in xfig). Copy the necessary files from Ghostscript's fonts directory to /usr/X11R6/lib/X11/fonts/Type1/ (or wherever your X server Type 1 fonts are).

    $ cp /usr/share/ghostscript/fonts/*l.pfb /usr/X11R6/lib/X11/fonts/Type1

Append the file `/usr/share/ghostscript/fonts/fonts.scale` to `Type1/fonts.scale`. The first line in the latter file contains is the number of fonts listed in that file. Change that number to include the additional fonts.

Now run `mkfontdir(1)` to update the font database:

    $ mkfontdir

If your operating system has the `chkfontpath` command, alternative is to add the Ghostscript font directory to the X server font path:

    chkfontpath -a /usr/share/ghostscript/fonts/fonts/

In either case, if your X-server is running already you have to tell it to reread the font databases with `xset(1)`:

    $ xset fp rehash

## Related Software

### Libraries

Xaw3d (Three-D Athena Widget) library
  If Xaw3d is used instead of normal Xaw, widgets such as buttons will have 3-D appearance. It is available from ftp://ftp.x.org/contrib/widgets and its mirror sites in `/contrib/widgets`.
XPM3 package
  This package provides facilities to handle images in XPM format. It is available from ftp://ftp.x.org/contrib/libraries and its mirror sites in `/contrib/libraries`.
JPEG library
  This package provides facilities to handle images in JPEG format. The official distribution site is ftp://ftp.uu.net/graphics/jpeg. It is also available from ftp://ftp.x.org/contrib/libraries and its mirror sites in `/contrib/libraries`.

### Related Applications

Here is a list of related applications. See also Scientific Applications on Linux (SAL) for more applications for Linux (many of them may also work on other UNIX-compatible platforms) and http://homepage.usask.ca/~ijm451/fig/ which a site maintained by Ian MacPhedran that has some other links for FIG-related applications. Also, http://www.hologuard.com/useful-resources/learning-centre/21 lists some FIG-related applications.

fig2dev (TransFig)
  fig2dev provides the facility to convert figures created with xfig into various formats. You must have fig2dev because xfig invokes it when Exporting or Printing. fig2dev is part of the TransFig package.
GhostScript
  xfig will invoke GhostScript (the `gs` command) when displaying an imported PostScript image. GhostScript is copyrighted by Aladdin Enterprises, but it is (at least older versions are) distributed under GPL, and it is available from ftp://prep.ai.mit.edu/pub/gnu and its mirror sites, or ftp.cs.wisc.edu/ghost/aladdin.
AutoTrace
  Converts bitmap to vector graphics - has a Fig file output driver. Available from http://autotrace.sourceforge.net. Written by Martin Weber.
cdraw2fig
  Converts `Cheap Draw' format to Fig format. Cheap Draw 2.0 was written by Bob Pratt and is available from the UNIXPC archives at osu-cis.
chemtool
  A chemical structure editor for X11 available from http://ruby.chemie.uni-freiburg.de/~martin/chemtool/chemtool.html that writes Fig output (and relies on transfig for anything more fancy than xbm)
figbuild
  figbuild reads xfig files (Version 3.x, tested with 3.1, 3.2) plus its own config file for heights, and generates a Radiance input file. Written by Peter Apian-Bennewitz at Fraunhofer ISE, Germany. See: http://www.ise.fhg.de/radiance/pabs-toolbox/figbuild/figbuild.html
GIMP
  A comprehensive image manipulation program, GIMP (Gnu Image Manipulation Program) is freely available from http://www.gimp.org/.
gnuplot
  gnuplot is a plotting package which can output in Fig and other formats. The official distribution site is http://www.gnuplot.info/.
grass2fig
  The GRASS GIS (Geographic Resources Analysis Support System) is an open source Geographical Information System (GIS) with raster, topological vector, image processing, and graphics production functionality that operates on various platforms through a graphical user interface and shell in the X Window System. It is released under GNU General Public License (GPL). See http://grass.itc.it/. The grass2fig program will convert a GRASS binary vector map to a Fig file.
gzip (gunzip)
  xfig will invoke gunzip when reading gzipped files. gzip (gunzip) is a product of the Free Software Foundation, and is available from ftp://prep.ai.mit.edu and its mirror sites.
hp2xx
  hp2xx can convert HP-GL files into other formats such as PostScript, LaTeX or Fig. It is available from ftp://ftp.gnu.org/gnu/hp2xx.
jfig
  jfig is a Java-based drawing program that is based on xfig. See http://tech-www.informatik.uni-hamburg.de/applets/javafig/applet.html
mifXfig
  mifXfig will convert files between MIF format (of Framemaker(TM)) and Fig format. See http://www.ida.liu.se/~vaden/teaching/m2f/ for details.
Msphinx
  A friendly package to handle satellite images.
  Main features:
    Msphinx includes two types of analysis and processing functions:
    - Functions to process the basic data geometry and projection planes.
    - Functions to manipulate and modify the graphic display and print.
  Communication capabilities:
    - Data writes from external user programs (C or Fortran) into the memory planes.
    - User-to-user data exchange (text or images).
    - User image data base visualisation.
    - Direct links to other packages:
      - Mgraph (2d and contouring plotting)
      - HDFLook (HDF read write files)
      - Xfig (Facility for Interactive Generation of figures)
      - mpeg_encode (mpeg format nimations)
  Find it at: http://loasys.univ-lille1.fr/Msphinx/Msphinx_gb.html
netpbm
  fig2dev will invoke the appropriate command from the netpbm package when exporting figures to bitmap formats. netpbm is available from ftp://ftp.x.org/contrib/applications/drawing_tools/xfig and its mirror sites or from ftp://ftp.cdrom.com/pub/X11/contrib/utilities.
pic2fig
  Convertes PIC format (used with troff, ditroff, etc) to Fig format. It is available from ftp://ftp.cs.orst.edu/localsrc/graphics or ftp://ftp.x.org/contrib/utilities and its mirror sites in `/contrib/utilities`.
plot2fig
  Converts UNIX plot format to Fig format. Available from any GNU site.
plotutils (GNU)
  includes an application for XY plotting (graph), a plot filter (plot), a Tektronix translator (tek2plot), a program for displaying font character maps (plotfont), and a library for drawing 2-D vector graphics (libplot), all of which produce output in xfig format. by Robert S. Maier <rsm@math.arizona.edu>. See: http://www.gnu.org/software/plotutils/plotutils.html
pstoedit
  pstoedit can convert PostScript files into Fig format. It is available from http://www.pstoedit.net/pstoedit.
xfigbar and xfigpie
  Two C programs to produce bar and pie charts as Fig files. Written by John Conover <john@johncon.johncon.com>, these programs are available at: http://www.johncon.com/john/archive/xfigutilities.shar.gz
xgraph
  xgraph is a plotting package which runs in X11. The version on ftp://iworks.ecn.uiowa.edu in `comp.hp` can output Fig files.
xpaint
  xpaint is a painting program which runs under X11. It is available from http://www.danbbs.dk/~torsten/xpaint and any SunSite machines such as ftp://sunsite.unc.edu/pub/Linux/apps/graphics/draw/.
xv
  xv can be used to display images in various formats and allows some editing of those images (cropping, color editing scaling/rotating etc). By default, xfig will invoke xv when the Edit Image button is pressed in the edit PICTURE object panel. xv is shareware and is available via anonymous ftp from ftp://ftp.cis.upenn.edu/pub/xv.

[ Contents | Introduction | Credits ]