This patch file should be applied (using the "patch" program) to TransFig 3.2.3
to bring it up to version 3.2.3b.

Note that there is no version 3.2.3a of TransFig

diff -rc transfig.3.2.3/CHANGES transfig.3.2.3b/CHANGES
*** transfig.3.2.3/CHANGES      Thu Jan 13 19:54:15 2000
--- transfig.3.2.3b/CHANGES     Fri Jul 14 10:19:49 2000
***************
*** 3,14 ****
 Version 3.2
 ===============================================================================

 Patchlevel 3  (Jan 14, 2000)
 [N.B. There was no transfig/fig2dev 3.2 patchlevel 2]

 NEW FEATURES
       o Adapted the transfig manual from LaTeX 2.09 to LaTeX 2e and uses
!         Times/Helvetica/Courier instead of Computer Modern fonts.
         From Roland Rosenfeld ([email protected])
       o If DBM file for RGB databse does not exist, read "rgb.txt" instead.
       o If a file such as /usr/local/lib/fig2dev/A3.ps exists, insert it
--- 3,85 ----
 Version 3.2
 ===============================================================================

+ Patchlevel 3b  (July 19, 2000)
+
+ N.B. There was no transfig 3.2.3a - I want to keep the release number identical
+      to that of the corresponding xfig.
+
+ NEW FEATURES
+       o X11 Color database ASCII file (/usr/lib/X11/rgb.txt) is now used,
+         removing the need for the dbm_xxx functions.
+       o The \special code for colors in genlatex (LaTeX driver) replaced with
+         the \color code to be compatible with pdflatex and not require dvips
+         From Klaus Guntermann ([email protected])
+       o PCX image reader now handles 24-bit color which means that TIFF images
+         (which are converted to PCX first) may also be 24-bit
+
+ BUGS FIXED
+       o Explicitely sets color to black before importing eps file in case that
+         file doesn't select a color
+       o Changed error message in epic driver from "Unknown style" to "Only
+         solid, dashed, and dotted line styles supported by epic(eepic)"
+       o Apostrophes (') in text are now escaped in CGM driver
+         from David Billinghurst ([email protected])
+       o One of the header values for TIFF files was incorrect (was "DD",
+         should be "II")
+       o -f (font) option wasn't parsed correctly, which caused segfault
+       o Bug in handling imported xpm file colors in certain formats
+       o Multiple variables with same name in different drivers now declared
+         "static"
+       o In multi-page mode, redundant "Page: 1 1" was generated
+       o Unnecessary scaling in the pattern definitions removed (pdf/ps/eps
+         drivers)
+       o Total page number calculation was incorrect for multi-page PostScript
+         output
+       o Toplevel Imakefile referred to "make" instead of "$(MAKE)"
+       o Text object read routine had extra variable in scanf
+       o Error in calculation of arc arrowhead occluding underlying line; could
+         cause asin domain error
+       o Possible error in reading imported GIF colormap
+       o calc_arrow() didn't set nboundpts (number of points in bounding box)
+         if line having arrowhead had zero length
+       o Bug in Imakefile - jpeglib.h file couldn't be found for JPEG code if
+         USEXPM was not enabled.
+       o "Special" LaTeX text not included in bounding box anymore - this had
+         caused positioning problems with the LaTeX special text and figure
+       o "hyphen" was misspelled as "hypen" the character encoding for the
+          PostScript (and EPS/PDF) driver.
+       o One of the two TIFF file header types was incorrect
+       o Segfault when exporting to GIF if Fig file specified "none" for GIF
+         transparency
+       o Duplicate JPEG information in fig2dev/Imakefile
+       o If output from fig2dev was standard output, bitmap export formats
+         failed because of bad argument to ghostscript
+       o -P option description for PostScript removed from fig2dev man pages
+       o Error parsing certain color specs for XPM files
+       o Tightly curved, wide splines were sometimes "spikey"
+       o Bounding box wasn't taking arrowhead width(s) into account
+       o free_text now uses free() instead of less standard cfree()
+       o Changed last references to sys_errlist to use strerror()
+       o Bug in referencing imported xbm files in tk driver fixed
+       o Temporary file not closed before deleting in read_gif() and read_ppm()
+       o Formatting "%lf" in printf calls should be "%f"
+       o Prepended $(DESTDIR) to $(XFIGLIBDIR) and $(FIG2DEV_DIR) directory
+         variables in Imakefile to be portable
+       o Cleaned up extraneous and erroneous rules in fig2dev/Imakefile
+         from Pierre Humblet ([email protected])
+       o Removed calls to external programs "cat" and "ps2pdf" to make more
+         portable to Cygwin environment
+       o fig2dev now uses gunzip instead of uncompress to uncompress .Z files
+         to be more portable for Cygwin environment
+       o Papersize sometimes truncated when reading Fig file
+
+ ----------------------------
 Patchlevel 3  (Jan 14, 2000)
 [N.B. There was no transfig/fig2dev 3.2 patchlevel 2]

 NEW FEATURES
       o Adapted the transfig manual from LaTeX 2.09 to LaTeX 2e and uses
!         Times/Helvetica/Courier instead of Computer Modern fonts.
         From Roland Rosenfeld ([email protected])
       o If DBM file for RGB databse does not exist, read "rgb.txt" instead.
       o If a file such as /usr/local/lib/fig2dev/A3.ps exists, insert it
***************
*** 32,38 ****
       o The default is now to compile for DVIPS
       o Arc-boxes available for LaTeX now
         from C. Scott Ananian <[email protected]>
!       o New import picture formats supported - TIFF and PPM

 BUGS FIXED
       o clipping and background filling incorrect for some Postscript/EPS
--- 103,109 ----
       o The default is now to compile for DVIPS
       o Arc-boxes available for LaTeX now
         from C. Scott Ananian <[email protected]>
!       o New import picture formats supported - TIFF and PPM

 BUGS FIXED
       o clipping and background filling incorrect for some Postscript/EPS
***************
*** 70,82 ****
         those systems which don't have it (it is defined to use memset)
       o didn't include "pi.h" in dev/gentk.c for machines that don't have M_PI
       o Moved JPEGLIBDIR and JPEGINCDIR definition closer to the top in the
!         fig2dev/Imakefile
       o Output to GIF, JPEG, etc. (bitmap formats) didn't work properly if the
         destination was stdout
       o "make install" changed because some systems' install program can only
          take one file at a time
       o Added a "newpath" command after the initial clip command for PostScript
!         output just in case an object is drawn without a preceding newpath
       o M_2PI was redefined without first being #undef'd
       o the "-" character in Fig files should really be a hyphen, not a dash as
         it was encoded for PostScript output.  This is fixed thanks to info
--- 141,153 ----
         those systems which don't have it (it is defined to use memset)
       o didn't include "pi.h" in dev/gentk.c for machines that don't have M_PI
       o Moved JPEGLIBDIR and JPEGINCDIR definition closer to the top in the
!         fig2dev/Imakefile
       o Output to GIF, JPEG, etc. (bitmap formats) didn't work properly if the
         destination was stdout
       o "make install" changed because some systems' install program can only
          take one file at a time
       o Added a "newpath" command after the initial clip command for PostScript
!         output just in case an object is drawn without a preceding newpath
       o M_2PI was redefined without first being #undef'd
       o the "-" character in Fig files should really be a hyphen, not a dash as
         it was encoded for PostScript output.  This is fixed thanks to info
***************
*** 177,183 ****
         several places in genepic.c draw_arrow_head is called with unconverted
         coordinates, which leads to totally displaced arrows.
         from Heiko Schroeder ([email protected])
!       o cleanup of dictionary wrapped around imported EPS files
         from Franz Koch ([email protected])
       o pic output didn't produce dashed or dotted arc
       o metric flag incorrectly parsed
--- 248,254 ----
         several places in genepic.c draw_arrow_head is called with unconverted
         coordinates, which leads to totally displaced arrows.
         from Heiko Schroeder ([email protected])
!       o cleanup of dictionary wrapped around imported EPS files
         from Franz Koch ([email protected])
       o pic output didn't produce dashed or dotted arc
       o metric flag incorrectly parsed
***************
*** 205,215 ****
 NEW FEATURES

 o multi-page, paper size, magnification and transparent color stored in Fig
!       file now.  (transparent color is only used by xfig when exporting
       to GIF format)
 o comment that Redhat Linux users may have to change DBMLIB to -ldb in
       fig2dev/Imakefile
! o figures in landscape are only rotated when showpage command is NOT used
       (-P).  This is because it doesn't need to be rotated for EPS,
 o previous spline models (interpolated splines and approximated splines) are
   replaced by one single model (x-splines) which allows the user to mix
--- 276,286 ----
 NEW FEATURES

 o multi-page, paper size, magnification and transparent color stored in Fig
!       file now.  (transparent color is only used by xfig when exporting
       to GIF format)
 o comment that Redhat Linux users may have to change DBMLIB to -ldb in
       fig2dev/Imakefile
! o figures in landscape are only rotated when showpage command is NOT used
       (-P).  This is because it doesn't need to be rotated for EPS,
 o previous spline models (interpolated splines and approximated splines) are
   replaced by one single model (x-splines) which allows the user to mix
***************
*** 244,250 ****
       The old restriction is not needed because the epsfig package is
       required to include ps_tex_t files anyway.
 o new line types - Dash-dot (_.) Dash-dot-dot (_..) and Dash-dot-dot-dot (_...)
! o new paper sizes: "Tabloid", "Ledger", "B", "C", "D", "E", "A0", "A1", "A2",
       "A3", "A4" and "B5".  See man fig2dev (-z option) for sizes in
       inches and cm

--- 315,321 ----
       The old restriction is not needed because the epsfig package is
       required to include ps_tex_t files anyway.
 o new line types - Dash-dot (_.) Dash-dot-dot (_..) and Dash-dot-dot-dot (_...)
! o new paper sizes: "Tabloid", "Ledger", "B", "C", "D", "E", "A0", "A1", "A2",
       "A3", "A4" and "B5".  See man fig2dev (-z option) for sizes in
       inches and cm

***************
*** 320,326 ****
 o recursion bug fixed where run-time would increase exponentially with nesting
       of compound objects
 o %%BeginDocument:/EndDocument now surrounds imported EPS files
! o open arrowheads on arcs were overwritten by arc lines
 o bug in pattern fill code which made patterns appear solid black when
       using dvips
       Thanks to Tomas Rokicki ([email protected]) for finding the fix
--- 391,397 ----
 o recursion bug fixed where run-time would increase exponentially with nesting
       of compound objects
 o %%BeginDocument:/EndDocument now surrounds imported EPS files
! o open arrowheads on arcs were overwritten by arc lines
 o bug in pattern fill code which made patterns appear solid black when
       using dvips
       Thanks to Tomas Rokicki ([email protected]) for finding the fix
***************
*** 340,346 ****

   Add -DNFSS to DEFINES list to use NFSS2 font selection for LaTeX texts
   Add -DEPSF to DEFINES list to use epsfig macros as distributed w/ LaTeX2e
!
       Hint: Users of LaTeX2e will probably want to include both of these
       options; users of LaTeX 2.09 will probably want to include neither.

--- 411,417 ----

   Add -DNFSS to DEFINES list to use NFSS2 font selection for LaTeX texts
   Add -DEPSF to DEFINES list to use epsfig macros as distributed w/ LaTeX2e
!
       Hint: Users of LaTeX2e will probably want to include both of these
       options; users of LaTeX 2.09 will probably want to include neither.

***************
*** 392,398 ****

 o NOTE:       An error in xfig version 3.0.0 incorrectly positioned objects on the
       canvas when reading older fig files.  New objects entered with 3.0 are
!       correctly positioned.
       I apologize for the inconvenience.
 ***** This is the only reason why the file protocol number has changed.

--- 463,469 ----

 o NOTE:       An error in xfig version 3.0.0 incorrectly positioned objects on the
       canvas when reading older fig files.  New objects entered with 3.0 are
!       correctly positioned.
       I apologize for the inconvenience.
 ***** This is the only reason why the file protocol number has changed.

***************
*** 509,517 ****
 o specifing nonexistant font with -f caused coredump
       from Gordon W. Ross ([email protected])
 o newpath command given before EPS object for PostScript output
! o moved definition of SetFigFont to better place
       from Bernd Raichle ([email protected])
! o #included sys/types for BSD4_3 systems in genps.c
 o bug in eepic output - SetFigFont was being defined inside a \put
       from Vivek Khera ([email protected])
 o BoundingBox for EPS objects can be floating values
--- 580,588 ----
 o specifing nonexistant font with -f caused coredump
       from Gordon W. Ross ([email protected])
 o newpath command given before EPS object for PostScript output
! o moved definition of SetFigFont to better place
       from Bernd Raichle ([email protected])
! o #included sys/types for BSD4_3 systems in genps.c
 o bug in eepic output - SetFigFont was being defined inside a \put
       from Vivek Khera ([email protected])
 o BoundingBox for EPS objects can be floating values
***************
*** 519,525 ****
 o distribution version of fig2dev/dev/Makefile had (def_)setfigfont.c
       instead of (def_)setfigfont.o in LIBOBJS definition
 o SUBDIR fig2dev/dev was missing from top-level Imakefile caused problems
!       where make would say something like "No rule to make target
       dev/libtransfig.a"

 ---------------------------------------------------------------------------
--- 590,596 ----
 o distribution version of fig2dev/dev/Makefile had (def_)setfigfont.c
       instead of (def_)setfigfont.o in LIBOBJS definition
 o SUBDIR fig2dev/dev was missing from top-level Imakefile caused problems
!       where make would say something like "No rule to make target
       dev/libtransfig.a"

 ---------------------------------------------------------------------------
***************
*** 536,546 ****
       to "%!PS-Adobe-2.0 EPSF-2.0" which allows FrameMaker and ghostview to
       read them properly.
       from Vivek Khera ([email protected])
! o check for #ifdef SYSV to include string.h instead of strings.h in
       fig2dev/dev/genibmgl.c
! o changed EXTRA_LIBRARIES to SYS_LIBRARIES in fig2dev/Imakefile so wouldn't
       clobber system-dependent flags in EXTRA_LIBRARIES
! o fprintf and 'else' missing from genepic which caused incorrect information
       to be generated when drawing arcs using epic output
 o removed dependencies on the X libraries (Imakefiles and Makefiles)
 o SGI machines had trouble with hypot() which caused arrow heads to mess up
--- 607,617 ----
       to "%!PS-Adobe-2.0 EPSF-2.0" which allows FrameMaker and ghostview to
       read them properly.
       from Vivek Khera ([email protected])
! o check for #ifdef SYSV to include string.h instead of strings.h in
       fig2dev/dev/genibmgl.c
! o changed EXTRA_LIBRARIES to SYS_LIBRARIES in fig2dev/Imakefile so wouldn't
       clobber system-dependent flags in EXTRA_LIBRARIES
! o fprintf and 'else' missing from genepic which caused incorrect information
       to be generated when drawing arcs using epic output
 o removed dependencies on the X libraries (Imakefiles and Makefiles)
 o SGI machines had trouble with hypot() which caused arrow heads to mess up
***************
*** 547,560 ****
       from Malcolm Davis ([email protected])
 o Flipped EPS objects were incorrectly flipped on output
       from Brian Boyter ([email protected])
! o POLYLINES were being drawn in sections (10 points per section) which
!       resulted in incorrect dashed line lengths and only one section
       filled if area fill was on
       from Peter Egelberg ([email protected])
 o added Sequent machines and Suns with SunOs < 4.1 to list of machines that
       don't have strstr()
       from Scott Erikson ([email protected])
! o removed PATCHLEVEL from patchlevel.h file - version number is complete with
       three parts (e.g. 2.1.6)
 o removed "extern coord_system" from fig2dev.h (wasn't used by fig2dev)
 o SPECIAL_CHAR split into three strings for systems which can't handle one
--- 618,631 ----
       from Malcolm Davis ([email protected])
 o Flipped EPS objects were incorrectly flipped on output
       from Brian Boyter ([email protected])
! o POLYLINES were being drawn in sections (10 points per section) which
!       resulted in incorrect dashed line lengths and only one section
       filled if area fill was on
       from Peter Egelberg ([email protected])
 o added Sequent machines and Suns with SunOs < 4.1 to list of machines that
       don't have strstr()
       from Scott Erikson ([email protected])
! o removed PATCHLEVEL from patchlevel.h file - version number is complete with
       three parts (e.g. 2.1.6)
 o removed "extern coord_system" from fig2dev.h (wasn't used by fig2dev)
 o SPECIAL_CHAR split into three strings for systems which can't handle one
***************
*** 570,574 ****
 o changed header for postscript files from "%!" to "%!PS-Adobe-2.0" when using
       -P (showpage) option and "%!PS-Adobe-2.0 EPSF" otherwise (Encapsulated)
 o corrupt transfig/Imakefile and typo (SCRS instead of SRCS)
! o some variables (cur_thickness and coord_system) were multiply defined in
       various drivers in fig2dev/dev - made those static
--- 641,645 ----
 o changed header for postscript files from "%!" to "%!PS-Adobe-2.0" when using
       -P (showpage) option and "%!PS-Adobe-2.0 EPSF" otherwise (Encapsulated)
 o corrupt transfig/Imakefile and typo (SCRS instead of SRCS)
! o some variables (cur_thickness and coord_system) were multiply defined in
       various drivers in fig2dev/dev - made those static
diff -rc transfig.3.2.3/Imakefile transfig.3.2.3b/Imakefile
*** transfig.3.2.3/Imakefile    Mon Jan  3 10:33:52 2000
--- transfig.3.2.3b/Imakefile   Wed Apr 12 09:15:18 2000
***************
*** 40,46 ****

 transfig.man:: doc/transfig.1
       -ln -s ../doc/transfig.1 transfig.man
!       cd doc/manual; make; latex manual; latex manual

 clean::
!       cd doc/manual; make clean
--- 40,46 ----

 transfig.man:: doc/transfig.1
       -ln -s ../doc/transfig.1 transfig.man
!       cd doc/manual; $(MAKE); latex manual; latex manual

 clean::
!       cd doc/manual; $(MAKE) clean
diff -rc transfig.3.2.3/README transfig.3.2.3b/README
*** transfig.3.2.3/README       Thu Jan 13 19:56:09 2000
--- transfig.3.2.3b/README      Fri Jul 14 10:37:08 2000
***************
*** 1,5 ****
- Announcing the release of TransFig version 3.2.3 January 14, 2000
-
 TransFig is a set of tools for creating TeX documents with graphics
 which are portable, in the sense that they can be printed in a wide
 variety of environments.
--- 1,3 ----
***************
*** 47,131 ****
 5. Do a "make install" to install them in the system
 6. Do a "make install.man" to put the manual pages in the proper directories

! Uncomment the USELATEX2E flag in the transfig/Imakefile file to use the
! \\usepackage{} command for LaTeX2e.
! The default is to use \\documentstyle{} for LaTeX209.
!
! In fig2dev/Imakefile for the described features:
! Comment out the DDNFSS = ... line if you don't want NFSS2 font selection
!       for LaTeX texts.
! Comment out the DDLATEX2E_GRAPHICS = ... line if you don't want to use the
!       standard graphics package distributed w/ LaTeX2e.
! UNcomment the DDEPSFIG = ... line if you want to use the deprecated epsfig macros
!       distributed w/ LaTeX2e (DDLATEX2E_GRAPHICS must also be defined).

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

! 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 your system doesn't have strstr(3) uncomment the "#define NOSTRSTR"

! ----------------------------------------------------------------------------
 ***************
 IMPORTANT NOTE:

! As of version 3.2.0 (final), fig2dev has taken over the translating of Fig
! to the bitmap formats (ACAD, GIF, JPEG, XPM, XBM, PCX, TIFF).
! In the past, xfig itself rendered the bitmap formats.  This change was made
! to have a more consistent look and better fonts.  First, the Fig file is
! translated to PostScript, then ghostscript is used to render the image to
! the final format in the case of JPEG, PCX and TIFF, or to PPM (portable
! pixmap) after which the appropriate ppmtoXXX filter is used to get ACAD, GIF,
! XPM and XBM.  If smoothing is done (-S option) when jpeg output is used, the
! "cjpeg" program must be installed from the jpeg package.  This is done
! automatically when you "make" TransFig or fig2dev.
!
! You need the netpbm package of March 1994 (or later), which you can find on
! ftp.x.org in /contrib/utilities or on ftp.cdrom.com in
! /pub/X11/contrib/utilities.
!
! You will also need ghostscript, which can be found on ftp.cs.wisc.edu in
! /ghost/aladdin, *AND* it must be compiled with the pcx256, jpeg, png256, ppmraw
! and tiff24nc drivers.
! ***************
! ----------------------------------------------------------------------------
! Make sure that you point XFIGLIBDIR to the same directory that xfig uses
! (usually /usr/local/lib/xfig).  This will be used to hold the bitmaps directory
! for the tk fill patterns.
! ----------------------------------------------------------------------------
! If you have NOT installed the JPEG library in your system library area, comment
! out the USEINSTALLEDJPEG in fig2dev/Imakefile variable, change the JPEGLIBDIR
! variable to the directory where your JPEG library resides and change the
! JPEGINCDIR to the directory where your JPEG header files (include) reside.
! You must have version 5b or newer of the JPEG library.
!
! The JPEG library is available from several places.  The official archive site
! is ftp.uu.net in /graphics/jpeg.
! Another site is ftp.x.org in /contrib/libraries.
!
! If you don't want to be able to import JPEG images in your Fig files at all
! then comment out the "#define USEJPEG" line in the fig2dev/Imakefile.
! ----------------------------------------------------------------------------
! If you want to be able to translate Fig files that have imported XPM files
! (color pixmaps) uncomment the "#define USEXPM" line in fig2dev/Imakefile.
! You need version 3.4c or newer of the XPM package.
! This is available from ftp.x.org in /contrib/libraries.
! ----------------------------------------------------------------------------
! Uncomment the "DBMLIB = -lgdbm" in fig2dev/Imakefile if your dbm routines are
! in their own library.
! For the Redhat distributions of Linux you may have to change DBMLIB to -ldb.
! For some Linuxes you may need to change it to "DBMLIB = -ldbm".
! Slackware Linuxes use -lgdbm.
! ----------------------------------------------------------------------------
! If your system has the strerror() function (doesn't have sys_errlist) then
! comment out NEED_STRERROR with an XCOMM comment.
! ----------------------------------------------------------------------------
! Look in the Imakefiles to see if any options are relevant to your system.
! ----------------------------------------------------------------------------
! ** If you use epic, eepic or tpic you must have compiled your dvips and xvdi
! ** with the tpic support (-DTPIC for dvips).

 *************************************************************************
 Please send email about any questions/bug fixes/contributions etc. about
--- 45,126 ----
 5. Do a "make install" to install them in the system
 6. Do a "make install.man" to put the manual pages in the proper directories

! o Uncomment the USELATEX2E flag in the transfig/Imakefile file to use the
!   \\usepackage{} command for LaTeX2e.
!   The default is to use \\documentstyle{} for LaTeX209.
!
! o In fig2dev/Imakefile for the described features:
!
!   o Comment out the DDNFSS = ... line if you don't want NFSS2 font selection
!     for LaTeX texts.
!   o Comment out the DDLATEX2E_GRAPHICS = ... line if you don't want to use the
!     standard graphics package distributed w/ LaTeX2e.
!   o UNcomment the DDEPSFIG = ... line if you want to use the deprecated epsfig macros
!     distributed w/ LaTeX2e (DDLATEX2E_GRAPHICS must also be defined).

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

! o If your system doesn't have strcasecmp() and/or strncasecmp(), uncomment the
!   lines in the Imakefile with HAVE_NO_STRCASECMP and HAVE_NO_STRNCASECMP.
!
! o If your system doesn't have strstr(3) uncomment the "#define NOSTRSTR"
!
! o Make sure that you point XFIGLIBDIR to the same directory that xfig uses
!   (usually /usr/local/lib/xfig).  This will be used to hold the bitmaps
!   directory for the tk fill patterns.
!
! o If you have NOT installed the JPEG library in your system library area,
!   comment out the USEINSTALLEDJPEG in fig2dev/Imakefile variable, change the
!   JPEGLIBDIR variable to the directory where your JPEG library resides and
!   change the JPEGINC to the directory where your JPEG header files (include)
!   reside.  You must have version 5b or newer of the JPEG library.
!
!   The JPEG library is available from several places.  The official archive site
!   is ftp.uu.net in /graphics/jpeg.
!   Another site is ftp.x.org in /contrib/libraries.
!
! o If you don't want to be able to import JPEG images in your Fig files at all
!   then comment out the "#define USEJPEG" line in the fig2dev/Imakefile.

! o If you want to be able to translate Fig files that have imported XPM files
!   (color pixmaps) uncomment the "#define USEXPM" line in fig2dev/Imakefile.
!   You need version 3.4c or newer of the XPM package.
!   This is available from ftp.x.org in /contrib/libraries.

! o If your system has the strerror() function (doesn't have sys_errlist) then
!   comment out NEED_STRERROR with an XCOMM comment.
!
! o If your system can open files in text and binary modes and has the setmode()
!   function, uncomment HAVE_SETMODE.  This probably only applies to Windows 9x/NT
!   systems.
!
! o Look in the Imakefiles to see if any options are relevant to your system.
!
! o If you use epic, eepic or tpic you must have compiled your dvips and xvdi
!   with the tpic support (-DTPIC for dvips).
!
 ***************
 IMPORTANT NOTE:

! o As of version 3.2.0 (final), fig2dev has taken over the translating of Fig
!   to the bitmap formats (ACAD, GIF, JPEG, XPM, XBM, PCX, TIFF).
!   In the past, xfig itself rendered the bitmap formats.  This change was made
!   to have a more consistent look and better fonts.  First, the Fig file is
!   translated to PostScript, then ghostscript is used to render the image to
!   the final format in the case of JPEG, PCX and TIFF, or to PPM (portable
!   pixmap) after which the appropriate ppmtoXXX filter is used to get ACAD, GIF,
!   XPM and XBM.  If smoothing is done (-S option) when jpeg output is used, the
!   "cjpeg" program must be installed from the jpeg package.  This is done
!   automatically when you "make" TransFig or fig2dev.
!
!   o You need the netpbm package of March 1994 (or later), which you can find
!     at ftp://ftp.x.org/contrib/utilities or
!     at ftp://ftp.cdrom.com/pub/X11/contrib/utilities.
!
!   o You will also need ghostscript, which can be found on ftp.cs.wisc.edu in
!     /ghost/aladdin, *AND* it must be compiled with the pcx256, jpeg, png256,
!     ppmraw and tiff24nc drivers.

 *************************************************************************
 Please send email about any questions/bug fixes/contributions etc. about
diff -rc transfig.3.2.3/doc/fig2dev.1 transfig.3.2.3b/doc/fig2dev.1
*** transfig.3.2.3/doc/fig2dev.1        Thu Jan 13 19:51:10 2000
--- transfig.3.2.3b/doc/fig2dev.1       Fri Jul 14 10:20:10 2000
***************
*** 1,4 ****
! .TH FIG2DEV 1 "Version 3.2.3 Jan 14, 2000"
 .SH NAME
 fig2dev \- translates Fig code to various graphics languages

--- 1,4 ----
! .TH FIG2DEV 1 "Version 3.2.3b July 19, 2000"
 .SH NAME
 fig2dev \- translates Fig code to various graphics languages

***************
*** 10,16 ****
 .B \-m
 .I mag
 ] [
! .B \-f
 .I font
 ] [
 .B \-s
--- 10,16 ----
 .B \-m
 .I mag
 ] [
! .B \-f
 .I font
 ] [
 .B \-s
***************
*** 24,30 ****
 .I Fig2dev
 translates fig code in the named
 .I fig-file
! into the specified graphics
 .I language
 and puts them in
 .I out-file.
--- 24,30 ----
 .I Fig2dev
 translates fig code in the named
 .I fig-file
! into the specified graphics
 .I language
 and puts them in
 .I out-file.
***************
*** 35,43 ****
 are standard input and standard output, respectively
 .LP
 Xfig (Facility for Interactive Generation of figures) is a screen-oriented
! tool which runs under the X Window System, and
 allows the user to draw and manipulate objects interactively.
! This version of fig2dev is compatible with
 xfig versions 1.3, 1.4, 2.0, 2.1, 3.0, 3.1 and 3.2.
 .LP
 Xfig version 3.2.3 and later saves and allows the user to edit comments
--- 35,43 ----
 are standard input and standard output, respectively
 .LP
 Xfig (Facility for Interactive Generation of figures) is a screen-oriented
! tool which runs under the X Window System, and
 allows the user to draw and manipulate objects interactively.
! This version of fig2dev is compatible with
 xfig versions 1.3, 1.4, 2.0, 2.1, 3.0, 3.1 and 3.2.
 .LP
 Xfig version 3.2.3 and later saves and allows the user to edit comments
***************
*** 50,56 ****
 .B \-L
 Set the output graphics language.
 Valid languages are
! \fBbox, cgm, epic, eepic, eepicemu, eps, gif, ibmgl, jpeg,
 latex, map (HTML image map), mf (METAFONT), pcx, pdf, pic, pictex, png, ppm, ps,
 pstex, pstex_t, sld (AutoCad slide format), textyl, \fR
 tiff, tk (tcl/tk), tpic, xbm and
--- 50,56 ----
 .B \-L
 Set the output graphics language.
 Valid languages are
! \fBbox, cgm, epic, eepic, eepicemu, eps, gif, ibmgl, jpeg,
 latex, map (HTML image map), mf (METAFONT), pcx, pdf, pic, pictex, png, ppm, ps,
 pstex, pstex_t, sld (AutoCad slide format), textyl, \fR
 tiff, tk (tcl/tk), tpic, xbm and
***************
*** 70,82 ****
 .TP
 .B \-h
 Print help message with all options for all output languages.
 .TP
! .B \-m
 Set the magnification at which the figure is rendered to
 .I mag.
 The default is 1.0.
 .TP
! .B \-f
 Set the default font used for text objects to
 .I font.
 The default is Roman; the format of this option depends on the graphics
--- 70,84 ----
 .TP
 .B \-h
 Print help message with all options for all output languages.
+
 .TP
! .B "\-m mag"
 Set the magnification at which the figure is rendered to
 .I mag.
 The default is 1.0.
+
 .TP
! .B "\-f font"
 Set the default font used for text objects to
 .I font.
 The default is Roman; the format of this option depends on the graphics
***************
*** 85,99 ****
 In TeX-based languages, the font is the base of the name given in lfonts.tex,
 for instance "cmr" for Roman, or "tt" for teletype.
 In PostScript, it is any font name known to the printer or interpreter.
 .TP
! .B \-s
 Set the default font size (in points) for text objects to
 .I fsize.
 The default is 11*mag, and thus is scaled by the \fB-m\fR option.
 If there is no scaling, the default font is eleven point Roman."
 .TP
 .B \-V
 Print the program version number only.
 .TP
 .I other options
 The other options are specific to the choice of graphics
--- 87,104 ----
 In TeX-based languages, the font is the base of the name given in lfonts.tex,
 for instance "cmr" for Roman, or "tt" for teletype.
 In PostScript, it is any font name known to the printer or interpreter.
+
 .TP
! .B "\-s size"
 Set the default font size (in points) for text objects to
 .I fsize.
 The default is 11*mag, and thus is scaled by the \fB-m\fR option.
 If there is no scaling, the default font is eleven point Roman."
+
 .TP
 .B \-V
 Print the program version number only.
+
 .TP
 .I other options
 The other options are specific to the choice of graphics
***************
*** 106,120 ****
 other products can import this format
 .I and display it on the screen,
 something that they won't do with EPS files that have an ASCII preview.
 .TP
 .B \-r
 Position arrowheads for CGM viewers that display rounded arrowheads.
 Normally, arrowheads are pointed, so fig2dev compensates for this by
! moving the endpoint of the line back so the tip of the arrowhead ends
 where the original endpoint of the line was.
 If the \fB-r\fR option is used, the position
 of arrows will \fINOT\fR be corrected for compensating line width effects,
! because the rounded arrowhead doesn't extend beyond the endpoint of the line.
 .SH EPIC OPTIONS
 EPIC is an enhancement to LaTeX picture drawing environment.
 It was developed by Sunil Podar of Department of Computer Science
--- 111,126 ----
 other products can import this format
 .I and display it on the screen,
 something that they won't do with EPS files that have an ASCII preview.
+
 .TP
 .B \-r
 Position arrowheads for CGM viewers that display rounded arrowheads.
 Normally, arrowheads are pointed, so fig2dev compensates for this by
! moving the endpoint of the line back so the tip of the arrowhead ends
 where the original endpoint of the line was.
 If the \fB-r\fR option is used, the position
 of arrows will \fINOT\fR be corrected for compensating line width effects,
! because the rounded arrowhead doesn't extend beyond the endpoint of the line.
 .SH EPIC OPTIONS
 EPIC is an enhancement to LaTeX picture drawing environment.
 It was developed by Sunil Podar of Department of Computer Science
***************
*** 126,131 ****
--- 132,138 ----
 Computer Science at University of California, Davis.
 .LP
 EEPIC-EMU is an EEPIC emulation package which does not use tpic specials.
+
 .TP
 .B \-A
 Scale arrowheads by
***************
*** 138,151 ****
 double the size of
 .I TeX
 arrowheads.
 .TP
 .B \-l
! Use "\fB\\thicklines\fR" when width of the line is wider than
 .I lwidth.
 The default is 2.
 .TP
 .B \-v
 Include comments in the output file.
 .TP
 .B \-P
 Generate a complete LaTeX file. In other words, the output file can be
--- 145,161 ----
 double the size of
 .I TeX
 arrowheads.
+
 .TP
 .B \-l
! Use "\fB\\thicklines\fR" when width of the line is wider than
 .I lwidth.
 The default is 2.
+
 .TP
 .B \-v
 Include comments in the output file.
+
 .TP
 .B \-P
 Generate a complete LaTeX file. In other words, the output file can be
***************
*** 152,172 ****
 formatted without requiring any changes. The additional text inserted
 in the beginning and at the end of the file is controlled by the
 configuration parameter "Preamble" and "Postamble".
 .TP
 .B \-S
 Set the scale to which the figure is rendered.
! This option automatically sets the
 .I magnification
 and size to
 .I scale
! / 12 and
 .I scale
 respectively.
 .TP
 .B \-W
 Enable variable line width.  By default, only two line widths are
 available: The normal line width (\thinlines), and thick
! lines (\thicklines), if a line width of more than one is selected in xfig.
 .TP
 .B \-w
 Disable variable line width. Only "\fB\\thicklines\fR" and/or
--- 162,185 ----
 formatted without requiring any changes. The additional text inserted
 in the beginning and at the end of the file is controlled by the
 configuration parameter "Preamble" and "Postamble".
+
 .TP
 .B \-S
 Set the scale to which the figure is rendered.
! This option automatically sets the
 .I magnification
 and size to
 .I scale
! / 12 and
 .I scale
 respectively.
+
 .TP
 .B \-W
 Enable variable line width.  By default, only two line widths are
 available: The normal line width (\thinlines), and thick
! lines (\thicklines), if a line width of more than one is selected in xfig.
!
 .TP
 .B \-w
 Disable variable line width. Only "\fB\\thicklines\fR" and/or
***************
*** 188,200 ****
--- 201,216 ----
 .SH IBM-GL OPTIONS
 IBM-GL (International Business Machines Graphics Language) is compatible
 with HP-GL (Hewlett-Packard Graphics Language).
+
 .TP
 .B \-a
 Select ISO A4 (ANSI A) paper size if the default is ANSI A (ISO A4) paper size.
+
 .TP
 .B \-c
 Generate instructions for an IBM 6180 Color Plotter
 with (without) an IBM Graphics Enhancement Cartridge (IBM-GEC).
+
 .TP
 .B \-d
 Restrict plotting to a rectangular area of the plotter paper which has
***************
*** 205,210 ****
--- 221,227 ----
 All four numbers are in inches and follow \fB-d\fR in a comma-sparated list -
 .I xll,yll,xur,yur
 - with no spaces between them.
+
 .TP
 .B \-f
 Load text character specifications from the table in the
***************
*** 218,223 ****
--- 235,241 ----
 3.) character slant angle (degrees),
 4.) character width scale factor and
 5.) character height scale factor.
+
 .TP
 .B \-l
 Load area fill line patterns from the table in the
***************
*** 230,240 ****
--- 248,260 ----
 3.) fill type (1 - 5),
 4.) fill spacing (inches) and
 5.) fill angle (degrees).
+
 .TP
 .B \-m
 The magnification may appear as the first element in a comma separated list -
 .I mag,x0,y0
 - where the second and third parameters specify an offset in inches.
+
 .TP
 .B \-p
 Load plotter pen specifications from the table in the
***************
*** 244,257 ****
--- 264,280 ----
 Each entry consists of 2 numbers which specify the
 1.) pen number (1 - 8) and
 2.) pen thickness (millimeters).
+
 .TP
 .B \-P
 Rotate the figure to portrait mode. The default is landscape mode.
+
 .TP
 .B \-S
 Set the pen speed to
 .I speed
 (centimeters/second).
+
 .TP
 .B \-v
 Plot the figure upside-down in portrait mode or backwards in landscape mode.
***************
*** 266,280 ****
 The \fB-c\fR option selects the alternate instruction set.

 .SH OPTIONS COMMON TO ALL BITMAP FORMATS
 .TP
 .B -b borderwidth
! Make blank border around figure of width
 .I borderwidth.
 .TP
 .B -g color
 Use
 .I color
 for the background.
 .TP
 .B -S smoothfactor
 This will smooth the output by scaling the figure by the
--- 289,306 ----
 The \fB-c\fR option selects the alternate instruction set.

 .SH OPTIONS COMMON TO ALL BITMAP FORMATS
+
 .TP
 .B -b borderwidth
! Make blank border around figure of width
 .I borderwidth.
+
 .TP
 .B -g color
 Use
 .I color
 for the background.
+
 .TP
 .B -S smoothfactor
 This will smooth the output by scaling the figure by the
***************
*** 282,303 ****
 factor, which forces ghostscript to render the figure at the higher scale
 to improve font rendering, then passing through pnmscale to reduce to original size,
 which also smooths the image by averaging colors of adjacent pixels.
! A value of 2 or 3 for
 .I smoothfactor
 is reasonable.  xfig uses 2 when the "smooth" option is used in the export panel.

 .SH GIF OPTIONS
 .TP
 .B -t color
 Use
 .I color
 for the transparent color in the GIF file.  This must be specified
! as a six-digit hexadecimal RGBvalue with the # sign, e.g. #ff0000 (Red).

 .SH JPEG OPTIONS
 .TP
 .B -q image_quality
! use the integer value
 .I image_quality
 for the JPEG "Quality" factor.  Valid values are 0-100.

--- 308,332 ----
 factor, which forces ghostscript to render the figure at the higher scale
 to improve font rendering, then passing through pnmscale to reduce to original size,
 which also smooths the image by averaging colors of adjacent pixels.
! A value of 2 or 3 for
 .I smoothfactor
 is reasonable.  xfig uses 2 when the "smooth" option is used in the export panel.

 .SH GIF OPTIONS
+
 .TP
 .B -t color
 Use
 .I color
 for the transparent color in the GIF file.  This must be specified
! in the same format that ppmmake(1) allows.
! It may allow an X11 color name, but at least you may use
! a six-digit hexadecimal RGBvalue using the # sign, e.g. #ff0000 (Red).

 .SH JPEG OPTIONS
 .TP
 .B -q image_quality
! use the integer value
 .I image_quality
 for the JPEG "Quality" factor.  Valid values are 0-100.

***************
*** 305,311 ****
 .SH LATEX OPTIONS
 .TP
 .B \-l
! Sets the threshold between LaTeX thin and thick lines to
 .I lwidth
 pixels.
 LaTeX supports only two different line width: \\thinlines and \\thicklines.
--- 334,340 ----
 .SH LATEX OPTIONS
 .TP
 .B \-l
! Sets the threshold between LaTeX thin and thick lines to
 .I lwidth
 pixels.
 LaTeX supports only two different line width: \\thinlines and \\thicklines.
***************
*** 335,356 ****
 The fig2dev map output language will produce an HTML image map using Fig objects
 that have href="some_html_reference" in their comments.
 Any Fig object except compound objects may used for this.
! Usually, besides generating the map file, you would also
 generate a GIF file, which is the image to which the map refers.
 .sp
! For example, you may have an xfig drawing with an
 imported image that has the comment
 href="go_here.html" and a box object with a comment href="go_away.html".
 This will produce an image map file such the user
! may click on the image and the browser will load the "go_here.html" page,
 or click on the box and the browser will load the "go_away.html" page.
 .sp
! After the map file is generated by
 .I fig2dev
 you will need to edit it to fill out any additional information it may need.
 .TP
 .B -b borderwidth
! Make blank border around figure of width
 .I borderwidth.


--- 364,385 ----
 The fig2dev map output language will produce an HTML image map using Fig objects
 that have href="some_html_reference" in their comments.
 Any Fig object except compound objects may used for this.
! Usually, besides generating the map file, you would also
 generate a GIF file, which is the image to which the map refers.
 .sp
! For example, you may have an xfig drawing with an
 imported image that has the comment
 href="go_here.html" and a box object with a comment href="go_away.html".
 This will produce an image map file such the user
! may click on the image and the browser will load the "go_here.html" page,
 or click on the box and the browser will load the "go_away.html" page.
 .sp
! After the map file is generated by
 .I fig2dev
 you will need to edit it to fill out any additional information it may need.
 .TP
 .B -b borderwidth
! Make blank border around figure of width
 .I borderwidth.


***************
*** 359,365 ****
 scales the figure by 1/8 before generating METAFONT code.
 The magnification can be further changed with the
 .B -m
! option or by giving magnification options to
 .B mf.
 .LP
 In order to process the generated METAFONT code, the mfpic macros
--- 388,394 ----
 scales the figure by 1/8 before generating METAFONT code.
 The magnification can be further changed with the
 .B -m
! option or by giving magnification options to
 .B mf.
 .LP
 In order to process the generated METAFONT code, the mfpic macros
***************
*** 380,386 ****
 original figure. The default is 1.
 .TP
 .B -t top
! specifies the top of the whole coordinate system. The default is
 .B ypos.
 .TP
 .B -x xneg
--- 409,415 ----
 original figure. The default is 1.
 .TP
 .B -t top
! specifies the top of the whole coordinate system. The default is
 .B ypos.
 .TP
 .B -x xneg
***************
*** 389,395 ****
 .TP
 .B -y yneg
 specifies the minumum y coordinate value of the figure (inches). The
! default is 0.
 .TP
 .B -X xpos
 specifies the maximum x coordinate value of the figure (inches). The
--- 418,424 ----
 .TP
 .B -y yneg
 specifies the minumum y coordinate value of the figure (inches). The
! default is 0.
 .TP
 .B -X xpos
 specifies the maximum x coordinate value of the figure (inches). The
***************
*** 417,423 ****
 .br
 \fBall\fR     Use all of the above
 .br
! \fBpsfont\fR  Don't convert Postscript fonts generic type
       (useful for files going to be Ditroff'ed for
       and printed on PS printer). DWB-compatible.
 .br
--- 446,452 ----
 .br
 \fBall\fR     Use all of the above
 .br
! \fBpsfont\fR  Don't convert Postscript fonts generic type
       (useful for files going to be Ditroff'ed for
       and printed on PS printer). DWB-compatible.
 .br
***************
*** 456,464 ****
 o The centering option is ignored
 .br
 o The multiple-page option is ignored
! .br
 o The paper size option is ignored
! .br
 o The x/y offset options are ignored
 .LP
 The PDF driver uses all the PostScript options.
--- 485,493 ----
 o The centering option is ignored
 .br
 o The multiple-page option is ignored
! .br
 o The paper size option is ignored
! .br
 o The x/y offset options are ignored
 .LP
 The PDF driver uses all the PostScript options.
***************
*** 480,490 ****
 Filled objects are printed using the given area fill and color.
 There are 21 "shades" going from black to full saturation of the fill color,
 and 21 more "tints" from full saturation + 1 to white.
! In addition, there are 16 patterns such as bricks, diagonal lines,
 crosshatch, etc.
 .TP
 .B -b borderwidth
! Make blank border around figure of width
 .I borderwidth.
 .TP
 .B -c
--- 509,519 ----
 Filled objects are printed using the given area fill and color.
 There are 21 "shades" going from black to full saturation of the fill color,
 and 21 more "tints" from full saturation + 1 to white.
! In addition, there are 16 patterns such as bricks, diagonal lines,
 crosshatch, etc.
 .TP
 .B -b borderwidth
! Make blank border around figure of width
 .I borderwidth.
 .TP
 .B -c
***************
*** 507,515 ****
 This option will override the orientation specification in the
 file (for file versions 3.0 and higher).
 .br
! This option is only honored when not using the -P option (add showpage).
! This is because the figure doesn't need to be rotated when generating
! Encapsulated PostScript (EPS).
 .TP
 .B -M
 Generate multiple pages if figure exceeds paper size.
--- 536,545 ----
 This option will override the orientation specification in the
 file (for file versions 3.0 and higher).
 .br
! This and the -p (portrait) option are only honored only for PostScript output,
! not Encapsulated PostScript (EPS).
! This is because the figure doesn't need to be rotated when generating (EPS);
! it may be rotated by the program importing the EPS.
 .TP
 .B -M
 Generate multiple pages if figure exceeds paper size.
***************
*** 521,533 ****
 file (for file versions 3.0 and higher).
 This is the default for Fig files of version 2.1 or lower.
 .TP
- .B -P
- indicates that the figure describes a full page which will not
- necessarily be inserted into a document, but can be sent directly
- to a PS printer.
- This ensures that a showpage command is inserted at the end of
- the figure.
- .TP
 .B -n name
 Set the Title part of the PostScript output to
 .I name.
--- 551,556 ----
***************
*** 659,666 ****
 documentation for any purpose is hereby granted without fee, provided that
 the above copyright notice appear in all copies and that both that
 copyright notice and this permission notice appear in supporting
! documentation. The authors make no representations about the suitability
! of this software for any purpose.  It is provided "as is" without express
 or implied warranty.
 .LP
 THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
--- 682,689 ----
 documentation for any purpose is hereby granted without fee, provided that
 the above copyright notice appear in all copies and that both that
 copyright notice and this permission notice appear in supporting
! documentation. The authors make no representations about the suitability
! of this software for any purpose.  It is provided "as is" without express
 or implied warranty.
 .LP
 THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
***************
*** 695,701 ****
 .br
 Supoj Sutanthavibul ([email protected])
 .br
! University of Texas at Austin.
 .sp
 MetaFont driver by
 .br
--- 718,724 ----
 .br
 Supoj Sutanthavibul ([email protected])
 .br
! University of Texas at Austin.
 .sp
 MetaFont driver by
 .br
***************
*** 717,722 ****
 .br
 Mike Markowski ([email protected]) with a little touch-up by Brian Smith
 .sp
! The CGM driver (Computer Graphics Metafile) was written by
 .br
 Philippe Bekaert ([email protected])
--- 740,745 ----
 .br
 Mike Markowski ([email protected]) with a little touch-up by Brian Smith
 .sp
! The CGM driver (Computer Graphics Metafile) was written by
 .br
 Philippe Bekaert ([email protected])
diff -rc transfig.3.2.3/doc/manual/README transfig.3.2.3b/doc/manual/README
*** transfig.3.2.3/doc/manual/README    Thu Apr 27 16:21:43 1995
--- transfig.3.2.3b/doc/manual/README   Fri Jul 14 10:26:13 2000
***************
*** 1,6 ****
! PLEASE NOTE:  This guide has not been updated to the current 3.1 file
! protocol.  Please refer to the xfig document FORMAT3.1 for a complete
! description.

 This directory contains a manual which describes TransFig and how to use it.
 The manual includes TransFig figures, which have been translated into
--- 1,4 ----
! PLEASE NOTE:  This guide is hopelessly out of date.

 This directory contains a manual which describes TransFig and how to use it.
 The manual includes TransFig figures, which have been translated into
diff -rc transfig.3.2.3/doc/transfig.1 transfig.3.2.3b/doc/transfig.1
*** transfig.3.2.3/doc/transfig.1       Thu Jan 13 19:51:33 2000
--- transfig.3.2.3b/doc/transfig.1      Fri Jul 14 10:20:28 2000
***************
*** 1,4 ****
! .TH TRANSFIG 1 "Version 3.2.3 Jan 14, 2000"
 .SH NAME
 transfig \- creates a makefile for portable LaTeX figures
 .SH SYNOPSIS
--- 1,4 ----
! .TH TRANSFIG 1 "Version 3.2.3b July 19, 2000"
 .SH NAME
 transfig \- creates a makefile for portable LaTeX figures
 .SH SYNOPSIS
diff -rc transfig.3.2.3/fig2dev/Imakefile transfig.3.2.3b/fig2dev/Imakefile
*** transfig.3.2.3/fig2dev/Imakefile    Fri Apr  7 10:29:10 2000
--- transfig.3.2.3b/fig2dev/Imakefile   Tue Jul 11 15:23:44 2000
***************
*** 24,51 ****
 XCOMM copies from any such party to do so, with the only requirement being
 XCOMM that this copyright notice remain intact.

 XCOMM You should point XFIGLIBDIR to the same directory you did when you compiled
 XCOMM and installed xfig.  This will be made automatic in the future.

 XFIGLIBDIR =  /usr/local/lib/X11/xfig

 XCOMM If your system has the strerror() function (doesn't have sys_errlist) then
 XCOMM comment out NEED_STRERROR with an XCOMM comment.

 NEED_STRERROR = -DNEED_STRERROR

! XCOMM uncomment the following line if your compiler supports
 XCOMM inline functions. With the "INLINE" keyword, you should notice that
 XCOMM the display will be a bit faster in complex figures

 XCOMM USEINLINE = -DUSE_INLINE

 XCOMM Change RGB if necessary, to point to your rgb.txt color database
 XCOMM file (for X11).  This is needed for the -g (background color) option.
 XCOMM

! RGB = $(LIBDIR)/rgb

 XCOMM Unomment the #define for USEXPM if you want to use the XPM
 XCOMM (color pixmap) package.
 XCOMM You need version 3.4c or newer of the XPM package.
--- 24,64 ----
 XCOMM copies from any such party to do so, with the only requirement being
 XCOMM that this copyright notice remain intact.

+ XCOMM ******
 XCOMM You should point XFIGLIBDIR to the same directory you did when you compiled
 XCOMM and installed xfig.  This will be made automatic in the future.

 XFIGLIBDIR =  /usr/local/lib/X11/xfig

+ XCOMM ******
 XCOMM If your system has the strerror() function (doesn't have sys_errlist) then
 XCOMM comment out NEED_STRERROR with an XCOMM comment.

 NEED_STRERROR = -DNEED_STRERROR

! XCOMM The following probably only applies to Windows 9x/NT:
! XCOMM If your system can open files in text and binary modes and has the
! XCOMM setmode() function, uncomment HAVE_SETMODE
!
! XCOMM HAVE_SETMODE = -DHAVE_SETMODE
!
! XCOMM ****************
! XCOMM Uncomment the following line if your compiler supports
 XCOMM inline functions. With the "INLINE" keyword, you should notice that
 XCOMM the display will be a bit faster in complex figures

 XCOMM USEINLINE = -DUSE_INLINE

+ XCOMM ****************
 XCOMM Change RGB if necessary, to point to your rgb.txt color database
 XCOMM file (for X11).  This is needed for the -g (background color) option.
+ XCOMM Note that this changed slightly from the previous versions - you need
+ XCOMM the full name (rgb.txt) now.
 XCOMM

! RGB = $(LIBDIR)/rgb.txt

+ XCOMM ****************
 XCOMM Unomment the #define for USEXPM if you want to use the XPM
 XCOMM (color pixmap) package.
 XCOMM You need version 3.4c or newer of the XPM package.
***************
*** 61,86 ****
 XPMINC = -I/usr/include/X11
 #endif

! XCOMM For Linux machines or any machines that have a separate library for
! XCOMM the database management routines, uncomment the following line.
! XCOMM For the Redhat distributions of Linux you may have to change DBMLIB to -ldb.
! XCOMM For other Linux versions you may need -ldbm instead of -lgdbm.
! XCOMM Slackware and RedHat Linuxes use -lgdbm.
!
! XCOMM DBMLIB = -lgdbm
!
! XCOMM If your system doesn't have ndbm ("New" database manager) comment the following
! USE_NDBM = -DNDBM
!
 XCOMM If don't want to use JPEG, comment out the following line

 #define USEJPEG

! XCOMM If you don't have the jpeg library in your system library area, comment
! XCOMM out the USEINSTALLEDJPEG variable (using XCOMM), change the JPEGLIBDIR
! XCOMM variable to the directory where your jpeg library resides. Do not change
! XCOMM JPEGINCDIR in this case because it must be defined relative to the
! XCOMM fig2dev/dev subdirectory.
 XCOMM You must have version 5b or newer of the jpeg library.

 #define USEINSTALLEDJPEG
--- 74,90 ----
 XPMINC = -I/usr/include/X11
 #endif

! XCOMM ****************
 XCOMM If don't want to use JPEG, comment out the following line

 #define USEJPEG

! XCOMM ****************
! XCOMM If you don't have the jpeg library in your system library area (meaning
! XCOMM that it must be compiled first), comment out the USEINSTALLEDJPEG variable
! XCOMM (using XCOMM), change the JPEGLIBDIR variable to the directory where your
! XCOMM jpeg library resides and change the JPEGINCDIR to the directory where your
! XCOMM jpeg header files (include) reside.
 XCOMM You must have version 5b or newer of the jpeg library.

 #define USEINSTALLEDJPEG
***************
*** 95,109 ****
 #endif
 #endif /* USEJPEG */

! XCOMM uncomment the following to set paper size to A4
 XCOMM DDA4 = -DA4

! XCOMM uncomment the following to set IBM Graphics Enhancement Cartridge
 XCOMM DDIBMGEC = -DIBMGEC

! XCOMM comment out the DDNFSS = ... line if you don't want NFSS2 font selection
 XCOMM for LaTeX texts
! XCOMM comment out the DDLATEX2E_GRAPHICS = ... line if you don't want to use the
 XCOMM standard graphics package distributed w/ LaTeX2e
 XCOMM UNcomment the DDEPSFIG = ... line if you want to use the deprecated epsfig macros
 XCOMM distributed w/ LaTeX2e (DDLATEX2E_GRAPHICS must also be defined)
--- 99,116 ----
 #endif
 #endif /* USEJPEG */

! XCOMM ****************
! XCOMM Uncomment the following to set paper size to A4
 XCOMM DDA4 = -DA4

! XCOMM ****************
! XCOMM Uncomment the following to set IBM Graphics Enhancement Cartridge
 XCOMM DDIBMGEC = -DIBMGEC

! XCOMM ****************
! XCOMM Comment out the DDNFSS = ... line if you don't want NFSS2 font selection
 XCOMM for LaTeX texts
! XCOMM Comment out the DDLATEX2E_GRAPHICS = ... line if you don't want to use the
 XCOMM standard graphics package distributed w/ LaTeX2e
 XCOMM UNcomment the DDEPSFIG = ... line if you want to use the deprecated epsfig macros
 XCOMM distributed w/ LaTeX2e (DDLATEX2E_GRAPHICS must also be defined)
***************
*** 116,130 ****
 DDLATEX2E_GRAPHICS = -DLATEX2E_GRAPHICS
 XCOMM DDEPSFIG = -DEPSFIG

! XCOMM comment out the DDDVIPS to NOT use dvips for the DVI-to-PostScript driver
 DDDVIPS = -DDVIPS

 XCOMM If your system doesn't have strcasecmp and/or strncasecmp
! XCOMM undefine the following two definitions

 XCOMM HAVE_NO_STRCASECMP = -DHAVE_NO_STRCASECMP
 XCOMM HAVE_NO_STRNCASECMP = -DHAVE_NO_STRNCASECMP

 XCOMM Uncomment the next line if you want use Japanese (i18n) on xfig.

 XCOMM #define I18N
--- 123,144 ----
 DDLATEX2E_GRAPHICS = -DLATEX2E_GRAPHICS
 XCOMM DDEPSFIG = -DEPSFIG

! XCOMM ****************
! XCOMM Comment out the DDDVIPS to NOT use dvips for the DVI-to-PostScript driver
 DDDVIPS = -DDVIPS

+ XCOMM ****************
 XCOMM If your system doesn't have strcasecmp and/or strncasecmp
! XCOMM uncomment the following two definitions

 XCOMM HAVE_NO_STRCASECMP = -DHAVE_NO_STRCASECMP
 XCOMM HAVE_NO_STRNCASECMP = -DHAVE_NO_STRNCASECMP

+ XCOMM ****************
+ XCOMM If your system doesn't have strstr() then uncomment the following line
+ XCOMM #define NOSTRSTR
+
+ XCOMM ****************
 XCOMM Uncomment the next line if you want use Japanese (i18n) on xfig.

 XCOMM #define I18N
***************
*** 132,149 ****
 #ifdef I18N
 I18N_DEFS = -DI18N
 FIG2DEV_LIBDIR = /usr/local/lib/fig2dev
! I18N_DEV_DEFS = $(I18N_DEFS) -DFIG2DEV_LIBDIR='\"/usr/local/lib/fig2dev\"'

 install::
!       [ -d $(FIG2DEV_LIBDIR) ] || mkdir $(FIG2DEV_LIBDIR)
!       $(INSTALL) -c dev/japanese.ps $(FIG2DEV_LIBDIR)
!       ( cd $(FIG2DEV_LIBDIR); \
         rm -f ja.ps ja_JP.ps ja_JP.ujis.ps ja_JP.eucJP.ps ja_JP.EUC.ps; \
         ln -s japanese.ps ja.ps; ln -s japanese.ps ja_JP.ps; \
         ln -s japanese.ps ja_JP.ujis.ps; ln -s japanese.ps ja_JP.eucJP.ps; \
         ln -s japanese.ps ja_JP.EUC.ps )
!       $(INSTALL) -c  dev/korean.ps $(FIG2DEV_LIBDIR)
!       ( cd $(FIG2DEV_LIBDIR); \
         rm -f ko.ps ko_KR.ps ko_KR.ujis.ps ko_KR.eucKR.ps ko_KR.EUC.ps; \
         ln -s korean.ps ko.ps; ln -s korean.ps ko_KR.ps; \
         ln -s korean.ps ko_KR.ujis.ps; ln -s korean.ps ko_KR.eucKR.ps; \
--- 146,163 ----
 #ifdef I18N
 I18N_DEFS = -DI18N
 FIG2DEV_LIBDIR = /usr/local/lib/fig2dev
! I18N_DEV_DEFS = $(I18N_DEFS) -DFIG2DEV_LIBDIR=\\\"$(DESTDIR)$(FIG2DEV_LIBDIR)\\\"

 install::
!       [ -d $(DESTDIR)$(FIG2DEV_LIBDIR) ] || mkdir $(DESTDIR)$(FIG2DEV_LIBDIR)
!       $(INSTALL) -c dev/japanese.ps $(DESTDIR)$(FIG2DEV_LIBDIR)
!       ( cd $(DESTDIR)$(FIG2DEV_LIBDIR); \
         rm -f ja.ps ja_JP.ps ja_JP.ujis.ps ja_JP.eucJP.ps ja_JP.EUC.ps; \
         ln -s japanese.ps ja.ps; ln -s japanese.ps ja_JP.ps; \
         ln -s japanese.ps ja_JP.ujis.ps; ln -s japanese.ps ja_JP.eucJP.ps; \
         ln -s japanese.ps ja_JP.EUC.ps )
!       $(INSTALL) -c  dev/korean.ps $(DESTDIR)$(FIG2DEV_LIBDIR)
!       ( cd $(DESTDIR)$(FIG2DEV_LIBDIR); \
         rm -f ko.ps ko_KR.ps ko_KR.ujis.ps ko_KR.eucKR.ps ko_KR.EUC.ps; \
         ln -s korean.ps ko.ps; ln -s korean.ps ko_KR.ps; \
         ln -s korean.ps ko_KR.ujis.ps; ln -s korean.ps ko_KR.eucKR.ps; \
***************
*** 151,166 ****
 #endif

 DEFINES = $(NEED_STRERROR) $(HAVE_NO_STRCASECMP) $(HAVE_NO_STRNCASECMP) $(USEINLINE) \
!       $(I18N_DEFS)

- XCOMM If your system doesn't have strstr() then uncomment the following line
- XCOMM #define NOSTRSTR

 XCOMM **************************************************************
 XCOMM *** You shouldn't have to change anything below this point ***
 XCOMM **************************************************************

! DIR_DEFS=     -DBITMAPDIR=\\\"$(XFIGLIBDIR)/bitmaps\\\"

 #ifdef USEXPM
 DUSEXPM = -DUSE_XPM
--- 165,178 ----
 #endif

 DEFINES = $(NEED_STRERROR) $(HAVE_NO_STRCASECMP) $(HAVE_NO_STRNCASECMP) $(USEINLINE) \
!       $(I18N_DEFS) $(HAVE_SETMODE)


 XCOMM **************************************************************
 XCOMM *** You shouldn't have to change anything below this point ***
 XCOMM **************************************************************

! DIR_DEFS=     -DBITMAPDIR=\\\"$(DESTDIR)$(XFIGLIBDIR)/bitmaps\\\"

 #ifdef USEXPM
 DUSEXPM = -DUSE_XPM
***************
*** 173,197 ****
 #endif

 #ifdef USEJPEG
-
 DUSEJPEG = -DUSE_JPEG

 #ifdef USEINSTALLEDJPEG
- JPEGLIBDIR = /usr/local/lib
 JPEGLIB = -L$(JPEGLIBDIR) -ljpeg
 #else
- XCOMM this is relative to this directory (transfig/fig2dev)
- JPEGLIBDIR = ../../jpeg-6a
 JPEGCONF = configure
 JPEGLIB = $(JPEGLIBDIR)/libjpeg.a
 DEPLIBJPEG = $(JPEGLIBDIR)/libjpeg.a
! #endif        /* USEINSTALLEDJPEG */

 #endif /* USEJPEG */

 IMAKE_DEFINES = $(DUSEJPEG) $(DUSEXPM)

! DEVDEFINES = $(DUSEJPEG) $(DUSEXPM) $(XPMINC) $(DDNFSS) $(DDA4) \
               $(DDLATEX2E_GRAPHICS) $(DDEPSFIG) $(DDIBMGEC) $(DDDVIPS) $(I18N_DEV_DEFS)

 #define IHaveSubdirs
--- 185,206 ----
 #endif

 #ifdef USEJPEG
 DUSEJPEG = -DUSE_JPEG
+ JPEGINC = -I$(JPEGINCDIR)

 #ifdef USEINSTALLEDJPEG
 JPEGLIB = -L$(JPEGLIBDIR) -ljpeg
 #else
 JPEGCONF = configure
 JPEGLIB = $(JPEGLIBDIR)/libjpeg.a
 DEPLIBJPEG = $(JPEGLIBDIR)/libjpeg.a
! #endif /* USEINSTALLEDJPEG */

 #endif /* USEJPEG */

 IMAKE_DEFINES = $(DUSEJPEG) $(DUSEXPM)

! DEVDEFINES = $(DUSEJPEG) $(DUSEXPM) $(XPMINC) $(JPEGINC) $(DDNFSS) $(DDA4) \
               $(DDLATEX2E_GRAPHICS) $(DDEPSFIG) $(DDIBMGEC) $(DDDVIPS) $(I18N_DEV_DEFS)

 #define IHaveSubdirs
***************
*** 207,215 ****

 LOCAL_LIBRARIES = $(LIBTRANSFIG) $(JPEGLIB)
 #if defined(NetBSDArchitecture) || defined(FreeBSDArchitecture)
! SYS_LIBRARIES = $(XPMLIBS) $(DBMLIB) -lm -lcompat
 #else
! SYS_LIBRARIES = $(XPMLIBS) $(DBMLIB) -lm
 #endif
 DEPLIBS = $(LIBTRANSFIG)

--- 216,224 ----

 LOCAL_LIBRARIES = $(LIBTRANSFIG) $(JPEGLIB)
 #if defined(NetBSDArchitecture) || defined(FreeBSDArchitecture)
! SYS_LIBRARIES = $(XPMLIBS) -lm -lcompat
 #else
! SYS_LIBRARIES = $(XPMLIBS) -lm
 #endif
 DEPLIBS = $(LIBTRANSFIG)

***************
*** 225,234 ****

 fig2dev: $(DEPLIBJPEG) $(DEPLIBS)

- RGBDBM = $(USE_NDBM)
 RGBFILE = -DRGB_FILE=\"$(RGB)\"
! SpecialObjectRule(colors.o, , $(RGBFILE) $(RGBDBM))
! SpecialObjectRule(fig2dev.o, fig2dev.c ../patchlevel.h, )

 XCOMM only compile our jpeg if the use doesn't have one installed

--- 234,242 ----

 fig2dev: $(DEPLIBJPEG) $(DEPLIBS)

 RGBFILE = -DRGB_FILE=\"$(RGB)\"
! SpecialObjectRule(colors.o, Imakefile , $(RGBFILE))
! SpecialObjectRule(fig2dev.o, fig2dev.c drivers.h ../patchlevel.h, )

 XCOMM only compile our jpeg if the use doesn't have one installed

***************
*** 243,254 ****
 #endif

 $(LIBTRANSFIG)::
!       cd $(DEVDIR); $(MAKE) JPEGINCDIR=$(JPEGINCDIR) \
!               DEFINES="$(DEVDEFINES) $(DIR_DEFS)" libtransfig.a

- PROGRAM = fig2dev
- AllTarget(fig2dev)
- MakeSubdirs($(SUBDIRS))
 DependSubdirs($(SUBDIRS))

 ComplexProgramTarget(fig2dev)
--- 251,258 ----
 #endif

 $(LIBTRANSFIG)::
!       cd $(DEVDIR); $(MAKE) DEFINES="$(DEVDEFINES) $(DIR_DEFS)" libtransfig.a

 DependSubdirs($(SUBDIRS))

 ComplexProgramTarget(fig2dev)
***************
*** 258,268 ****
 XCOMM Install the tk bitmaps here
 install::
       @(cd bitmaps ; \
!       if [ -d $(XFIGLIBDIR)/bitmaps ]; then set +x; \
!       else (set -x; $(MKDIRHIER) $(XFIGLIBDIR)/bitmaps ); fi ; \
!       echo Copying bitmap files for tk to $(XFIGLIBDIR)/bitmaps ; \
       for f in * ; do \
!             $(INSTALL) -c $$f $(XFIGLIBDIR)/bitmaps ; \
       done) ;

 InstallScript(fig2ps2tex,$(BINDIR))
--- 262,272 ----
 XCOMM Install the tk bitmaps here
 install::
       @(cd bitmaps ; \
!       if [ -d $(DESTDIR)$(XFIGLIBDIR)/bitmaps ]; then set +x; \
!       else (set -x; $(MKDIRHIER) $(DESTDIR)$(XFIGLIBDIR)/bitmaps ); fi ; \
!       echo Copying bitmap files for tk to $(DESTDIR)$(XFIGLIBDIR)/bitmaps ; \
       for f in * ; do \
!             $(INSTALL) -c $$f $(DESTDIR)$(XFIGLIBDIR)/bitmaps ; \
       done) ;

 InstallScript(fig2ps2tex,$(BINDIR))
***************
*** 273,283 ****
--- 277,290 ----
 InstallManPage(pic2tpic,$(MANDIR))

 fig2dev.man:: ../doc/fig2dev.1
+       $(RM) fig2dev.man
       -ln -s ../doc/fig2dev.1 fig2dev.man

 fig2ps2tex.man:: ../doc/fig2ps2tex.1
+       $(RM) fig2ps2tex.man
       -ln -s ../doc/fig2ps2tex.1 fig2ps2tex.man

 pic2tpic.man:: ../doc/pic2tpic.1
+       $(RM) pic2tpic.man
       -ln -s ../doc/pic2tpic.1 pic2tpic.man

diff -rc transfig.3.2.3/fig2dev/bound.c transfig.3.2.3b/fig2dev/bound.c
*** transfig.3.2.3/fig2dev/bound.c      Thu Dec  9 10:53:03 1999
--- transfig.3.2.3b/fig2dev/bound.c     Mon May  1 14:16:39 2000
***************
*** 26,31 ****
--- 26,32 ----
  */

 #include "fig2dev.h"
+ #include "figure.h"
 #include "object.h"

 #define               Ninety_deg              M_PI_2
***************
*** 36,41 ****
--- 37,104 ----
 #define               max(a, b)               (((a) > (b)) ? (a) : (b))
 #define               min(a, b)               (((a) < (b)) ? (a) : (b))

+ static double compute_angle();
+
+ /************** ARRAY FOR ARROW SHAPES **************/
+
+ struct _fpnt {
+               double x,y;
+       };
+
+ struct _arrow_shape {
+               int numpts;
+               int tipno;
+               double tipmv;
+               struct _fpnt points[6];
+       };
+
+ #define NUM_ARROW_TYPES 21
+ static struct _arrow_shape arrow_shapes[NUM_ARROW_TYPES+1] = {
+                  /* number of points, index of tip, {datapairs} */
+                  /* first point must be upper-left point of tail, then tip */
+
+                  /* type 0 */
+                  { 3, 1, 2.15, {{-1,0.5}, {0,0}, {-1,-0.5}}},
+                  /* place holder for what would be type 0 filled */
+                  { 0 },
+                  /* type 1 simple triangle */
+                  { 4, 1, 2.1, {{-1.0,0.5}, {0,0}, {-1.0,-0.5}, {-1.0,0.5}}},
+                  /* type 1 filled simple triangle*/
+                  { 4, 1, 2.1, {{-1.0,0.5}, {0,0}, {-1.0,-0.5}, {-1.0,0.5}}},
+                  /* type 2 concave spearhead */
+                  { 5, 1, 2.6, {{-1.25,0.5},{0,0},{-1.25,-0.5},{-1.0,0},{-1.25,0.5}}},
+                  /* type 2 filled concave spearhead */
+                  { 5, 1, 2.6, {{-1.25,0.5},{0,0},{-1.25,-0.5},{-1.0,0},{-1.25,0.5}}},
+                  /* type 3 convex spearhead */
+                  { 5, 1, 1.5, {{-0.75,0.5},{0,0},{-0.75,-0.5},{-1.0,0},{-0.75,0.5}}},
+                  /* type 3 filled convex spearhead */
+                  { 5, 1, 1.5, {{-0.75,0.5},{0,0},{-0.75,-0.5},{-1.0,0},{-0.75,0.5}}},
+                  /* type 4 diamond */
+                  { 5, 1, 1.15, {{-0.5,0.5},{0,0},{-0.5,-0.5},{-1.0,0},{-0.5,0.5}}},
+                  /* type 4 filled diamond */
+                  { 5, 1, 1.15, {{-0.5,0.5},{0,0},{-0.5,-0.5},{-1.0,0},{-0.5,0.5}}},
+                  /* type 5 circle - handled in code */
+                  { 0, 0, 0.0 }, { 0, 0, 0.0 },
+                  /* type 6 half circle - handled in code */
+                  { 0, 0, -1.0 }, { 0, 0, -1.0 },
+                  /* type 7 square */
+                  { 5, 1, 0.0, {{-1.0,0.5},{0,0.5},{0,-0.5},{-1.0,-0.5},{-1.0,0.5}}},
+                  /* type 7 filled square */
+                  { 5, 1, 0.0, {{-1.0,0.5},{0,0.5},{0,-0.5},{-1.0,-0.5},{-1.0,0.5}}},
+                  /* type 8 reverse triangle */
+                  { 4, 1, 0.0, {{-1.0,0},{0,0.5},{0,-0.5},{-1.0,0}}},
+                  /* type 8 filled reverse triangle */
+                  { 4, 1, 0.0, {{-1.0,0},{0,0.5},{0,-0.5},{-1.0,0}}},
+                  /* type 9a "wye" */
+                  { 3, 0, -1.0, {{0,0.5},{-1.0,0},{0,-0.5}}},
+                  /* type 9b bar */
+                  { 2, 1, 0.0, {{0,0.5},{0,-0.5}}},
+                  /* type 10a two-prong fork */
+                  { 4, 0, -1.0, {{0,0.5},{-1.0,0.5},{-1.0,-0.5},{0,-0.5}}},
+                  /* type 10b backward two-prong fork */
+                  { 4, 1, 0.0, {{-1.0,0.5,},{0,0.5},{0,-0.5},{-1.0,-0.5}}},
+               };
+
 arc_bound(arc, xmin, ymin, xmax, ymax)
 F_arc *arc;
 int   *xmin, *ymin, *xmax, *ymax;
***************
*** 122,143 ****
       *ymin = sy;
       *xmax = bx;
       *ymax = by;
       }

 compound_bound(compound, xmin, ymin, xmax, ymax, include)
! F_compound    *compound;
! int           *xmin, *ymin, *xmax, *ymax;
! int           include;
! {
!       F_arc           *a;
!       F_ellipse       *e;
!       F_compound      *c;
!       F_spline        *s;
!       F_line          *l;
!       F_text          *t;
!       int             bx, by, sx, sy, first = 1;
!       int             llx, lly, urx, ury;
!       int             half_wd;

     llx = lly =  1000000;
     urx = ury = -1000000;
--- 185,209 ----
       *ymin = sy;
       *xmax = bx;
       *ymax = by;
+
+       /* now add in the arrow (if any) boundaries */
+       arrow_bound(O_ARC, (F_line *)arc, xmin, ymin, xmax, ymax);
       }

 compound_bound(compound, xmin, ymin, xmax, ymax, include)
!     F_compound        *compound;
!     int               *xmin, *ymin, *xmax, *ymax;
!     int                include;
! {
!     F_arc     *a;
!     F_ellipse *e;
!     F_compound        *c;
!     F_spline  *s;
!     F_line    *l;
!     F_text    *t;
!     int                bx, by, sx, sy, first = 1;
!     int                llx, lly, urx, ury;
!     int                half_wd;

     llx = lly =  1000000;
     urx = ury = -1000000;
***************
*** 315,321 ****
 int   *xmin, *ymin, *xmax, *ymax;
 {
       points_bound(l->points, xmin, ymin, xmax, ymax);
!       }

 spline_bound(s, xmin, ymin, xmax, ymax)
 F_spline      *s;
--- 381,391 ----
 int   *xmin, *ymin, *xmax, *ymax;
 {
       points_bound(l->points, xmin, ymin, xmax, ymax);
!       /* now add in the arrow (if any) boundaries but
!          only if the line has two or more points */
!       if (l->points->next)
!           arrow_bound(O_POLYLINE, l, xmin, ymin, xmax, ymax);
! }

 spline_bound(s, xmin, ymin, xmax, ymax)
 F_spline      *s;
***************
*** 327,333 ****
       else {
           normal_spline_bound(s, xmin, ymin, xmax, ymax);
           }
!       }

 int_spline_bound(s, xmin, ymin, xmax, ymax)
 F_spline      *s;
--- 397,405 ----
       else {
           normal_spline_bound(s, xmin, ymin, xmax, ymax);
           }
!       /* now do any arrows */
!       arrow_bound(O_SPLINE, s, xmin, ymin, xmax, ymax);
! }

 int_spline_bound(s, xmin, ymin, xmax, ymax)
 F_spline      *s;
***************
*** 373,379 ****
       *ymin = round(sy);
       *xmax = round(bx);
       *ymax = round(by);
!       }

 normal_spline_bound(s, xmin, ymin, xmax, ymax)
 F_spline      *s;
--- 445,451 ----
       *ymin = round(sy);
       *xmax = round(bx);
       *ymax = round(by);
! }

 normal_spline_bound(s, xmin, ymin, xmax, ymax)
 F_spline      *s;
***************
*** 422,469 ****
           *xmax = ceil (max(bx, x2) );
           *ymax = ceil (max(by, y2) );
           }
!       }

 double rot_x(x,y,angle)
! double x,y,angle;
 {
     return(x*cos(-angle)-y*sin(-angle));
 }

 double rot_y(x,y,angle)
! double x,y,angle;
 {
!  return(x*sin(-angle)+y*cos(-angle));
 }


! text_bound(t, xmin, ymin, xmax, ymax, include)
! F_text        *t;
! int   *xmin, *ymin, *xmax, *ymax;
! int   include;
 {
!       double dx1, dx2, dx3, dx4, dy1, dy2, dy3, dy4;
!       int descend;
!       descend = (strchr(t->cstring,'g') || strchr(t->cstring,'j') ||
                 strchr(t->cstring,'p') || strchr(t->cstring,'q') ||
                 strchr(t->cstring,'y'));
!       /* characters have some extent downside */
!       if (t->type == T_CENTER_JUSTIFIED) {
!           dx1 = (include?  (t->length/1.95) : 0.0);   dy1 =  0.0;
!           dx2 = (include? -(t->length/1.95) : 0.0);   dy2 =  0.0;
!           dx3 = (include?  (t->length/1.95) : 0.0);   dy3 = -t->height;
!           dx4 = (include? -(t->length/1.95) : 0.0);   dy4 = -t->height;
!       } else if (t->type == T_RIGHT_JUSTIFIED) {
!           dx1 = 0.0;                                  dy1 =  0.0;
!           dx2 = (include? -t->length*1.0256 : 0.0);   dy2 =  0.0;
!           dx3 = 0.0;                                  dy3 = -t->height;
!           dx4 = (include? -t->length*1.0256 : 0.0);   dy4 = -t->height;
!       } else {
!           dx1 = (include ? t->length*1.0256 : 0.0);   dy1 =  0.0;
!           dx2 = 0.0;                                  dy2 =  0.0;
!           dx3 = (include ? t->length*1.0256 : 0.0);   dy3 = -t->height;
!           dx4 = 0.0;                                  dy4 = -t->height;
!       }
     if (descend) {
       dy1 = 0.3*t->height;
       dy2 = 0.3*t->height;
--- 494,543 ----
           *xmax = ceil (max(bx, x2) );
           *ymax = ceil (max(by, y2) );
           }
! }

 double rot_x(x,y,angle)
!     double    x,y,angle;
 {
     return(x*cos(-angle)-y*sin(-angle));
 }

 double rot_y(x,y,angle)
!     double    x,y,angle;
 {
!     return(x*sin(-angle)+y*cos(-angle));
 }


! text_bound(t, xmin, ymin, xmax, ymax, inc_text)
!     F_text    *t;
!     int               *xmin, *ymin, *xmax, *ymax;
!     int                inc_text;
 {
!     double     dx1, dx2, dx3, dx4, dy1, dy2, dy3, dy4;
!     int                descend;
!
!     Boolean include = (inc_text && ((t->flags & SPECIAL_TEXT)==0));
!     descend = (strchr(t->cstring,'g') || strchr(t->cstring,'j') ||
                 strchr(t->cstring,'p') || strchr(t->cstring,'q') ||
                 strchr(t->cstring,'y'));
!     /* characters have some extent downside */
!     if (t->type == T_CENTER_JUSTIFIED) {
!       dx1 = (include?  (t->length/1.95) : 0.0);       dy1 =  0.0;
!       dx2 = (include? -(t->length/1.95) : 0.0);       dy2 =  0.0;
!       dx3 = (include?  (t->length/1.95) : 0.0);       dy3 = -t->height;
!       dx4 = (include? -(t->length/1.95) : 0.0);       dy4 = -t->height;
!     } else if (t->type == T_RIGHT_JUSTIFIED) {
!       dx1 = 0.0;                                      dy1 =  0.0;
!       dx2 = (include? -t->length*1.0256 : 0.0);       dy2 =  0.0;
!       dx3 = 0.0;                                      dy3 = -t->height;
!       dx4 = (include? -t->length*1.0256 : 0.0);       dy4 = -t->height;
!     } else {
!       dx1 = (include ? t->length*1.0256 : 0.0);       dy1 =  0.0;
!       dx2 = 0.0;                                      dy2 =  0.0;
!       dx3 = (include ? t->length*1.0256 : 0.0);       dy3 = -t->height;
!       dx4 = 0.0;                                      dy4 = -t->height;
!     }
     if (descend) {
       dy1 = 0.3*t->height;
       dy2 = 0.3*t->height;
***************
*** 484,494 ****
     *ymin= t->base_y +
            min( min( rot_y(dx1,dy1,t->angle), rot_y(dx2,dy2,t->angle) ),
               min( rot_y(dx3,dy3,t->angle), rot_y(dx4,dy4,t->angle) ) );
!       }

 points_bound(points, xmin, ymin, xmax, ymax)
! F_point       *points;
! int   *xmin, *ymin, *xmax, *ymax;
 {
       int     bx, by, sx, sy;
       F_point *p;
--- 558,568 ----
     *ymin= t->base_y +
            min( min( rot_y(dx1,dy1,t->angle), rot_y(dx2,dy2,t->angle) ),
               min( rot_y(dx3,dy3,t->angle), rot_y(dx4,dy4,t->angle) ) );
! }

 points_bound(points, xmin, ymin, xmax, ymax)
!     F_point   *points;
!     int               *xmin, *ymin, *xmax, *ymax;
 {
       int     bx, by, sx, sy;
       F_point *p;
***************
*** 500,510 ****
           }
       *xmin = sx; *ymin = sy;
       *xmax = bx; *ymax = by;
!       }

 control_points_bound(cps, xmin, ymin, xmax, ymax)
! F_control     *cps;
! int           *xmin, *ymin, *xmax, *ymax;
 {
       F_control       *c;
       double          bx, by, sx, sy;
--- 574,584 ----
           }
       *xmin = sx; *ymin = sy;
       *xmax = bx; *ymax = by;
! }

 control_points_bound(cps, xmin, ymin, xmax, ymax)
!     F_control *cps;
!     int               *xmin, *ymin, *xmax, *ymax;
 {
       F_control       *c;
       double          bx, by, sx, sy;
***************
*** 521,524 ****
           }
       *xmin = round(sx); *ymin = round(sy);
       *xmax = round(bx); *ymax = round(by);
!       }
--- 595,954 ----
           }
       *xmin = round(sx); *ymin = round(sy);
       *xmax = round(bx); *ymax = round(by);
! }
!
! /* extend xmin, ymin xmax, ymax by the arrow boundaries of obj (if any) */
!
! arrow_bound(objtype, obj, xmin, ymin, xmax, ymax)
!     int                   objtype;
!     F_line       *obj;
!     int                  *xmin, *ymin, *xmax, *ymax;
! {
!     int                   fxmin, fymin, fxmax, fymax;
!     int                   bxmin, bymin, bxmax, bymax;
!     F_point      *p, *q;
!     F_arc        *a;
!     int                   p1x, p1y, p2x, p2y;
!     int                   dum;
!     int                   npts, i;
!     Point         arrowpts[50];
!
!     if (obj->for_arrow) {
!       if (objtype == O_ARC) {
!           a = (F_arc *) obj;
!           compute_arcarrow_angle(a->center.x, a->center.y,
!                       (double)a->point[2].x, (double)a->point[2].y,
!                       a->direction, a->for_arrow, &p1x, &p1y);
!           p2x = a->point[2].x;        /* forward tip */
!           p2y = a->point[2].y;
!       } else {
!           /* this doesn't work very well for a spline with few points
!               and lots of curvature */
!           /* locate last point (forward tip) and next-to-last point */
!           for (p = obj->points; p->next; p = p->next)
!               q = p;
!           p1x = q->x;
!           p1y = q->y;
!           p2x = p->x;
!           p2y = p->y;
!       }
!       calc_arrow(p1x, p1y, p2x, p2y, &dum, &dum, &dum, &dum,
!                       obj->for_arrow, arrowpts, &npts, &dum);
!       fxmin=fymin=100000;
!       fxmax=fymax=-100000;
!       for (i=0; i<npts; i++) {
!           fxmin = min2(fxmin, arrowpts[i].x);
!           fymin = min2(fymin, arrowpts[i].y);
!           fxmax = max2(fxmax, arrowpts[i].x);
!           fymax = max2(fymax, arrowpts[i].y);
!       }
!       *xmin = min2(*xmin, fxmin);
!       *xmax = max2(*xmax, fxmax);
!       *ymin = min2(*ymin, fymin);
!       *ymax = max2(*ymax, fymax);
!     }
!     if (obj->back_arrow) {
!       if (objtype == O_ARC) {
!           a = (F_arc *) obj;
!           compute_arcarrow_angle(a->center.x, a->center.y,
!                       (double) a->point[0].x, (double) a->point[0].y,
!                       a->direction ^ 1, a->back_arrow, &p1x, &p1y);
!           p2x = a->point[0].x;        /* backward tip */
!           p2y = a->point[0].y;
!       } else {
!           p1x = obj->points->next->x; /* second point */
!           p1y = obj->points->next->y;
!           p2x = obj->points->x;       /* first point (forward tip) */
!           p2y = obj->points->y;
!       }
!       calc_arrow(p1x, p1y, p2x, p2y, &dum, &dum, &dum, &dum,
!                       obj->back_arrow, arrowpts, &npts, &dum);
!       bxmin=bymin=100000;
!       bxmax=bymax=-100000;
!       for (i=0; i<npts; i++) {
!           bxmin = min2(bxmin, arrowpts[i].x);
!           bymin = min2(bymin, arrowpts[i].y);
!           bxmax = max2(bxmax, arrowpts[i].x);
!           bymax = max2(bymax, arrowpts[i].y);
!       }
!       *xmin = min2(*xmin, bxmin);
!       *xmax = max2(*xmax, bxmax);
!       *ymin = min2(*ymin, bymin);
!       *ymax = max2(*ymax, bymax);
!     }
! }
!
! /****************************************************************
!
!  calc_arrow - calculate points heading from (x1, y1) to (x2, y2)
!
!  Must pass POINTER to npoints for return value and for c1x, c1y,
!  c2x, c2y, which are two points at the end of the arrowhead so:
!
!               |\     + (c1x,c1y)
!               |  \
!               |    \
!  ---------------|      \
!               |      /
!               |    /
!               |  /
!               |/     + (c2x,c2y)
!
!
!  Fills points array with npoints arrowhead coordinates
!
! ****************************************************************/
!
! calc_arrow(x1, y1, x2, y2, c1x, c1y, c2x, c2y, arrow, points, npoints, nboundpts)
!     int                   x1, y1, x2, y2;
!     int                  *c1x, *c1y, *c2x, *c2y;
!     F_arrow      *arrow;
!     Point         points[];
!     int                  *npoints, *nboundpts;
! {
!     double        x, y, xb, yb, dx, dy, l, sina, cosa;
!     double        mx, my;
!     double        ddx, ddy, lpt, tipmv;
!     double        alpha;
!     double        miny, maxy;
!     double        thick;
!     int                   xa, ya, xs, ys;
!     double        xt, yt;
!     float         wd = arrow->wid;
!     float         ht = arrow->ht;
!     int                   type, style, indx;
!     int                   i, np;
!
!     /* types = 0...10 */
!     type = arrow->type;
!     /* style = 0 (unfilled) or 1 (filled) */
!     style = arrow->style;
!     /* index into shape array */
!     indx = 2*type + style;
!
!     *npoints = 0;
!     *nboundpts = 0;
!     dx = x2 - x1;
!     dy = y1 - y2;
!     if (dx==0 && dy==0)
!       return;
!
!     /* lpt is the amount the arrowhead extends beyond the end of the
!        line because of the sharp point (miter join) */
!
!     tipmv = arrow_shapes[indx].tipmv;
!     lpt = 0.0;
!     /* lines are made a little thinner in set_linewidth */
!     thick = (arrow->thickness <= THICK_SCALE) ?
!               0.5* arrow->thickness :
!               arrow->thickness - THICK_SCALE;
!     if (tipmv > 0.0)
!         lpt = thick / (2.0 * sin(atan(wd / (tipmv * ht))));
!     else if (tipmv == 0.0)
!       lpt = thick / 3.0;       /* types which have blunt end */
!     /* (Don't adjust those with tipmv < 0) */
!
!     /* alpha is the angle the line is relative to horizontal */
!     alpha = atan2(dy,-dx);
!
!     /* ddx, ddy is amount to move end of line back so that arrowhead point
!        ends where line used to */
!     ddx = lpt * cos(alpha);
!     ddy = lpt * sin(alpha);
!
!     /* move endpoint of line back */
!     mx = x2 + ddx;
!     my = y2 + ddy;
!
!     l = sqrt(dx * dx + dy * dy);
!     sina = dy / l;
!     cosa = dx / l;
!     xb = mx * cosa - my * sina;
!     yb = mx * sina + my * cosa;
!
!     /* (xa,ya) is the rotated endpoint */
!     xa =  xb * cosa + yb * sina + 0.5;
!     ya = -xb * sina + yb * cosa + 0.5;
!
!     /*
!      * We approximate circles with an octagon since, at small sizes,
!      * this is sufficient.  I haven't bothered to alter the bounding
!      * box calculations.
!      */
!     miny =  100000.0;
!     maxy = -100000.0;
!     if (type == 5 || type == 6) {     /* also include half circle */
!       double rmag;
!       double angle, init_angle, rads;
!       double fix_x, fix_y;
!
!       /* get angle of line */
!       init_angle = compute_angle(dx,dy);
!
!       /* (xs,ys) is a point the length (height) of the arrowhead BACK from
!          the end of the shaft */
!       /* for the half circle, use 0.0 */
!       xs =  (xb-(type==5? ht: 0.0)) * cosa + yb * sina + 0.5;
!       ys = -(xb-(type==5? ht: 0.0)) * sina + yb * cosa + 0.5;
!
!       /* calc new (dx, dy) from moved endpoint to (xs, ys) */
!       dx = mx - xs;
!       dy = my - ys;
!       /* radius */
!       rmag = ht/2.0;
!       fix_x = xs + (dx / (double) 2.0);
!       fix_y = ys + (dy / (double) 2.0);
!       /* choose number of points for circle - 20+mag/4 points */
!       np = round(mag/4.0) + 20;
!       /* full or half circle? */
!       rads = (type==5? M_2PI: M_PI);
!
!       if (type == 5) {
!           init_angle = 5.0*M_PI_2 - init_angle;
!           /* np/2 points in the forward part of the circle for the line clip area */
!           *nboundpts = np/2;
!           /* full circle */
!           rads = M_2PI;
!       } else {
!           init_angle = 3.0*M_PI_2 - init_angle;
!           /* no points in the line clip area */
!           *nboundpts = 0;
!           /* half circle */
!           rads = M_PI;
!       }
!       /* draw the half or full circle */
!       for (i = 0; i < np; i++) {
!           if (type == 5)
!               angle = init_angle - (rads * (double) i / (double) np);
!           else
!               angle = init_angle - (rads * (double) i / (double) (np-1));
!           x = fix_x + round(rmag * cos(angle));
!           points[*npoints].x = x;
!           y = fix_y + round(rmag * sin(angle));
!           points[*npoints].y = y;
!           miny = min2(y, miny);
!           maxy = max2(y, maxy);
!           (*npoints)++;
!       }
!       x = 2.0*THICK_SCALE;
!       y = rmag;
!       xt =  x*cosa + y*sina + x2;
!       yt = -x*sina + y*cosa + y2;
!       *c1x = xt;
!       *c1y = yt;
!       y = -rmag;
!       xt =  x*cosa + y*sina + x2;
!       yt = -x*sina + y*cosa + y2;
!       *c2x = xt;
!       *c2y = yt;
!     } else {
!       /* 3 points in the arrowhead that define the line clip part */
!       *nboundpts = 3;
!       np = arrow_shapes[indx].numpts;
!       for (i=0; i<np; i++) {
!           x = arrow_shapes[indx].points[i].x * ht;
!           y = arrow_shapes[indx].points[i].y * wd;
!           miny = min2(y, miny);
!           maxy = max2(y, maxy);
!           xt =  x*cosa + y*sina + xa;
!           yt = -x*sina + y*cosa + ya;
!           points[*npoints].x = xt;
!           points[*npoints].y = yt;
!           (*npoints)++;
!       }
!       x = arrow_shapes[indx].points[arrow_shapes[indx].tipno].x * ht + THICK_SCALE;
!       y = maxy;
!       xt =  x*cosa + y*sina + x2;
!       yt = -x*sina + y*cosa + y2;
!       *c1x = xt;
!       *c1y = yt;
!       y = miny;
!       xt =  x*cosa + y*sina + x2;
!       yt = -x*sina + y*cosa + y2;
!       *c2x = xt;
!       *c2y = yt;
!     }
! }
!
! /********************* COMPUTE ANGLE ************************
!
! Input arguments :
!       (dx,dy) : the vector (0,0)(dx,dy)
! Output arguments : none
! Return value : the angle of the vector in the range [0, 2PI)
!
! *************************************************************/
!
! double
! compute_angle(dx, dy)         /* compute the angle between 0 to 2PI  */
!     double        dx, dy;
! {
!     double        alpha;
!
!     if (dx == 0) {
!       if (dy > 0)
!           alpha = M_PI_2;
!       else
!           alpha = 3 * M_PI_2;
!     } else if (dy == 0) {
!       if (dx > 0)
!           alpha = 0;
!       else
!           alpha = M_PI;
!     } else {
!       alpha = atan(dy / dx);  /* range = -PI/2 to PI/2 */
!       if (dx < 0)
!           alpha += M_PI;
!       else if (dy < 0)
!           alpha += M_2PI;
!     }
!     return (alpha);
! }
!
! /* Computes a point on a line which is a chord to the arc specified by */
! /* center (x1,y1) and endpoint (x2,y2), where the chord intersects the */
! /* arc arrow->ht from the endpoint.                                    */
! /* May give strange values if the arrow.ht is larger than about 1/4 of */
! /* the circumference of a circle on which the arc lies.                */
!
! compute_arcarrow_angle(x1, y1, x2, y2, direction, arrow, x, y)
!     double     x1, y1;
!     double     x2, y2;
!     int                direction;
!     F_arrow   *arrow;
!     int               *x, *y;
! {
!     double     r, alpha, beta, dy, dx;
!     double     lpt,h;
!     double     thick;
!
!     dy=y2-y1;
!     dx=x2-x1;
!     r=sqrt(dx*dx+dy*dy);
!     h = (double) arrow->ht;
!     /* lines are made a little thinner in set_linewidth */
!     thick = (arrow->thickness <= THICK_SCALE) ?
!               0.5* arrow->thickness :
!               arrow->thickness - THICK_SCALE;
!     /* lpt is the amount the arrowhead extends beyond the end of the line */
!     lpt = thick/2.0/(arrow->wid/h/2.0);
!     /* add this to the length */
!     h += lpt;
!
!     /* radius too small for this method, use normal method */
!     if (h > 2.0*r) {
!       arc_tangent(x1,y1,x2,y2,direction,x,y);
!       return;
!     }
!
!     beta=atan2(dy,dx);
!     if (direction) {
!       alpha = 2*asin(h/2.0/r);
!     } else {
!       alpha = -2*asin(h/2.0/r);
!     }
!
!     *x=round(x1+r*cos(beta+alpha));
!     *y=round(y1+r*sin(beta+alpha));
! }
!
diff -rc transfig.3.2.3/fig2dev/colors.c transfig.3.2.3b/fig2dev/colors.c
*** transfig.3.2.3/fig2dev/colors.c     Wed Nov 24 14:29:25 1999
--- transfig.3.2.3b/fig2dev/colors.c    Tue May 30 11:30:59 2000
***************
*** 17,64 ****

 #include "fig2dev.h"

! #ifdef NDBM
! #include <ndbm.h>
! #else
! #ifdef SVR4
! #include <rpcsvc/dbm.h>
! #else
! #include <dbm.h>
! #endif
! #endif
!
! #ifdef NDBM
! DBM *rgb_dbm = (DBM *)NULL;
! #else
! int rgb_dbm = 0;
! #endif

-
- /* initialize the X11 RGB color database file */
-
- init_colordb()
- {
-
- #ifdef NDBM
-       rgb_dbm = dbm_open(RGB_FILE, 0, 0);
- #else
-       if (dbminit(RGB_FILE) == 0)
-           rgb_dbm = 1;
- #endif
-       return 0;
- }
-
 int
! lookup_db_color(name, rgb)
   char *name;
   RGB  *rgb;
 {
!     datum     dbent;
!     int               j, n;
!     int               r,g,b;
!     char      rgb_txt[PATH_MAX];
!     char      s[100], s1[100];
!     FILE      *fp;

     if (name[0] == '#') {                     /* hex color parse it now */
       if (strlen(name) == 4) {                /* #rgb */
--- 17,49 ----

 #include "fig2dev.h"

! struct color_db {
!     char *name;
!     int   red, green, blue;
! };
!
! struct        color_db *Xcolors;
! int   numXcolors, maxcolors;
! Boolean       have_read_X_colors = False;

 int
! lookup_X_color(name, rgb)
   char *name;
   RGB  *rgb;
 {
!     int               i, n;
!     int               r, g, b;
!     struct color_db *col;
!
!     /* read the X color database file if we haven't done that yet */
!     if (!have_read_X_colors) {
!       if (read_colordb() != 0) {
!           /* error reading color database, return black */
!           rgb->red = rgb->green = rgb->blue = 0;
!           return -1;
!       }
!       have_read_X_colors = True;
!     }

     if (name[0] == '#') {                     /* hex color parse it now */
       if (strlen(name) == 4) {                /* #rgb */
***************
*** 82,135 ****
               rgb->green = g;
               rgb->blue  = b;
       }
!       if (n != 3) {
!           rgb->red=rgb->green=rgb->blue=0;
!           return -1;
       }
     } else {
!       /* make colorname all lower case */
!       for (j=strlen(name); j>=0; j--) {
!           if (isupper(name[j]))
!               name[j]=tolower(name[j]);
!       }
!       if (rgb_dbm) {
!           dbent.dptr = name;
!           dbent.dsize = strlen(name);
!           /* look it up to get the rgb values */
! #ifdef NDBM
!           dbent = dbm_fetch(rgb_dbm, dbent);
! #else
!           dbent = fetch (dbent);
! #endif
!           if(dbent.dptr) {
!               memcpy((char *) rgb, dbent.dptr, sizeof (RGB));
!           } else {
!               rgb->red=rgb->green=rgb->blue=0;
!               return -1;
           }
!       } else {  /* no DBM file;  try to read rgb.txt */
!           sprintf(rgb_txt, "%s.txt", RGB_FILE);
!           fp = fopen(rgb_txt, "r");
!           if (fp == NULL) {
!             fprintf(stderr,"Couldn't open the RGB database file '%s'\n", rgb_txt);
             return -1;
!           } else {
!             while (fgets(s, sizeof(s), fp)) {
!               if (sscanf(s, "%d %d %d %s", &r, &g, &b, s1) == 4) {
!                 if (strcasecmp(name, s1) == 0) {
!                   rgb->red = r << 8;
!                   rgb->green = g << 8;
!                   rgb->blue = b << 8;
!                   fclose(fp);
!                   return 0;
!                 }
               }
-             }
-             fclose(fp);
-             rgb->red=rgb->green=rgb->blue=0;
-             return -1;
           }
       }
     }
     return 0;
 }
--- 67,141 ----
               rgb->green = g;
               rgb->blue  = b;
       }
!       if (n == 3) {
!           /* ok */
!           return 0;
       }
     } else {
!       /* named color, look in the database we read in */
!       for (col = Xcolors, i=0; i<numXcolors; col++, i++) {
!           if (strcasecmp(col->name, name) == 0) {
!               /* found it */
!               rgb->red = col->red;
!               rgb->green = col->green;
!               rgb->blue = col->blue;
!               return 0;
           }
!       }
!     }
!     /* not found or bad #rgb spec, set to black */
!     rgb->red = rgb->green = rgb->blue = 0;
!     return -1;
! }
!
! /* read the X11 RGB color database (ASCII .txt) file */
!
! read_colordb()
! {
!     FILE      *fp;
!     char      s[100], s1[100], *c1, *c2;
!     int               r,g,b;
!     struct color_db *col;
!
!     fp = fopen(RGB_FILE, "r");
!     if (fp == NULL) {
!       fprintf(stderr,"Couldn't open the RGB database file '%s'\n", RGB_FILE);
!       return -1;
!     }
!     numXcolors = 0;
!     maxcolors = 400;
!     if ((Xcolors = (struct color_db*) malloc(maxcolors*sizeof(struct color_db))) == NULL) {
!       fprintf(stderr,"Couldn't allocate space for the RGB database file\n");
!       return -1;
!     }
!
!     while (fgets(s, sizeof(s), fp)) {
!       if (numXcolors >= maxcolors) {
!           maxcolors += 500;
!           if ((Xcolors = (struct color_db*) realloc(Xcolors, maxcolors*sizeof(struct color_db))) == NULL) {
!             fprintf(stderr,"Couldn't allocate space for the RGB database file\n");
             return -1;
!           }
!       }
!       if (sscanf(s, "%d %d %d %[^\n]", &r, &g, &b, s1) == 4) {
!           /* remove any white space from the color name */
!           for (c1=s1, c2=s1; *c2; c2++) {
!               if (*c2 != ' ' && *c2 != '\t') {
!                  *c1 = *c2;
!                  c1++;
               }
           }
+           *c1 = '\0';
+           col = (Xcolors+numXcolors);
+           col->red = r << 8;
+           col->green = g << 8;
+           col->blue = b << 8;
+           col->name = malloc(strlen(s1)+1);
+           strcpy(col->name, s1);
+           numXcolors++;
       }
     }
+     fclose(fp);
     return 0;
 }
+
diff -rc transfig.3.2.3/fig2dev/dev/Imakefile transfig.3.2.3b/fig2dev/dev/Imakefile
*** transfig.3.2.3/fig2dev/dev/Imakefile        Wed Jan  5 10:30:09 2000
--- transfig.3.2.3b/fig2dev/dev/Imakefile       Tue Jul 11 14:47:31 2000
***************
*** 22,32 ****
 XCOMM the party supplying this software to the X Consortium.

 INCLUDES = -I.. -I../..
- #ifdef JPEGINCDIR
- JPEGINC = -I$(JPEGINCDIR)
- #endif
-
- EXTRA_INCLUDES = $(JPEGINC)

 #ifdef USE_XPM
 READXPMS=readxpm.c
--- 22,27 ----
diff -rc transfig.3.2.3/fig2dev/dev/genbitmaps.c transfig.3.2.3b/fig2dev/dev/genbitmaps.c
*** transfig.3.2.3/fig2dev/dev/genbitmaps.c     Mon Jan  3 09:50:47 2000
--- transfig.3.2.3b/fig2dev/dev/genbitmaps.c    Tue Jul 11 15:16:14 2000
***************
*** 35,66 ****
 #include "object.h"
 #include "texfonts.h"

! extern void
!       genps_arc(),
!       genps_ellipse(),
!       genps_line(),
!       genps_spline(),
!       genps_text();
!
! static char gscom[1000],*gsdev,tmpname[PATH_MAX];
! Boolean       direct;
! FILE  *saveofile;
! char  *ofile;
! int   width,height;
! int   jpeg_quality=75;
! static        int     border_margin = 0;
! static        int     smooth = 1;
! static        int     debug = 0;

 void
- gs_broken_pipe(int sig)
- {
-   fprintf(stderr,"fig2dev: broken pipe (GhostScript aborted?)\n");
-   fprintf(stderr,"command was: %s\n", gscom);
-   exit(1);
- }
-
- void
 genbitmaps_option(opt, optarg)
 char opt;
 char *optarg;
--- 35,50 ----
 #include "object.h"
 #include "texfonts.h"

! static        char     *gsdev,tmpname[PATH_MAX];
! static        Boolean  direct;
! static        FILE    *saveofile;
! static        char    *ofile;
! static        int      width,height;
! static        int      jpeg_quality=75;
! static        int      border_margin = 0;
! static        int      smooth = 0;

 void
 genbitmaps_option(opt, optarg)
 char opt;
 char *optarg;
***************
*** 72,78 ****
           break;

       case 'g':                       /* background color (handled in postscript gen) */
!           if (lookup_db_color(optarg,&background) >= 0) {
               bgspec = True;
           } else {
               fprintf(stderr,"Can't parse color '%s', ignoring background option\n",
--- 56,62 ----
           break;

       case 'g':                       /* background color (handled in postscript gen) */
!           if (lookup_X_color(optarg,&background) >= 0) {
               bgspec = True;
           } else {
               fprintf(stderr,"Can't parse color '%s', ignoring background option\n",
***************
*** 95,102 ****

       case 'S':                       /* smoothing factor */
           sscanf(optarg,"%d",&smooth);
!           if (smooth < 1) {
!               fprintf(stderr,"fig2dev: bad value for -S option: %s\n", optarg);
               exit(1);
           }
           break;
--- 79,88 ----

       case 'S':                       /* smoothing factor */
           sscanf(optarg,"%d",&smooth);
!           if (smooth != 0 && smooth != 1 && smooth != 2 && smooth != 4) {
!               fprintf(stderr,
!                       "fig2dev: bad value for -S option: %s, should be 0, 2 or 4\n",
!                       optarg);
               exit(1);
           }
           break;
***************
*** 128,152 ****
     ury += bd;

     /* make command for ghostscript */
!     width=round(mag*smooth*(urx-llx)/THICK_SCALE);
!     height=round(mag*smooth*(ury-lly)/THICK_SCALE);

     /* Add conditionals here if gs has a driver built-in */
     /* gs has a driver for png, ppm, pcx, jpeg and tiff */

     direct = True;
!     ofile = to;
     extra_options[0]='\0';

     gsdev = NULL;
     /* if we're smoothing, we'll generate magnified ppm then convert it later */
!     if (smooth == 1) {
!       if (strcmp(lang,"png")==0) {
!           gsdev="png16m";
!       } else if (strcmp(lang,"pcx")==0) {
           gsdev="pcx256";
       } else if (strcmp(lang,"ppm")==0) {
           gsdev="ppmraw";
       } else if (strcmp(lang,"tiff")==0) {
           /* use the 24-bit - unfortunately, it doesn't use compression */
           gsdev="tiff24nc";
--- 114,138 ----
     ury += bd;

     /* make command for ghostscript */
!
!     width=round(mag*(urx-llx)/THICK_SCALE);
!     height=round(mag*(ury-lly)/THICK_SCALE);

     /* Add conditionals here if gs has a driver built-in */
     /* gs has a driver for png, ppm, pcx, jpeg and tiff */

     direct = True;
!     ofile = (to == NULL? "-": to);
     extra_options[0]='\0';

     gsdev = NULL;
     /* if we're smoothing, we'll generate magnified ppm then convert it later */
!       if (strcmp(lang,"pcx")==0) {
           gsdev="pcx256";
       } else if (strcmp(lang,"ppm")==0) {
           gsdev="ppmraw";
+       } else if (strcmp(lang,"png")==0) {
+           gsdev="png16m";
       } else if (strcmp(lang,"tiff")==0) {
           /* use the 24-bit - unfortunately, it doesn't use compression */
           gsdev="tiff24nc";
***************
*** 153,172 ****
       } else if (strcmp(lang,"jpeg")==0) {
           gsdev="jpeg";
           /* set quality for JPEG */
!           sprintf(extra_options,"-dJPEGQ=%d",jpeg_quality);
       }
     }
     /* no driver in gs or we're smoothing, use ppm output then use ppmtoxxx later */
     if (gsdev == NULL) {
       gsdev="ppmraw";
!       /* make a unique name for the temporary ppm file */
!       sprintf(tmpname,"%s/f2d%d.ppm",TMPDIR,getpid());
!       ofile = tmpname;
!       direct = False;
     }
     /* make up the command for gs */
!     sprintf(gscom, "gs -q -dSAFER -sDEVICE=%s -r%d -g%dx%d -sOutputFile=%s %s -",
!                  gsdev, 80 * smooth, width, height, ofile, extra_options);
     /* divert output from ps driver to the pipe into ghostscript */
     /* but first close the output file that main() opened */
     saveofile = tfp;
--- 139,163 ----
       } else if (strcmp(lang,"jpeg")==0) {
           gsdev="jpeg";
           /* set quality for JPEG */
!           sprintf(extra_options," -dJPEGQ=%d",jpeg_quality);
       }
+     if (smooth > 1) {
+       sprintf(extra_options+strlen(extra_options),
+             " -dTextAlphaBits=%d -dGraphicsAlphaBits=%d",smooth,smooth);
     }
     /* no driver in gs or we're smoothing, use ppm output then use ppmtoxxx later */
     if (gsdev == NULL) {
       gsdev="ppmraw";
!       if (smooth > 1 || strcmp(lang,"ppm")) {
!           /* make a unique name for the temporary ppm file */
!           sprintf(tmpname,"%s/f2d%d.ppm",TMPDIR,getpid());
!           ofile = tmpname;
!           direct = False;
!       }
     }
     /* make up the command for gs */
!     sprintf(gscom, "gs -q -dSAFER -sDEVICE=%s -r%d -g%dx%d -sOutputFile=%s%s -",
!                  gsdev, 80, width, height, ofile, extra_options);
     /* divert output from ps driver to the pipe into ghostscript */
     /* but first close the output file that main() opened */
     saveofile = tfp;
***************
*** 213,224 ****
       /* and pipe through the ppm converter for that format */
       if (!direct) {
           tmpname1 = tmpname;
!           if (smooth == 1) {
!               strcpy(com, "(");
!           } else {
!               sprintf(com, "(pnmscale %f %s | ", 1.0 / smooth, tmpname);
!               tmpname1 = "";
!           }
           if (strcmp(lang, "gif")==0) {
               if (gif_transparent[0]) {
                   /* escape the first char of the transparent color (#) for the shell */
--- 204,210 ----
       /* and pipe through the ppm converter for that format */
       if (!direct) {
           tmpname1 = tmpname;
!           strcpy(com, "(");
           if (strcmp(lang, "gif")==0) {
               if (gif_transparent[0]) {
                   /* escape the first char of the transparent color (#) for the shell */
***************
*** 228,234 ****
                   sprintf(com1,"ppmquant 256 %s | ppmtogif",tmpname1);
               }
           } else if (strcmp(lang, "jpeg")==0) {
!               sprintf(com1, "cjpeg -quality %d %s", jpeg_quality, tmpname1);
           } else if (strcmp(lang, "xbm")==0) {
               sprintf(com1,"ppmtopgm %s | pgmtopbm | pbmtoxbm",tmpname1);
           } else if (strcmp(lang, "xpm")==0) {
--- 214,221 ----
                   sprintf(com1,"ppmquant 256 %s | ppmtogif",tmpname1);
               }
           } else if (strcmp(lang, "jpeg")==0) {
!               /*sprintf(com1, "cjpeg -quality %d %s", jpeg_quality, tmpname1);*/
!               sprintf(com1, "ppmtojpeg --quality=%d %s", jpeg_quality, tmpname1);
           } else if (strcmp(lang, "xbm")==0) {
               sprintf(com1,"ppmtopgm %s | pgmtopbm | pbmtoxbm",tmpname1);
           } else if (strcmp(lang, "xpm")==0) {
***************
*** 237,246 ****
               sprintf(com1,"ppmtoacad %s",tmpname1);
           } else if (strcmp(lang, "pcx")==0) {
               sprintf(com1, "ppmtopcx %s", tmpname1);
           } else if (strcmp(lang, "png")==0) {
               sprintf(com1, "pnmtopng %s", tmpname1);
-           } else if (strcmp(lang, "ppm")==0) {
-               sprintf(com1, "cat %s", tmpname1);
           } else if (strcmp(lang, "tiff")==0) {
               sprintf(com1, "pnmtotiff %s", tmpname1);
           } else {
--- 224,233 ----
               sprintf(com1,"ppmtoacad %s",tmpname1);
           } else if (strcmp(lang, "pcx")==0) {
               sprintf(com1, "ppmtopcx %s", tmpname1);
+           } else if (strcmp(lang, "ppm")==0) {
+               com1[0] = '\0';                         /* nothing to do for ppm */
           } else if (strcmp(lang, "png")==0) {
               sprintf(com1, "pnmtopng %s", tmpname1);
           } else if (strcmp(lang, "tiff")==0) {
               sprintf(com1, "pnmtotiff %s", tmpname1);
           } else {
***************
*** 261,268 ****
           /* make a unique name for an error file */
           sprintf(errfname,"%s/f2d%d.err",TMPDIR,getpid());

-           if (debug)
-               fprintf(stderr,"Calling: %s\n",com);
           /* send all messages to error file */
           strcat(com," 2> ");
           strcat(com,errfname);
--- 248,253 ----
***************
*** 282,288 ****
               fprintf(stderr,"Command used:\n  %s\n",com);
               fprintf(stderr,"Messages resulting:\n");
               if (errfile == 0)
!                   fprintf(stderr,"can't opern error file %s\n",errfname);
               else {
                   while (!feof(errfile)) {
                       if (fgets(com, sizeof(com)-1, errfile) == NULL)
--- 267,273 ----
               fprintf(stderr,"Command used:\n  %s\n",com);
               fprintf(stderr,"Messages resulting:\n");
               if (errfile == 0)
!                   fprintf(stderr,"can't open error file %s\n",errfname);
               else {
                   while (!feof(errfile)) {
                       if (fgets(com, sizeof(com)-1, errfile) == NULL)
diff -rc transfig.3.2.3/fig2dev/dev/genbox.c transfig.3.2.3b/fig2dev/dev/genbox.c
*** transfig.3.2.3/fig2dev/dev/genbox.c Wed Nov 24 14:30:43 1999
--- transfig.3.2.3b/fig2dev/dev/genbox.c        Tue Jul 11 14:49:51 2000
***************
*** 42,54 ****
 void genbox_start(objects)
 F_compound    *objects;
 {
-       double ppi;
-
-       if (0 == (ppi = (double)objects->nwcorner.x)) {
-           fprintf(stderr, "Resolution is zero!! default to 80 ppi\n");
-           ppi = 80.0;
-           }
-
       /* draw box */
         fprintf(tfp, "\\makebox[%.3fin]{\\rule{0in}{%.3fin}}\n",
               (urx-llx)*mag/ppi, (ury-lly)*mag/ppi);
--- 42,47 ----
diff -rc transfig.3.2.3/fig2dev/dev/gencgm.c transfig.3.2.3b/fig2dev/dev/gencgm.c
*** transfig.3.2.3/fig2dev/dev/gencgm.c Wed Dec 22 13:02:54 1999
--- transfig.3.2.3b/fig2dev/dev/gencgm.c        Tue Jul 11 14:50:22 2000
***************
*** 74,80 ****
                                * see fillshade() and conv_color(). */
 #define EPSILON               1e-4    /* small floating point value */

- static int Ypointsdown;               /* True for Y axis pointing downward */
 static int rounded_arrows;    /* If rounded_arrows is False, the position
                                * of arrows will be corrected for
                                * compensating line width effects. This
--- 74,79 ----
***************
*** 82,89 ****
                                * rounded with the used CGM viewer.
                                * See -r driver command line option. */

- static float scale;           /* scale factor for fonts */
-
 static struct _rgb {
   float r, g, b;
 }
--- 81,86 ----
***************
*** 137,144 ****
   int i;
   char *p, *figname = malloc(strlen(from)+1);

-   scale = (double) objects->nwcorner.x;
-
   sprintf(figname, from);
   p = strrchr(figname, '/');
   if (p)
--- 134,139 ----
***************
*** 147,154 ****
   if (p)
     *p = '\0';                        /* discard extension */

-   Ypointsdown = (objects->nwcorner.y == 2);
-
   fprintf(tfp, "BEGMF '%s';\n", figname);
   fprintf(tfp, "mfversion 1;\n");
   fprintf(tfp, "mfdesc 'Converted from %s using fig2dev -Lcgm';\n", from);
--- 142,147 ----
***************
*** 266,275 ****
    int        x;
    int        y;
 {
-   if (Ypointsdown)
     fprintf(tfp, "(%d,%d)", x-llx, ury-y);
-   else
-     fprintf(tfp, "(%d,%d)", x-llx, y-lly);
 }

 /* only reverses y if Y axis points down (relative position) */
--- 259,265 ----
***************
*** 278,287 ****
    int        x;
    int        y;
 {
-   if (Ypointsdown)
     fprintf(tfp, "(%d,%d)", x, -y);
-   else
-     fprintf(tfp, "(%d,%d)", x, y);
 }

 static void
--- 268,274 ----
***************
*** 962,977 ****
   fprintf(tfp, "arcctr ");
   _pos(cx, cy);
   fprintf(tfp, " ");
!   if (Ypointsdown) {
!     /* reverse direction */
!     _relpos(x2, y2);
!     fprintf(tfp, " ");
!     _relpos(x1, y1);
!   } else {
!     _relpos(x1, y1);
!     fprintf(tfp, " ");
!     _relpos(x2, y2);
!   }
   fprintf(tfp, " %d;\n", r);
 }

--- 949,957 ----
   fprintf(tfp, "arcctr ");
   _pos(cx, cy);
   fprintf(tfp, " ");
!   _relpos(x2, y2);
!   fprintf(tfp, " ");
!   _relpos(x1, y1);
   fprintf(tfp, " %d;\n", r);
 }

***************
*** 1211,1217 ****
       x2 = a->point[2].x - a->point[1].x,
       y2 = a->point[2].y - a->point[1].y;

!   return Ypointsdown ? (icprod(x1,y1,x2,y2) > 0) : (icprod(x1,y1,x2,y2) < 0);
 }

 /* reverses arc direction by swapping endpoints and arrows */
--- 1191,1197 ----
       x2 = a->point[2].x - a->point[1].x,
       y2 = a->point[2].y - a->point[1].y;

!   return (icprod(x1,y1,x2,y2) > 0);
 }

 /* reverses arc direction by swapping endpoints and arrows */
***************
*** 1480,1486 ****
 {
   static double oldsize = UNDEFVALUE;
   chkcache(size, oldsize);
!   fprintf(tfp, "charheight %d;\n", round(/*scale*/ 10 * size /*/ 80.*/));
 }

 static void
--- 1460,1466 ----
 {
   static double oldsize = UNDEFVALUE;
   chkcache(size, oldsize);
!   fprintf(tfp, "charheight %d;\n", round( 10 * size ));
 }

 static void
***************
*** 1501,1507 ****
 {
   fprintf(tfp, "text ");
   _pos(x, y);
!   fprintf(tfp, " final '%s';\n", text);
 }

 void
--- 1481,1495 ----
 {
   fprintf(tfp, "text ");
   _pos(x, y);
!   fprintf(tfp, " final '");
!   /* if text contains a "'", must escape it(them) */
!   while ( *text ) {
!       fputc(*text,tfp);
!       if ( *text == '\'' )
!           fputc('\'',tfp);
!       text++;
!   }
!   fprintf(tfp,"';\n");
 }

 void
diff -rc transfig.3.2.3/fig2dev/dev/genepic.c transfig.3.2.3b/fig2dev/dev/genepic.c
*** transfig.3.2.3/fig2dev/dev/genepic.c        Sun Jan  2 12:33:48 2000
--- transfig.3.2.3b/fig2dev/dev/genepic.c       Tue Jul 11 14:50:28 2000
***************
*** 124,134 ****
 typedef struct fp_struct FPoint;

 /* Local to the file only */
- static int    coord_system;
- static int    CoordSys = 2;
 static double Threshold;
 static Boolean        linew_spec;
- static int    DPI;
 static int    CurWidth = 0;
 static int    LineStyle = SOLID_LINE;
 static int    LLX = 0, LLY = 0;
--- 124,131 ----
***************
*** 221,227 ****
         break;

       case 'a':
!           fprintf(stderr, "warning: genepic option -a obsolete");
           break;

       case 'f':
--- 218,224 ----
         break;

       case 'a':
!           fprintf(stderr, "warning: genepic option -a obsolete\n");
           break;

       case 'f':
***************
*** 228,247 ****
           for ( i = 1; i <= MAX_FONT; i++ )
               if ( !strcmp(optarg, texfontnames[i]) ) break;

!           if ( i > MAX_FONT)
!                       {
!                         fprintf(stderr,
!                                                "warning: non-standard font name %s ignored\n", optarg);
!                       }
!                else
!                       {
!                         texfontnames[0] = texfontnames[i];
 #ifdef NFSS
!                         texfontfamily[0] = texfontfamily[i];
!                         texfontseries[0] = texfontseries[i];
!                         texfontshape[0] = texfontshape[i];
 #endif
!                       }
           break;

         case 'l':
--- 225,240 ----
           for ( i = 1; i <= MAX_FONT; i++ )
               if ( !strcmp(optarg, texfontnames[i]) ) break;

!           if ( i > MAX_FONT) {
!               fprintf(stderr, "warning: non-standard font name %s ignored\n", optarg);
!           } else {
!               texfontnames[0] = texfontnames[i];
 #ifdef NFSS
!               texfontfamily[0] = texfontfamily[i];
!               texfontseries[0] = texfontseries[i];
!               texfontshape[0] = texfontshape[i];
 #endif
!           }
           break;

         case 'l':
***************
*** 301,309 ****
 fconvertCS(fpt)
 FPoint *fpt;
 {
!     if (CoordSys) {
!         fpt->y = TopCoord - fpt->y;
!     }
     fpt->x -= LLX;
     fpt->y -= LLY;
 }
--- 294,300 ----
 fconvertCS(fpt)
 FPoint *fpt;
 {
!     fpt->y = TopCoord - fpt->y;
     fpt->x -= LLX;
     fpt->y -= LLY;
 }
***************
*** 311,319 ****
 convertCS(pt)
 F_point *pt;
 {
!     if (CoordSys) {
!         pt->y = TopCoord - pt->y;
!     }
     pt->x -= LLX;
     pt->y -= LLY;
 }
--- 302,308 ----
 convertCS(pt)
 F_point *pt;
 {
!     pt->y = TopCoord - pt->y;
     pt->x -= LLX;
     pt->y -= LLY;
 }
***************
*** 358,386 ****
         fputs(Preamble, stdout);
     }

-     DPI = objects->nwcorner.x;
-     if (DPI <= 0) {
-         put_msg("Resolution has to be positive. Default to 80!\n");
-         DPI = 80;
-     }
-     /* now that we have DPI defined we can use the -l option */
     if (linew_spec)
!       LineThick = LineThick * DPI/80;
     if (LineThick == 0)
!       LineThick = 2*DPI/80;
!     DashScale = (double)DPI/80.0;
!     coord_system = objects->nwcorner.y;
!     switch (coord_system) {
!     case 1:
!         CoordSys = 0;
!         break;
!     case 2:
!         CoordSys = 1;
!         break;
!     default:
!         put_msg("Unknown Coordinate system -- %d\n", coord_system);
!         exit(1);
!     }
     pt1.x = llx;
     pt1.y = lly;
     pt2.x = urx;
--- 347,357 ----
         fputs(Preamble, stdout);
     }

     if (linew_spec)
!       LineThick = LineThick * ppi/80.0;
     if (LineThick == 0)
!       LineThick = 2.0*ppi/80.0;
!     DashScale = ppi/80.0;
     pt1.x = llx;
     pt1.y = lly;
     pt2.x = urx;
***************
*** 402,408 ****
     if (Verbose) {
         fprintf(tfp, "%%\n%% Language in use is %s\n%%\n", Tlangkw[TeXLang]);
     }
!     Threshold = 1.0 / DPI * mag;
     fprintf(tfp, "\\setlength{\\unitlength}{%.8fin}\n", Threshold);
     MaxCircleRadius = (int) (40 / 72.27 / Threshold);
     Threshold = SegLen / Threshold;
--- 373,379 ----
     if (Verbose) {
         fprintf(tfp, "%%\n%% Language in use is %s\n%%\n", Tlangkw[TeXLang]);
     }
!     Threshold = 1.0 / ppi * mag;
     fprintf(tfp, "\\setlength{\\unitlength}{%.8fin}\n", Threshold);
     MaxCircleRadius = (int) (40 / 72.27 / Threshold);
     Threshold = SegLen / Threshold;
***************
*** 440,446 ****
       if (CurWidth==ThinLines) {
           fprintf(tfp, "\\thinlines\n");
       } else if (VarWidth) {
!           fprintf(tfp, "\\allinethickness{%4.3fpt}%%\n",w*80.0/DPI);
       } else {
           fprintf(tfp, "\\thicklines\n");
       }
--- 411,417 ----
       if (CurWidth==ThinLines) {
           fprintf(tfp, "\\thinlines\n");
       } else if (VarWidth) {
!           fprintf(tfp, "\\allinethickness{%4.3fpt}%%\n",w*80.0/ppi);
       } else {
           fprintf(tfp, "\\thicklines\n");
       }
***************
*** 823,829 ****
       fprintf(tfp, "\\dottedline{%d}", DotDist);
       break;
     default:
!       fprintf(stderr,"Unknown Style\n");
       exit(1);
     }
     fprintf(tfp, "(%d,%d)", p->x, p->y);
--- 794,800 ----
       fprintf(tfp, "\\dottedline{%d}", DotDist);
       break;
     default:
!       fprintf(stderr,"Only solid, dashed, and dotted line styles supported by epic(eepic)\n");
       exit(1);
     }
     fprintf(tfp, "(%d,%d)", p->x, p->y);
***************
*** 1374,1380 ****
     set_linewidth(arc->thickness);
     if (TeXLang == EEpic) {
       set_pattern(arc->fill_style, arc->fill_color);
!         fprintf(tfp, "\\put(%4.3lf,%4.3lf){", ctr.x, ctr.y);
     } else {
       fprintf(tfp, "\\drawline");
     }
--- 1345,1351 ----
     set_linewidth(arc->thickness);
     if (TeXLang == EEpic) {
       set_pattern(arc->fill_style, arc->fill_color);
!         fprintf(tfp, "\\put(%4.3f,%4.3f){", ctr.x, ctr.y);
     } else {
       fprintf(tfp, "\\drawline");
     }
***************
*** 1396,1402 ****
 #ifdef DrawOutLine
           if (OutLine==1) {
               OutLine=0;
!               fprintf(tfp, "\\put(%4.3lf,%4.3lf){", ctr.x, ctr.y);
               fprintf(tfp, "\\arc{%4.3f}{%2.4f}{%2.4f}}\n", 2*r1, th2, th2+theta);
           }
 #endif
--- 1367,1373 ----
 #ifdef DrawOutLine
           if (OutLine==1) {
               OutLine=0;
!               fprintf(tfp, "\\put(%4.3f,%4.3f){", ctr.x, ctr.y);
               fprintf(tfp, "\\arc{%4.3f}{%2.4f}{%2.4f}}\n", 2*r1, th2, th2+theta);
           }
 #endif
***************
*** 1412,1418 ****
 #ifdef DrawOutLine
           if (OutLine==1) {
               OutLine=0;
!               fprintf(tfp, "\\put(%4.3lf,%4.3lf){", ctr.x, ctr.y);
               fprintf(tfp, "\\arc{%4.3f}{%2.4f}{%2.4f}}\n", 2*r2, th1, th1+theta);
           }
 #endif
--- 1383,1389 ----
 #ifdef DrawOutLine
           if (OutLine==1) {
               OutLine=0;
!               fprintf(tfp, "\\put(%4.3f,%4.3f){", ctr.x, ctr.y);
               fprintf(tfp, "\\arc{%4.3f}{%2.4f}{%2.4f}}\n", 2*r2, th1, th1+theta);
           }
 #endif
***************
*** 1463,1469 ****
             fprintf(tfp, "\n\t");
             pt_count = 1;
         }
!         fprintf(tfp, "(%.3lf,%.3lf)", ctr->x + cos(th1) * r,
                                 ctr->y + sin(th1) * r);
         th1 += delta;
     }
--- 1434,1440 ----
             fprintf(tfp, "\n\t");
             pt_count = 1;
         }
!         fprintf(tfp, "(%.3f,%.3f)", ctr->x + cos(th1) * r,
                                 ctr->y + sin(th1) * r);
         th1 += delta;
     }
diff -rc transfig.3.2.3/fig2dev/dev/genge.c transfig.3.2.3b/fig2dev/dev/genge.c
*** transfig.3.2.3/fig2dev/dev/genge.c  Wed Dec 22 13:03:25 1999
--- transfig.3.2.3b/fig2dev/dev/genge.c Tue Jul 11 14:50:31 2000
***************
*** 30,37 ****
 #define               SCALE(v)        (round((v)*scale))
 #define               min(a, b)       (((a) < (b)) ? (a) : (b))

- static int    coord_system;
- static int    resolution;
 static float  scale;

 static                set_color();
--- 30,35 ----
***************
*** 101,110 ****
       int             itmp;
       int             clipx, clipy;

-       resolution = objects->nwcorner.x;
-       coord_system = objects->nwcorner.y;
       /* convert dpi to 0.1mm per point */
!       scale = 254.0 / resolution;

       /* print any whole-figure comments prefixed with "#" */
       print_comments("# ",objects->comments, "");
--- 99,106 ----
       int             itmp;
       int             clipx, clipy;

       /* convert dpi to 0.1mm per point */
!       scale = 254.0 / ppi;

       /* print any whole-figure comments prefixed with "#" */
       print_comments("# ",objects->comments, "");
diff -rc transfig.3.2.3/fig2dev/dev/genibmgl.c transfig.3.2.3b/fig2dev/dev/genibmgl.c
*** transfig.3.2.3/fig2dev/dev/genibmgl.c       Wed Dec 22 13:02:31 1999
--- transfig.3.2.3b/fig2dev/dev/genibmgl.c      Tue Jul 11 14:50:34 2000
***************
*** 211,222 ****
       }
 }

- static double         ppi;                    /*     pixels/inch      */
 static double         cpi;                    /*       cent/inch      */
 static double         cpp;                    /*       cent/pixel     */
 static double         wcmpp    = CMPP;        /* centimeter/point     */
 static double         hcmpp    = CMPP;        /* centimeter/point     */
- static int            flipped  = False;       /* flip Y coordinate    */

 void genibmgl_start(objects)
 F_compound    *objects;
--- 211,220 ----
***************
*** 272,279 ****
       ppi      = objects->nwcorner.x;
       cpi      = mag*100.0/sqrt((xu-xl)*(xu-xl) + (yu-yl)*(yu-yl));
       cpp      = cpi/ppi;
-       if (objects->nwcorner.y == 2)
-           flipped      = True;

       /* IBMGL start */
       fprintf(tfp, "IN;\n");                  /* initialize plotter   */
--- 270,275 ----
***************
*** 290,305 ****
           P2x          = Xur;
           if (reflected)                      /* upside-down text     */
               hcmpp    = -hcmpp;
!           if (reflected^flipped) {            /* reflected or flipped */
!               P1y      = Yur;                 /* but not both         */
!               P2y      = Yll;
!               }
!           else {                              /* normal               */
               P1y      = Yll;
               P2y      = Yur;
!               }
           }
!       else {                                  /* landscape mode       */
           Xll  = xl*UNITS_PER_INCH;
           Yll  = yl*UNITS_PER_INCH;
           Yur  = yu*UNITS_PER_INCH;
--- 286,299 ----
           P2x          = Xur;
           if (reflected)                      /* upside-down text     */
               hcmpp    = -hcmpp;
!           if (reflected) {                    /* reflected */
               P1y      = Yll;
               P2y      = Yur;
!           } else {
!               P1y      = Yur;
!               P2y      = Yll;
           }
!       } else {                                        /* landscape mode       */
           Xll  = xl*UNITS_PER_INCH;
           Yll  = yl*UNITS_PER_INCH;
           Yur  = yu*UNITS_PER_INCH;
***************
*** 310,329 ****
               wcmpp    = -wcmpp;              /* backward text        */
               P1x      = Xur;
               P2x      = Xll;
!               }
!           else {                              /* normal               */
               P1x      = Xll;
               P2x      = Xur;
-               }
-           if (flipped) {                      /* reflected or not     */
-               P1y      = Yur;
-               P2y      = Yll;
-               }
-           else {
-               P1y      = Yll;
-               P2y      = Yur;
-               }
           }

       Xmin     = xz;
       Ymin     = yz;
--- 304,316 ----
               wcmpp    = -wcmpp;              /* backward text        */
               P1x      = Xur;
               P2x      = Xll;
!           } else {                            /* normal               */
               P1x      = Xll;
               P2x      = Xur;
           }
+           P1y  = Yur;
+           P2y  = Yll;
+       }

       Xmin     = xz;
       Ymin     = yz;
***************
*** 558,574 ****
           dy2          = ey - cy;

           theta        = atan2(dy2, dx2) - atan2(dy1, dx1);
!           if (a->direction^flipped) {
!               if (theta < 0.0)
!                   theta       += 2.0*M_PI;
!               }
!           else {
               if (theta > 0.0)
                   theta       -= 2.0*M_PI;
!               }

           if (a->type == T_OPEN_ARC && a->thickness != 0 && a->back_arrow) {
!               arc_tangent(cx, cy, sx, sy, a->direction^flipped, &x, &y);
               draw_arrow_head(x, y, sx, sy,
               a->back_arrow->ht/ppi, a->back_arrow->wid/ppi);
               }
--- 545,560 ----
           dy2          = ey - cy;

           theta        = atan2(dy2, dx2) - atan2(dy1, dx1);
!           if (a->direction) {
               if (theta > 0.0)
                   theta       -= 2.0*M_PI;
!           } else {
!               if (theta < 0.0)
!                   theta       += 2.0*M_PI;
!           }

           if (a->type == T_OPEN_ARC && a->thickness != 0 && a->back_arrow) {
!               arc_tangent(cx, cy, sx, sy, !a->direction, &x, &y);
               draw_arrow_head(x, y, sx, sy,
               a->back_arrow->ht/ppi, a->back_arrow->wid/ppi);
               }
***************
*** 581,587 ****
               fprintf(tfp, "EP;\n");

           if (a->type == T_OPEN_ARC && a->thickness != 0 && a->for_arrow) {
!               arc_tangent(cx, cy, ex, ey, !a->direction^flipped, &x, &y);
               draw_arrow_head(x, y, ex, ey,
                       a->for_arrow->ht/ppi, a->for_arrow->wid/ppi);
               }
--- 567,573 ----
               fprintf(tfp, "EP;\n");

           if (a->type == T_OPEN_ARC && a->thickness != 0 && a->for_arrow) {
!               arc_tangent(cx, cy, ex, ey, a->direction, &x, &y);
               draw_arrow_head(x, y, ex, ey,
                       a->for_arrow->ht/ppi, a->for_arrow->wid/ppi);
               }
***************
*** 612,619 ****
           b            = e->radiuses.y/ppi;
           x0           = e->center.x/ppi;
           y0           = e->center.y/ppi;
!           angle        = (flipped ? -e->angle: e->angle);
!           delta        = (flipped ? -DELTA: DELTA);

           x            = x0 + cos(angle)*a;
           y            = y0 + sin(angle)*a;
--- 598,605 ----
           b            = e->radiuses.y/ppi;
           x0           = e->center.x/ppi;
           y0           = e->center.y/ppi;
!           angle        = -e->angle;
!           delta        = -DELTA;

           x            = x0 + cos(angle)*a;
           y            = y0 + sin(angle)*a;
***************
*** 714,731 ****
                   x0   = llx/ppi;
                   x1   = urx/ppi;
                   dx   = l->radius/ppi;
!                   if (flipped) {
!                       y0       = ury/ppi;
!                       y1       = lly/ppi;
!                       dy       = -dx;
!                       angle    = -M_PI/2.0;
!                       }
!                   else {
!                       y0       = lly/ppi;
!                       y1       = ury/ppi;
!                       dy       =  dx;
!                       angle    =  M_PI/2.0;
!                       }

                   fprintf(tfp, "PA%.4f,%.4f;PM;PD;\n",  x0, y0 + dy);
                   arc(x0, y0 + dy, x0 + dx, y0 + dy, angle, DELTA);
--- 700,709 ----
                   x0   = llx/ppi;
                   x1   = urx/ppi;
                   dx   = l->radius/ppi;
!                   y0   = ury/ppi;
!                   y1   = lly/ppi;
!                   dy   = -dx;
!                   angle = -M_PI/2.0;

                   fprintf(tfp, "PA%.4f,%.4f;PM;PD;\n",  x0, y0 + dy);
                   arc(x0, y0 + dy, x0 + dx, y0 + dy, angle, DELTA);
diff -rc transfig.3.2.3/fig2dev/dev/genlatex.c transfig.3.2.3b/fig2dev/dev/genlatex.c
*** transfig.3.2.3/fig2dev/dev/genlatex.c       Wed Nov 24 14:31:00 1999
--- transfig.3.2.3b/fig2dev/dev/genlatex.c      Tue Jul 11 14:50:39 2000
***************
*** 110,116 ****
 char          thin_ldot [] = THIN_LDOT;
 char          thick_ldot[] = THICK_LDOT;

- static        int     coord_system;
 static        int     verbose = 0;
 double                dash_mag = 1.0;
 int           thick_width = 2;
--- 110,115 ----
***************
*** 226,248 ****
       texfontsizes[0] = texfontsizes[1] =
               TEXFONTSIZE(font_size?font_size:DEFAULT_FONT_SIZE);

-       coord_system = objects->nwcorner.y;
       unitlength = mag/objects->nwcorner.x;
       dash_mag /= unitlength*80.0;

!       switch (coord_system) {
!           case 1:
!               translate_coordinates = translate1;
!               translate_coordinates_d = translate1_d;
!               break;
!           case 2:
!               translate_coordinates = translate2;
!               translate_coordinates_d = translate2_d;
!               break;
!           default:
!               fprintf(stderr, "Wrong coordinate system; cannot continue\n");
!               return;
!           }

       TRANS2(llx, lly, urx, ury);
       if (llx > urx) SWAP(llx, urx)
--- 225,235 ----
       texfontsizes[0] = texfontsizes[1] =
               TEXFONTSIZE(font_size?font_size:DEFAULT_FONT_SIZE);

       unitlength = mag/objects->nwcorner.x;
       dash_mag /= unitlength*80.0;

!       translate_coordinates = translate2;
!       translate_coordinates_d = translate2_d;

       TRANS2(llx, lly, urx, ury);
       if (llx > urx) SWAP(llx, urx)
***************
*** 331,336 ****
--- 318,324 ----
           TRANS(x, y);
           fprintf(tfp, "\\put(%3d,%3d){\\makebox(%.4f,%.4f){%s}}\n",
             x, y, dot_xoffset, dot_yoffset, dot_cmd);
+           reset_color(l->pen_color);
           return;
           }

***************
*** 353,358 ****
--- 341,347 ----
             put_arc_box (llx, lly, urx, ury, l->radius, l->style, l->style_val);
           else
             put_box (llx, lly, urx, ury, l->style, l->style_val);
+           reset_color(l->pen_color);
           return;
           }

***************
*** 583,589 ****
           }
       if (2*dl >= l  ||  (sx  &&  sy  &&  (l/cosine)*unitlength < MIN_LEN)) {
           fprintf(stderr, "Dashed line too short; drawing solid line\n");
!           put_solidline (x, y, sx, sy, l, arrow, 0);
           return;
           }
       dg = (l - (n/2+1)*dl) / (double)(n/2);
--- 572,578 ----
           }
       if (2*dl >= l  ||  (sx  &&  sy  &&  (l/cosine)*unitlength < MIN_LEN)) {
           fprintf(stderr, "Dashed line too short; drawing solid line\n");
!           put_solidline (x, y, sx, sy, l, arrow, (double) 0.0);
           return;
           }
       dg = (l - (n/2+1)*dl) / (double)(n/2);
***************
*** 683,688 ****
--- 672,679 ----
       /* print any comments prefixed with "%" */
       print_comments("% ",e->comments, "");

+       set_color(e->pen_color);
+
       set_linewidth(e->thickness);
       switch (e->style) {
           case SOLID_LINE:
***************
*** 717,722 ****
--- 708,715 ----
           if (e->fill_style != UNFILLED)
               fprintf(stderr, "Ellipse area fill not implemented\n");
       }
+       reset_color(e->pen_color);
+
       }

 void
***************
*** 980,1033 ****

 #define  MAXCOLORS 32

 set_color(col)
 int col;
 {
    static char *colors[] = {
!    "0 0 0",    /* black */
!    "0 0 1",    /* blue */
!    "0 1 0",    /* green */
!    "0 1 1",    /* cyan */
!    "1 0 0",    /* red */
!    "1 0 1",    /* magenta */
!    "1 1 0",    /* yellow */
!    "1 1 1",    /* white */
!    "1 .84 0", /* gold */
!    "0 0 .56", /* dk blue */
!    "0 0 .69", /* md blue */
!    "0 0 .82", /* lt blue */
!    "0 .56 0", /* dk green */
!    "0 .69 0", /* md green */
!    "0 .82 0", /* lt green */
!    "0 .56 .56",       /* dk cyan */
!    "0 .69 .69",       /* md cyan */
!    "0 .82 .82",       /* lt cyan */
!    ".56 0 0", /* dk red */
!    ".69 0 0", /* md red */
!    ".82 0 0", /* lt red */
!    ".56 0 .56",       /* dk magenta */
!    ".69 0 .69",       /* md magenta */
!    ".82 0 .82",       /* lt magenta */
!    ".5 .17 0",        /* dk brown */
!    ".63 .25 0",       /* md brown1 */
!    ".75 .38 0",       /* md brown1 */
!    ".88 .44 0",       /* lt brown */
!    "1 .5 .5", /* dk pink */
!    "1 .63 .63",       /* md pink1 */
!    "1 .75 .75",       /* md pink2 */
!    "1 .88 .88",       /* lt pink */
    };

 #ifdef DVIPS
    if (col != -1) {
       if (col < NUM_STD_COLS)
!           fprintf(tfp, "\\special{ps: gsave %s setrgbcolor}",
!                               colors[col]);
       else
!           fprintf(tfp, "\\special{ps: gsave %.3f %.3f %.3f setrgbcolor}",
                               user_colors[col-NUM_STD_COLS].r/256.0,
                               user_colors[col-NUM_STD_COLS].g/256.0,
                               user_colors[col-NUM_STD_COLS].b/256.0);
    }
 #endif
    return;
--- 973,1034 ----

 #define  MAXCOLORS 32

+ /* need this for communication between color routines. Sorry */
+ static int lastcolor=-1;
+
 set_color(col)
 int col;
 {
    static char *colors[] = {
!    "0,0,0",    /* black */
!    "0,0,1",    /* blue */
!    "0,1,0",    /* green */
!    "0,1,1",    /* cyan */
!    "1,0,0",    /* red */
!    "1,0,1",    /* magenta */
!    "1,1,0",    /* yellow */
!    "1,1,1",    /* white */
!    "1,.84,0", /* gold */
!    "0,0,.56", /* dk blue */
!    "0,0,.69", /* md blue */
!    "0,0,.82", /* lt blue */
!    "0,.56,0", /* dk green */
!    "0,.69,0", /* md green */
!    "0,.82,0", /* lt green */
!    "0,.56,.56",       /* dk cyan */
!    "0,.69,.69",       /* md cyan */
!    "0,.82,.82",       /* lt cyan */
!    ".56,0,0", /* dk red */
!    ".69,0,0", /* md red */
!    ".82,0,0", /* lt red */
!    ".56,0,.56",       /* dk magenta */
!    ".69,0,.69",       /* md magenta */
!    ".82,0,.82",       /* lt magenta */
!    ".5,.17,0",        /* dk brown */
!    ".63,.25,0",       /* md brown1 */
!    ".75,.38,0",       /* md brown1 */
!    ".88,.44,0",       /* lt brown */
!    "1,.5,.5", /* dk pink */
!    "1,.63,.63",       /* md pink1 */
!    "1,.75,.75",       /* md pink2 */
!    "1,.88,.88",       /* lt pink */
    };

+
 #ifdef DVIPS
    if (col != -1) {
+        /* we do not support nested colors, although LaTeX would */
+        if (lastcolor == -1)
+          fprintf(tfp, "{");
+        /* switch to (other) color */
       if (col < NUM_STD_COLS)
!           fprintf(tfp, "\\color[rgb]{%s}",colors[col]);
       else
!           fprintf(tfp, "\\color[rgb]{%.3f,%.3f,%.3f}",
                               user_colors[col-NUM_STD_COLS].r/256.0,
                               user_colors[col-NUM_STD_COLS].g/256.0,
                               user_colors[col-NUM_STD_COLS].b/256.0);
+        lastcolor = col;
    }
 #endif
    return;
***************
*** 1037,1044 ****
 int col;
 {
 #ifdef DVIPS
!    if (col != -1 && col < NUM_STD_COLS + MAX_USR_COLS)
!       fprintf(tfp, "\\special{ps: grestore}");
 #endif
    return;
 }
--- 1038,1049 ----
 int col;
 {
 #ifdef DVIPS
!     if (col != -1 && col < NUM_STD_COLS + MAX_USR_COLS) {
!        /* end using the last color */
!        fprintf(tfp, "}%%\n");
!     }
!     /* make sure the color indicator is reset */
!     lastcolor = -1;
 #endif
    return;
 }
diff -rc transfig.3.2.3/fig2dev/dev/genmap.c transfig.3.2.3b/fig2dev/dev/genmap.c
*** transfig.3.2.3/fig2dev/dev/genmap.c Tue Dec 21 09:51:18 1999
--- transfig.3.2.3b/fig2dev/dev/genmap.c        Tue Jul 11 14:50:43 2000
***************
*** 380,387 ****
   }
 }

! struct
! driver dev_map = {
         genmap_option,
         genmap_start,
         genmap_arc,
--- 380,386 ----
   }
 }

! struct driver dev_map = {
         genmap_option,
         genmap_start,
         genmap_arc,
diff -rc transfig.3.2.3/fig2dev/dev/genmf.c transfig.3.2.3b/fig2dev/dev/genmf.c
*** transfig.3.2.3/fig2dev/dev/genmf.c  Wed Nov 24 14:31:04 1999
--- transfig.3.2.3b/fig2dev/dev/genmf.c Tue Jul 11 14:50:46 2000
***************
*** 51,57 ****
       double *value;
 } Options;

- static double ppi;
 static double code = 32.0;
 static int oldpen = 0;
 static double penscale = 1;
--- 51,56 ----
***************
*** 68,74 ****
 int thickness;
 {
   if (thickness != oldpen) {
!     fprintf(tfp, "penwd := %.2lfpt;\n",
           thickness/THICK_SCALE*penscale*yscale*mag);
     fprintf(tfp, "drawpen := pencircle scaled penwd yscaled aspect_ratio;\n");
     oldpen = thickness;
--- 67,73 ----
 int thickness;
 {
   if (thickness != oldpen) {
!     fprintf(tfp, "penwd := %.2fpt;\n",
           thickness/THICK_SCALE*penscale*yscale*mag);
     fprintf(tfp, "drawpen := pencircle scaled penwd yscaled aspect_ratio;\n");
     oldpen = thickness;
***************
*** 84,90 ****
       if (maxy == INFTY)
               maxy = yu;

-       ppi = objects->nwcorner.x;
       curchar = (int)code;

       fprintf(tfp,"%%\n%% fig2dev -L mf (Version %s Patchlevel %s)\n",
--- 83,88 ----
***************
*** 104,111 ****

       fprintf(tfp,"%%\n%% %s (char %d)\n%%\n",
               (name? name: ((from) ? from : "stdin")), ++curchar);
!       fprintf(tfp,"xscale:=%.3lf; yscale:=%.3lf;\n", xscale*mag, yscale*mag);
!       fprintf(tfp,"bounds(%.3lf,%.3lf,%.3lf,%.3lf);\n", xl, xu, yl, yu);
       fprintf(tfp,"unitlen:=1.0in#;\n");
       fprintf(tfp,"beginmfpic(incr code);\n");
       setpen(1);
--- 102,109 ----

       fprintf(tfp,"%%\n%% %s (char %d)\n%%\n",
               (name? name: ((from) ? from : "stdin")), ++curchar);
!       fprintf(tfp,"xscale:=%.3f; yscale:=%.3f;\n", xscale*mag, yscale*mag);
!       fprintf(tfp,"bounds(%.3f,%.3f,%.3f,%.3f);\n", xl, xu, yl, yu);
       fprintf(tfp,"unitlen:=1.0in#;\n");
       fprintf(tfp,"beginmfpic(incr code);\n");
       setpen(1);
***************
*** 181,187 ****
               if (l->fill_style == BLACK_FILL)
                       fprintf(tfp,"  filled ");
               else if (l->fill_style < BLACK_FILL && l->fill_style > 0)
!                       fprintf(tfp,"  shade(%lfpt) unfilled", dofill(l));
               else if (l->fill_style == 0)
                       fprintf(tfp,"  drawn unfilled ");
               else
--- 179,185 ----
               if (l->fill_style == BLACK_FILL)
                       fprintf(tfp,"  filled ");
               else if (l->fill_style < BLACK_FILL && l->fill_style > 0)
!                       fprintf(tfp,"  shade(%fpt) unfilled", dofill(l));
               else if (l->fill_style == 0)
                       fprintf(tfp,"  drawn unfilled ");
               else
***************
*** 189,198 ****
               fprintf(tfp,"polyline(true)\n");
       }
       p = l->points;
!       fprintf(tfp,"      ((%lf, %lf)", p->x/ppi, maxy-(p->y/ppi));
       p = p->next;
       for ( ; p != NULL; p=p->next) {
!           fprintf(tfp,",\n       (%lf, %lf)", p->x/ppi, maxy-(p->y/ppi));
       }
       fprintf(tfp, ");\n");
       return;
--- 187,196 ----
               fprintf(tfp,"polyline(true)\n");
       }
       p = l->points;
!       fprintf(tfp,"      ((%f, %f)", p->x/ppi, maxy-(p->y/ppi));
       p = p->next;
       for ( ; p != NULL; p=p->next) {
!           fprintf(tfp,",\n       (%f, %f)", p->x/ppi, maxy-(p->y/ppi));
       }
       fprintf(tfp, ");\n");
       return;
***************
*** 216,222 ****
               if (s->fill_style == BLACK_FILL)
                       fprintf(tfp,"  filled ");
               else if (s->fill_style < BLACK_FILL && s->fill_style > 0)
!                       fprintf(tfp,"  shade(%lfpt) unfilled ", dofill(s));
               else if (s->fill_style == 0)
                       fprintf(tfp,"  drawn unfilled ");
               else
--- 214,220 ----
               if (s->fill_style == BLACK_FILL)
                       fprintf(tfp,"  filled ");
               else if (s->fill_style < BLACK_FILL && s->fill_style > 0)
!                       fprintf(tfp,"  shade(%fpt) unfilled ", dofill(s));
               else if (s->fill_style == 0)
                       fprintf(tfp,"  drawn unfilled ");
               else
***************
*** 224,233 ****
               fprintf(tfp,"curve(true)\n");
       }
       p = s->points;
!       fprintf(tfp,"      ((%lf, %lf)", p->x/ppi, maxy-(p->y/ppi));
       p = p->next;
       for ( ; p != NULL; p=p->next) {
!           fprintf(tfp,",\n       (%lf, %lf)", p->x/ppi, maxy-(p->y/ppi));
       }
       fprintf(tfp, ");\n");
       return;
--- 222,231 ----
               fprintf(tfp,"curve(true)\n");
       }
       p = s->points;
!       fprintf(tfp,"      ((%f, %f)", p->x/ppi, maxy-(p->y/ppi));
       p = p->next;
       for ( ; p != NULL; p=p->next) {
!           fprintf(tfp,",\n       (%f, %f)", p->x/ppi, maxy-(p->y/ppi));
       }
       fprintf(tfp, ");\n");
       return;
***************
*** 246,262 ****
       if (e->fill_style == BLACK_FILL)
               fprintf(tfp,"  filled ");
       else if (e->fill_style < BLACK_FILL && e->fill_style > 0)
!               fprintf(tfp,"  shade(%lfpt) ", dofill(e));
       else
               fprintf(tfp,"  drawn ");
       if (e->type == 3 || e->type == 4)
       {
!               fprintf(tfp,"circle((%lf,%lf),%lf);\n",
                       e->center.x/ppi, maxy-(e->center.y/ppi), e->radiuses.x/ppi);
       }
       else if (e->type == 1 || e->type == 2)
       {
!               fprintf(tfp,"ellipse((%lf,%lf),%lf,%lf,0);\n",
                       e->center.x/ppi, maxy-(e->center.y/ppi),
                       e->radiuses.x/ppi, e->radiuses.y/ppi);
       }
--- 244,260 ----
       if (e->fill_style == BLACK_FILL)
               fprintf(tfp,"  filled ");
       else if (e->fill_style < BLACK_FILL && e->fill_style > 0)
!               fprintf(tfp,"  shade(%fpt) ", dofill(e));
       else
               fprintf(tfp,"  drawn ");
       if (e->type == 3 || e->type == 4)
       {
!               fprintf(tfp,"circle((%f,%f),%f);\n",
                       e->center.x/ppi, maxy-(e->center.y/ppi), e->radiuses.x/ppi);
       }
       else if (e->type == 1 || e->type == 2)
       {
!               fprintf(tfp,"ellipse((%f,%f),%f,%f,0);\n",
                       e->center.x/ppi, maxy-(e->center.y/ppi),
                       e->radiuses.x/ppi, e->radiuses.y/ppi);
       }
***************
*** 271,277 ****

       setpen(a->thickness);
       fprintf(tfp, "  store (curpath)\n");
!       fprintf(tfp,"  drawn arcppp((%lf,%lf), (%lf,%lf), (%lf,%lf));\n",
               a->point[0].x/ppi, maxy-(a->point[0].y/ppi),
               a->point[1].x/ppi, maxy-(a->point[1].y/ppi),
               a->point[2].x/ppi, maxy-(a->point[2].y/ppi));
--- 269,275 ----

       setpen(a->thickness);
       fprintf(tfp, "  store (curpath)\n");
!       fprintf(tfp,"  drawn arcppp((%f,%f), (%f,%f), (%f,%f));\n",
               a->point[0].x/ppi, maxy-(a->point[0].y/ppi),
               a->point[1].x/ppi, maxy-(a->point[1].y/ppi),
               a->point[2].x/ppi, maxy-(a->point[2].y/ppi));
diff -rc transfig.3.2.3/fig2dev/dev/genpdf.c transfig.3.2.3b/fig2dev/dev/genpdf.c
*** transfig.3.2.3/fig2dev/dev/genpdf.c Wed Nov 24 14:31:06 1999
--- transfig.3.2.3b/fig2dev/dev/genpdf.c        Tue Jul 11 14:50:49 2000
***************
*** 18,24 ****
  *
  *    Author: Brian V. Smith
  *            Uses genps functions to generate PostScript output then
!  *            calls ps2pdf (which uses ghostscript) to convert it to pdf.
  */

 #if defined(hpux) || defined(SYSV) || defined(SVR4)
--- 18,24 ----
  *
  *    Author: Brian V. Smith
  *            Uses genps functions to generate PostScript output then
!  *            calls ghostscript (device pdfwrite) to convert it to pdf.
  */

 #if defined(hpux) || defined(SYSV) || defined(SVR4)
***************
*** 30,47 ****
 #include "object.h"
 #include "texfonts.h"

! extern void
!       genps_arc(),
!       genps_ellipse(),
!       genps_line(),
!       genps_spline(),
!       genps_text();
!
! static char com[1000];
! Boolean       direct;
! FILE  *saveofile;
! char  *ofile;
! char   tempfile[PATH_MAX];

 void
 genpdf_option(opt, optarg)
--- 30,39 ----
 #include "object.h"
 #include "texfonts.h"

! static        Boolean  direct;
! static        FILE    *saveofile;
! static        char    *ofile;
! static        char     tempfile[PATH_MAX];

 void
 genpdf_option(opt, optarg)
***************
*** 49,55 ****
 char *optarg;
 {
       /* just use the ps options */
!       genps_option(opt, optarg);
 }

 void
--- 41,49 ----
 char *optarg;
 {
       /* just use the ps options */
!       pdfflag = 1;
!       epsflag = 0;
!       gen_ps_eps_option(opt, optarg);
 }

 void
***************
*** 56,71 ****
 genpdf_start(objects)
 F_compound    *objects;
 {
!
!       /* change output from ps driver to a temp file because
!          ps2pdf only works with files, not pipes */
       /* but first close the output file that main() opened */
       saveofile = tfp;
       if (tfp != stdout)
           fclose(tfp);
!       sprintf(tempfile, "fig2dev-%d", getpid());
!       if ((tfp = fopen(tempfile,"w" )) == 0) {
!           fprintf(stderr,"Can't open temporary file %s\n",tempfile);
           exit(1);
       }
       genps_start(objects);
--- 50,68 ----
 genpdf_start(objects)
 F_compound    *objects;
 {
!       /* divert output from ps driver to the pipe into ghostscript */
       /* but first close the output file that main() opened */
       saveofile = tfp;
       if (tfp != stdout)
           fclose(tfp);
!
!       /* make up the command for gs */
!       ofile = (to == NULL? "-": to);
!       sprintf(gscom, "gs -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=%s - -c quit", ofile);
!       (void) signal(SIGPIPE, gs_broken_pipe);
!       if ((tfp = popen(gscom,"w" )) == 0) {
!           fprintf(stderr,"fig2dev: Can't open pipe to ghostscript\n");
!           fprintf(stderr,"command was: %s\n", gscom);
           exit(1);
       }
       genps_start(objects);
***************
*** 74,114 ****
 int
 genpdf_end()
 {
!       char    com[500],tempofile[PATH_MAX];
!       int     status = 0;

-       sprintf(tempfile, "fig2dev-%d", getpid());
-
       /* wrap up the postscript output */
       if (genps_end() != 0)
!           return -1;

!       /* add a showpage so the pdf will have a page */
       fprintf(tfp, "showpage\n");
-       fclose(tfp);

!       /* if no output file specified, put in temp and cat it */
!       if (to==NULL) {
!           sprintf(tempofile,"fig2dev-%d.pdf", getpid());
!           to = tempofile;
!       }
!       /* make up the command for ps2pdf */
!       sprintf(com, "ps2pdf %s %s", tempfile, to);
!       /* run it */
!       if (system(com) != 0)
!           status = -1;
!
!       /* finally, remove the temporary file */
!       unlink(tempfile);
!       /* cat the temp output file if any */
!       if (to == tempofile) {
!           sprintf(com,"cat %s",tempofile);
!           system(com);
!           /* and remove it */
!           unlink(tempofile);
       }
!       /* we've already closed the original output file */
!       tfp = 0;

       return status;
 }
--- 71,96 ----
 int
 genpdf_end()
 {
!       char     com[PATH_MAX*2],tempofile[PATH_MAX];
!       FILE    *tmpfile;
!       int      status = 0;
!       int      num;

       /* wrap up the postscript output */
       if (genps_end() != 0)
!           return -1;          /* error, return now */

!       /* add a showpage so ghostscript will produce output */
       fprintf(tfp, "showpage\n");

!       if (pclose(tfp) != 0) {
!           fprintf(stderr,"Error in ghostcript command\n");
!           fprintf(stderr,"command was: %s\n", gscom);
!           return -1;
       }
!       (void) signal(SIGPIPE, SIG_DFL);
!
!       /* all ok so far */

       return status;
 }
diff -rc transfig.3.2.3/fig2dev/dev/genpic.c transfig.3.2.3b/fig2dev/dev/genpic.c
*** transfig.3.2.3/fig2dev/dev/genpic.c Wed Nov 24 14:31:08 1999
--- transfig.3.2.3b/fig2dev/dev/genpic.c        Tue Jul 11 14:50:52 2000
***************
*** 44,51 ****
 void genpic_open_spline(), genpic_closed_spline();

 #define                       TOP     10.5    /* top of page is 10.5 inch */
- static double         ppi;
- static int            CONV = 0;
 static int LineThickness = 0;
 static int OptArcBox = 0;             /* Conditional use */
 static int OptLineThick = 0;
--- 44,49 ----
***************
*** 113,119 ****
 double convy(a)
 double        a;
 {
!       return((double)(CONV ? TOP-a : a));
 }

 void
--- 111,117 ----
 double convy(a)
 double        a;
 {
!       return((double) TOP-a);
 }

 void
***************
*** 120,130 ****
 genpic_start(objects)
 F_compound    *objects;
 {
!       int             coord_system;
!
!       ppi = objects->nwcorner.x/mag;
!       coord_system = objects->nwcorner.y;
!       if (coord_system == 2) CONV = 1;

       /* print any whole-figure comments prefixed with '.\" ' */
       if (objects->comments) {
--- 118,124 ----
 genpic_start(objects)
 F_compound    *objects;
 {
!       ppi = ppi/mag;

       /* print any whole-figure comments prefixed with '.\" ' */
       if (objects->comments) {
diff -rc transfig.3.2.3/fig2dev/dev/genpictex.c transfig.3.2.3b/fig2dev/dev/genpictex.c
*** transfig.3.2.3/fig2dev/dev/genpictex.c      Wed Nov 24 14:31:12 1999
--- transfig.3.2.3b/fig2dev/dev/genpictex.c     Wed May  3 13:47:04 2000
***************
*** 44,50 ****
 static draw_arrow_head();

 #define rint(a) floor((a)+0.5)     /* close enough? */
- static int            coord_system;
 static double         dash_length = -1;
 static int            line_style = SOLID_LINE;
 static char           *linethick = "1pt";
--- 44,49 ----
***************
*** 103,116 ****
 }

 #define                       TOP     10.5    /* top of page is 10.5 inch */
- static double         ppi;
- static int            CONV = 0;

 static double
 convy(a)
 double        a;
 {
!       return((double)(CONV ? TOP-a : a));
 }

 void
--- 102,113 ----
 }

 #define                       TOP     10.5    /* top of page is 10.5 inch */

 static double
 convy(a)
 double        a;
 {
!       return((double) TOP-a);
 }

 void
***************
*** 119,128 ****
 {
       texfontsizes[0] = texfontsizes[1] =
               TEXFONTSIZE(font_size?font_size:DEFAULT_FONT_SIZE);
-
-       coord_system = objects->nwcorner.y;
-       ppi = objects->nwcorner.x;
-       if (coord_system == 2) CONV = 1;

       /* PiCTeX start */

--- 116,121 ----
diff -rc transfig.3.2.3/fig2dev/dev/genps.c transfig.3.2.3b/fig2dev/dev/genps.c
*** transfig.3.2.3/fig2dev/dev/genps.c  Mon Jan 10 15:19:17 2000
--- transfig.3.2.3b/fig2dev/dev/genps.c Tue Jul 11 14:51:21 2000
***************
*** 61,71 ****
 /* include the PostScript preamble, patterns etc */
 #include "genps.h"

- typedef struct _point
- {
-     int x,y;
- } Point;
-
 #define               POINT_PER_INCH          72
 #define               ULIMIT_FONT_SIZE        300

--- 61,66 ----
***************
*** 74,86 ****
 void          gen_ps_eps_option();

 Boolean               epsflag = False;        /* to distinguish PS and EPS */

 int           pagewidth = -1;
 int           pageheight = -1;
 int           xoff=0;
 int           yoff=0;
- static int    coord_system;
- static int    resolution;
 static double cur_thickness = 0.0;
 static int    cur_joinstyle = 0;
 static int    cur_capstyle = 0;
--- 69,80 ----
 void          gen_ps_eps_option();

 Boolean               epsflag = False;        /* to distinguish PS and EPS */
+ Boolean               pdfflag = False;        /* to distinguish PDF and PS/EPS */

 int           pagewidth = -1;
 int           pageheight = -1;
 int           xoff=0;
 int           yoff=0;
 static double cur_thickness = 0.0;
 static int    cur_joinstyle = 0;
 static int    cur_capstyle = 0;
***************
*** 99,111 ****
 static                arc_tangent();
 static                fill_area();
 static                clip_arrows();
- static                calc_arrow();
 static                draw_arrow();
 static                iso_text_exist();
 static                encode_all_fonts();
 static                ellipse_exist();
 static                approx_spline_exist();
! static double compute_angle();

 #define SHADEVAL(F)   1.0*(F)/(NUMSHADES-1)
 #define TINTVAL(F)    1.0*(F-NUMSHADES+1)/NUMTINTS
--- 93,104 ----
 static                arc_tangent();
 static                fill_area();
 static                clip_arrows();
 static                draw_arrow();
 static                iso_text_exist();
 static                encode_all_fonts();
 static                ellipse_exist();
 static                approx_spline_exist();
! static                set_linewidth();

 #define SHADEVAL(F)   1.0*(F)/(NUMSHADES-1)
 #define TINTVAL(F)    1.0*(F-NUMSHADES+1)/NUMTINTS
***************
*** 186,252 ****
        8, -16,
       };

- /************** ARRAY FOR ARROW SHAPES **************/
-
- struct _fpnt {
-               double x,y;
-       };
- struct _arrow_shape {
-               int numpts;
-               int tipno;
-               double tipmv;
-               struct _fpnt points[6];
-       };
-
- #define NUM_ARROW_TYPES 21
- static struct _arrow_shape arrow_shapes[NUM_ARROW_TYPES+1] = {
-                  /* number of points, index of tip, {datapairs} */
-                  /* first point must be upper-left point of tail, then tip */
-
-                  /* type 0 */
-                  { 3, 1, 2.15, {{-1,0.5}, {0,0}, {-1,-0.5}}},
-                  /* place holder for what would be type 0 filled */
-                  { 0 },
-                  /* type 1 simple triangle */
-                  { 4, 1, 2.1, {{-1.0,0.5}, {0,0}, {-1.0,-0.5}, {-1.0,0.5}}},
-                  /* type 1 filled simple triangle*/
-                  { 4, 1, 2.1, {{-1.0,0.5}, {0,0}, {-1.0,-0.5}, {-1.0,0.5}}},
-                  /* type 2 concave spearhead */
-                  { 5, 1, 2.6, {{-1.25,0.5},{0,0},{-1.25,-0.5},{-1.0,0},{-1.25,0.5}}},
-                  /* type 2 filled concave spearhead */
-                  { 5, 1, 2.6, {{-1.25,0.5},{0,0},{-1.25,-0.5},{-1.0,0},{-1.25,0.5}}},
-                  /* type 3 convex spearhead */
-                  { 5, 1, 1.5, {{-0.75,0.5},{0,0},{-0.75,-0.5},{-1.0,0},{-0.75,0.5}}},
-                  /* type 3 filled convex spearhead */
-                  { 5, 1, 1.5, {{-0.75,0.5},{0,0},{-0.75,-0.5},{-1.0,0},{-0.75,0.5}}},
-                  /* type 4 diamond */
-                  { 5, 1, 1.15, {{-0.5,0.5},{0,0},{-0.5,-0.5},{-1.0,0},{-0.5,0.5}}},
-                  /* type 4 filled diamond */
-                  { 5, 1, 1.15, {{-0.5,0.5},{0,0},{-0.5,-0.5},{-1.0,0},{-0.5,0.5}}},
-                  /* type 5 circle - handled in code */
-                  { 0, 0, 0.0 }, { 0, 0, 0.0 },
-                  /* type 6 half circle - handled in code */
-                  { 0, 0, -1.0 }, { 0, 0, -1.0 },
-                  /* type 7 square */
-                  { 5, 1, 0.0, {{-1.0,0.5},{0,0.5},{0,-0.5},{-1.0,-0.5},{-1.0,0.5}}},
-                  /* type 7 filled square */
-                  { 5, 1, 0.0, {{-1.0,0.5},{0,0.5},{0,-0.5},{-1.0,-0.5},{-1.0,0.5}}},
-                  /* type 8 reverse triangle */
-                  { 4, 1, 0.0, {{-1.0,0},{0,0.5},{0,-0.5},{-1.0,0}}},
-                  /* type 8 filled reverse triangle */
-                  { 4, 1, 0.0, {{-1.0,0},{0,0.5},{0,-0.5},{-1.0,0}}},
-                  /* type 9a "wye" */
-                  { 3, 0, -1.0, {{0,0.5},{-1.0,0},{0,-0.5}}},
-                  /* type 9b bar */
-                  { 2, 1, 0.0, {{0,0.5},{0,-0.5}}},
-                  /* type 10a two-prong fork */
-                  { 4, 0, -1.0, {{0,0.5},{-1.0,0.5},{-1.0,-0.5},{0,-0.5}}},
-                  /* type 10b backward two-prong fork */
-                  { 4, 1, 0.0, {{-1.0,0.5,},{0,0.5},{0,-0.5},{-1.0,-0.5}}},
-               };
 static double         scalex, scaley;
 static double         origx, origy;

 void
 geneps_option(opt, optarg)
 char opt;
--- 179,239 ----
        8, -16,
       };

 static double         scalex, scaley;
 static double         origx, origy;

+ FILE  *open_picfile();
+ void  close_picfile();
+ int   filtype;
+ extern        int     read_gif();
+ extern        int     read_pcx();
+ extern        int     read_eps();
+ extern        int     read_pdf();
+ extern        int     read_ppm();
+ extern        int     read_tif();
+ extern        int     read_xbm();
+ #ifdef USE_JPEG
+ extern        int     read_jpg();
+ #endif
+ #ifdef USE_XPM
+ extern        int     read_xpm();
+ #endif
+
+ /* headers for various image files */
+
+ static         struct hdr {
+           char        *type;
+           char        *bytes;
+           int          nbytes;
+           int         (*readfunc)();
+           Boolean     pipeok;
+       }
+       headers[]= {    {"GIF", "GIF",              3, read_gif,        True},
+ #ifdef V4_0
+                       {"FIG", "#FIG",             4, read_figure,     True},
+ #endif /* V4_0 */
+                       {"PCX", "\012\005\001",     3, read_pcx,        True},
+                       {"EPS", "%!",               2, read_eps,        True},
+                       {"PDF", "%PDF",             4, read_pdf,        True},
+                       {"PPM", "P3",               2, read_ppm,        True},
+                       {"PPM", "P6",               2, read_ppm,        True},
+                       {"TIFF", "II*\000",         4, read_tif,        False},
+                       {"TIFF", "MM\000*",         4, read_tif,        False},
+                       {"XBM", "#define",          7, read_xbm,        True},
+ #ifdef USE_JPEG
+                       {"JPEG", "\377\330\377\340", 4, read_jpg,       True},
+ #endif
+ #ifdef USE_XPM
+                       {"XPM", "/* XPM */",        9, read_xpm,        False},
+ #endif
+                       };
+
+ #define NUMHEADERS sizeof(headers)/sizeof(headers[0])
+
+ /******************************/
+ /* various methods start here */
+ /******************************/
+
 void
 geneps_option(opt, optarg)
 char opt;
***************
*** 253,258 ****
--- 240,246 ----
 char *optarg;
 {
       epsflag = True;
+       pdfflag = False;
       gen_ps_eps_option(opt, optarg);
 }

***************
*** 262,267 ****
--- 250,256 ----
 char *optarg;
 {
       epsflag = False;
+       pdfflag = False;
       gen_ps_eps_option(opt, optarg);
 }

***************
*** 297,304 ****
                       if ( !strcmp(optarg, PSfontnames[i]) ) break;

               if ( i > MAX_PSFONT )
!                       fprintf(stderr,
!                           "warning: non-standard font name %s\n", optarg);

               psfontnames[0] = psfontnames[1] = optarg;
               PSfontnames[0] = PSfontnames[1] = optarg;
--- 286,292 ----
                       if ( !strcmp(optarg, PSfontnames[i]) ) break;

               if ( i > MAX_PSFONT )
!                       fprintf(stderr, "warning: non-standard font name %s\n", optarg);

               psfontnames[0] = psfontnames[1] = optarg;
               PSfontnames[0] = PSfontnames[1] = optarg;
***************
*** 305,311 ****
               break;

         case 'g':                     /* background color */
!               if (lookup_db_color(optarg,&background) >= 0) {
                   bgspec = True;
               } else {
                   fprintf(stderr,"Can't parse color '%s', ignoring background option\n",
--- 293,299 ----
               break;

         case 'g':                     /* background color */
!               if (lookup_X_color(optarg,&background) >= 0) {
                   bgspec = True;
               } else {
                   fprintf(stderr,"Can't parse color '%s', ignoring background option\n",
***************
*** 312,318 ****
                               optarg);
               }
               break;
!
         case 'M':                     /* multi-page option */
               if (!epsflag) {
                   multi_page = True;
--- 300,306 ----
                               optarg);
               }
               break;
!
         case 'M':                     /* multi-page option */
               if (!epsflag) {
                   multi_page = True;
***************
*** 390,404 ****
       int             itmp;
       int             cliplx, cliply, clipux, clipuy;
       struct paperdef *pd;
-       float           bd;

       char            *libdir;
       char            filename[512], str[512];
       FILE            *fp;

!       resolution = objects->nwcorner.x;
!       coord_system = objects->nwcorner.y;
!       scalex = scaley = mag * POINT_PER_INCH / (double)resolution;

       /* this seems to work around Solaris' cc optimizer bug */
       /* the problem was that llx had garbage in it - this "fixes" it */
--- 378,389 ----
       int             itmp;
       int             cliplx, cliply, clipux, clipuy;
       struct paperdef *pd;

       char            *libdir;
       char            filename[512], str[512];
       FILE            *fp;

!       scalex = scaley = mag * POINT_PER_INCH / ppi;

       /* this seems to work around Solaris' cc optimizer bug */
       /* the problem was that llx had garbage in it - this "fixes" it */
***************
*** 411,422 ****
       ury = (int)ceil(ury * scaley);

       /* adjust for any border margin */
-       bd = border_margin;

!       llx -= bd;
!       lly -= bd;
!       urx += bd;
!       ury += bd;

       /* convert ledger (deprecated) to tabloid */
       if (strcasecmp(papersize, "ledger") == 0)
--- 396,406 ----
       ury = (int)ceil(ury * scaley);

       /* adjust for any border margin */

!       llx -= border_margin;
!       lly -= border_margin;
!       urx += border_margin;
!       ury += border_margin;

       /* convert ledger (deprecated) to tabloid */
       if (strcasecmp(papersize, "ledger") == 0)
***************
*** 434,443 ****
           exit (1);
       }

!       if (epsflag) {
!           /* eps, shift figure to 0,0 */
           origx = -llx;
           origy =  ury;
       } else {
           /* postscript, do any orientation and/or centering */
           if (landscape) {
--- 418,431 ----
           exit (1);
       }

!       if (epsflag || pdfflag) {
!           /* eps or pdf, shift figure to 0,0 */
           origx = -llx;
           origy =  ury;
+           if (pdfflag && landscape) {
+               origx = -lly;
+               origy = -llx;
+           }
       } else {
           /* postscript, do any orientation and/or centering */
           if (landscape) {
***************
*** 460,466 ****
       }

       /* finally, adjust by any offset the user wants */
!       if (!epsflag) {
           if (landscape) {
               origx += yoff;
               origy += xoff;
--- 448,454 ----
       }

       /* finally, adjust by any offset the user wants */
!       if (!epsflag || pdfflag) {
           if (landscape) {
               origx += yoff;
               origy += xoff;
***************
*** 491,510 ****
       /* calc initial clipping area to size of the bounding box (this is needed
               for later clipping by arrowheads */
       cliplx = cliply = 0;
!       if (epsflag) {
           clipux = urx-llx;
           clipuy = ury-lly;
           pages = 1;
       } else {
           if (landscape) {
               clipux = pageheight;
               clipuy = pagewidth;
!               pages = (urx/pageheight+1)*(ury/pagewidth+1);
               fprintf(tfp, "%%%%Orientation: Landscape\n");
           } else {
               clipux = pagewidth;
               clipuy = pageheight;
!               pages = (urx/pagewidth+1)*(ury/pageheight+1);
               fprintf(tfp, "%%%%Orientation: Portrait\n");
           }
           /* only print Pages if PostScript */
--- 479,506 ----
       /* calc initial clipping area to size of the bounding box (this is needed
               for later clipping by arrowheads */
       cliplx = cliply = 0;
!       if (epsflag || pdfflag) {
           clipux = urx-llx;
           clipuy = ury-lly;
+           if (pdfflag && landscape) {
+               clipux = ury-lly;
+               clipuy = urx-llx;
+           }
           pages = 1;
       } else {
           if (landscape) {
               clipux = pageheight;
               clipuy = pagewidth;
!               /* account for overlap */
!               pages = (int)(1.11111*(urx-0.1*pageheight)/pageheight+1)*
!                               (int)(1.11111*(ury-0.1*pagewidth)/pagewidth+1);
               fprintf(tfp, "%%%%Orientation: Landscape\n");
           } else {
               clipux = pagewidth;
               clipuy = pageheight;
!               /* account for overlap */
!               pages = (int)(1.11111*(urx-0.1*pagewidth)/pagewidth+1)*
!                               (int)(1.11111*(ury-0.1*pageheight)/pageheight+1);
               fprintf(tfp, "%%%%Orientation: Portrait\n");
           }
           /* only print Pages if PostScript */
***************
*** 513,523 ****
       fprintf(tfp, "%%%%BoundingBox: %d %d %d %d\n",
                       cliplx, cliply, clipux, clipuy);

!       /* only include a pagesize command if not EPS */
!       if (!epsflag) {
           fprintf(tfp, "%%%%BeginSetup\n");
           fprintf(tfp, "%%%%IncludeFeature: *PageSize %s\n", papersize);
           fprintf(tfp, "%%%%EndSetup\n");
       }

       /* put in the magnification for information purposes */
--- 509,525 ----
       fprintf(tfp, "%%%%BoundingBox: %d %d %d %d\n",
                       cliplx, cliply, clipux, clipuy);

!       /* only include a pagesize command if PS */
!       if (!epsflag && !pdfflag) {
           fprintf(tfp, "%%%%BeginSetup\n");
           fprintf(tfp, "%%%%IncludeFeature: *PageSize %s\n", papersize);
           fprintf(tfp, "%%%%EndSetup\n");
+       } else if (pdfflag) {
+           /* set the page size for PDF */
+           if (landscape)
+               fprintf(tfp, "<< /PageSize [%d %d] >> setpagedevice\n",ury-lly,urx-llx);
+           else
+               fprintf(tfp, "<< /PageSize [%d %d] >> setpagedevice\n",urx-llx,ury-lly);
       }

       /* put in the magnification for information purposes */
***************
*** 540,549 ****
 #endif
       if (libdir != NULL) {
         sprintf(filename, "%s/%s.ps", libdir, papersize);
!         /* get filename like "/usr/local/lib/fig2dev/A3.ps" */
!         fp = fopen(filename, "r");
         if (fp != NULL) {
!           while (fgets(str, sizeof(str), fp)) fputs(str, tfp);
           fclose(fp);
         }
       }
--- 542,553 ----
 #endif
       if (libdir != NULL) {
         sprintf(filename, "%s/%s.ps", libdir, papersize);
!         /* get filename like "/usr/local/lib/fig2dev/A3.ps" and
!            prepend it to the postscript code */
!         fp = fopen(filename, "rb");
         if (fp != NULL) {
!           while (fgets(str, sizeof(str), fp))
!               fputs(str, tfp);
           fclose(fp);
         }
       }
***************
*** 582,593 ****
       if (landscape && !epsflag) {
           fprintf(tfp, " 90 rotate\n");
       }
!       if (coord_system == 2) {
!           fprintf(tfp, "1 -1 scale\n");
!       }
       if (pats_used) {
           int i;
-           fprintf(tfp, ".9 .9 scale %% to make patterns same scale as in xfig\n");
           fprintf(tfp, "\n%s%s%s", FILL_PROLOG1,FILL_PROLOG2,FILL_PROLOG3);
           fprintf(tfp, "\n%s%s%s", FILL_PROLOG4,FILL_PROLOG5,FILL_PROLOG6);
           fprintf(tfp, "\n%s%s%s", FILL_PROLOG7,FILL_PROLOG8,FILL_PROLOG9);
--- 586,595 ----
       if (landscape && !epsflag) {
           fprintf(tfp, " 90 rotate\n");
       }
!       /* increasing y goes down */
!       fprintf(tfp, "1 -1 scale\n");
       if (pats_used) {
           int i;
           fprintf(tfp, "\n%s%s%s", FILL_PROLOG1,FILL_PROLOG2,FILL_PROLOG3);
           fprintf(tfp, "\n%s%s%s", FILL_PROLOG4,FILL_PROLOG5,FILL_PROLOG6);
           fprintf(tfp, "\n%s%s%s", FILL_PROLOG7,FILL_PROLOG8,FILL_PROLOG9);
***************
*** 596,602 ****
           for (i=0; i<NUMPATTERNS; i++)
               if (pattern_used[i])
                       fprintf(tfp, "\n%s", fill_def[i]);
-           fprintf(tfp, "1.1111 1.1111 scale %%restore scale\n");
       }
       fprintf(tfp, "\n%s", BEGIN_PROLOG2);
       if (iso_text_exist(objects)) {
--- 598,603 ----
***************
*** 622,628 ****
           }
           sprintf(filename, "%s/%s.ps", libdir, locale);
           /* get filename like ``/usr/local/lib/fig2dev/japanese.ps'' */
!           fp = fopen(filename, "r");
           if (fp == NULL) {
               fprintf(stderr, "fig2dev: can't open file: %s\n", filename);
           } else {
--- 623,629 ----
           }
           sprintf(filename, "%s/%s.ps", libdir, locale);
           /* get filename like ``/usr/local/lib/fig2dev/japanese.ps'' */
!           fp = fopen(filename, "rb");
           if (fp == NULL) {
               fprintf(stderr, "fig2dev: can't open file: %s\n", filename);
           } else {
***************
*** 639,645 ****

       fprintf(tfp, "$F2psBegin\n");

!       fprintf(tfp, "%%%%Page: 1 1\n");
       fprintf(tfp, "10 setmiterlimit\n");     /* make like X server (11 degrees) */

       if ( multi_page ) {
--- 640,648 ----

       fprintf(tfp, "$F2psBegin\n");

!       /* multipage will print the page numbers in genps_end() */
!       if (!multi_page)
!           fprintf(tfp, "%%%%Page: 1 1\n");
       fprintf(tfp, "10 setmiterlimit\n");     /* make like X server (11 degrees) */

       if ( multi_page ) {
***************
*** 649,654 ****
--- 652,661 ----
           if (!epsflag)
               fprintf(tfp,"%%%%Page: 1 1\n");
       }
+
+       fprintf(tfp,"%%\n");
+       fprintf(tfp,"%% Fig objects follow\n");
+       fprintf(tfp,"%%\n");
 }

 int
***************
*** 671,679 ****
           if (landscape) {
              fprintf(tfp, " 90 rot");
           }
!           if (coord_system == 2) {
!               fprintf(tfp, " 1 -1 sc\n");
!           }
           fprintf(tfp, " %.3f %.3f sc\n", scalex, scaley);
           for (i=0; i<no_obj; i++) {
              fprintf(tfp, "o%d ", i);
--- 678,685 ----
           if (landscape) {
              fprintf(tfp, " 90 rot");
           }
!           /* increasing y goes down */
!           fprintf(tfp, " 1 -1 sc\n");
           fprintf(tfp, " %.3f %.3f sc\n", scalex, scaley);
           for (i=0; i<no_obj; i++) {
              fprintf(tfp, "o%d ", i);
***************
*** 703,734 ****
 int   s;
 double        v;
 {
!       v /= 80.0 / (double)resolution;
       if (s == DASH_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d] 0 sd\n", round(v));
           }
       else if (s == DOTTED_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d %d] %d sd\n",
!               round(resolution/80.0), round(v), round(v));
           }
       else if (s == DASH_DOT_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d %d %d %d] 0 sd\n",
               round(v), round(v*0.5),
!               round(resolution/80.0), round(v*0.5));
           }
       else if (s == DASH_2_DOTS_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d %d %d %d %d %d] 0 sd\n",
               round(v), round(v*0.45),
!               round(resolution/80.0), round(v*0.333),
!               round(resolution/80.0), round(v*0.45));
           }
       else if (s == DASH_3_DOTS_LINE) {
           if (v > 0.0) fprintf(tfp,
                 " [%d %d %d %d %d %d %d %d ] 0 sd\n",
               round(v), round(v*0.4),
!               round(resolution/80.0), round(v*0.3),
!               round(resolution/80.0), round(v*0.3),
!               round(resolution/80.0), round(v*0.4));
           }
       }

--- 709,740 ----
 int   s;
 double        v;
 {
!       v /= 80.0 / ppi;
       if (s == DASH_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d] 0 sd\n", round(v));
           }
       else if (s == DOTTED_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d %d] %d sd\n",
!               round(ppi/80.0), round(v), round(v));
           }
       else if (s == DASH_DOT_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d %d %d %d] 0 sd\n",
               round(v), round(v*0.5),
!               round(ppi/80.0), round(v*0.5));
           }
       else if (s == DASH_2_DOTS_LINE) {
           if (v > 0.0) fprintf(tfp, " [%d %d %d %d %d %d] 0 sd\n",
               round(v), round(v*0.45),
!               round(ppi/80.0), round(v*0.333),
!               round(ppi/80.0), round(v*0.45));
           }
       else if (s == DASH_3_DOTS_LINE) {
           if (v > 0.0) fprintf(tfp,
                 " [%d %d %d %d %d %d %d %d ] 0 sd\n",
               round(v), round(v*0.4),
!               round(ppi/80.0), round(v*0.3),
!               round(ppi/80.0), round(v*0.3),
!               round(ppi/80.0), round(v*0.4));
           }
       }

***************
*** 783,836 ****
           }
       }

- FILE  *open_picfile();
- void  close_picfile();
- int   filtype;
- extern        int     read_gif();
- extern        int     read_pcx();
- extern        int     read_eps();
- extern        int     read_pdf();
- extern        int     read_ppm();
- extern        int     read_tif();
- extern        int     read_xbm();
- #ifdef USE_JPEG
- extern        int     read_jpg();
- #endif
- #ifdef USE_XPM
- extern        int     read_xpm();
- #endif
-
- /* headers for various image files */
-
- static         struct hdr {
-           char        *type;
-           char        *bytes;
-           int          nbytes;
-           int         (*readfunc)();
-           Boolean     pipeok;
-       }
-       headers[]= {    {"GIF", "GIF",              3, read_gif,        True},
- #ifdef V4_0
-                       {"FIG", "#FIG",             4, read_figure,     True},
- #endif /* V4_0 */
-                       {"PCX", "\012\005\001",     3, read_pcx,        True},
-                       {"EPS", "%!",               2, read_eps,        True},
-                       {"PDF", "%PDF",             4, read_pdf,        True},
-                       {"PPM", "P3",               2, read_ppm,        True},
-                       {"PPM", "P6",               2, read_ppm,        True},
-                       {"TIFF", "DD*\000",         4, read_tif,        False},
-                       {"TIFF", "MM\000*",         4, read_tif,        False},
-                       {"XBM", "#define",          7, read_xbm,        True},
- #ifdef USE_JPEG
-                       {"JPEG", "\377\330\377\340", 4, read_jpg,       True},
- #endif
- #ifdef USE_XPM
-                       {"XPM", "/* XPM */",        9, read_xpm,        False},
- #endif
-                       };
-
- #define NUMHEADERS sizeof(headers)/sizeof(headers[0])
-

 void
 genps_line(l)
--- 789,794 ----
***************
*** 932,940 ****

               fprintf(tfp, "%%\n");

               /* open the file and read a few bytes of the header to see what it is */
               if ((picf=open_picfile(l->pic->file, &filtype, True, realname)) == NULL) {
!                       fprintf(stderr,"No such picture file: %s",l->pic->file);
                       return;
               }

--- 890,901 ----

               fprintf(tfp, "%%\n");

+               fprintf(tfp, "%% pen to black in case this eps object doesn't set color first\n");
+               fprintf(tfp, "0 0 0 setrgbcolor\n");
+
               /* open the file and read a few bytes of the header to see what it is */
               if ((picf=open_picfile(l->pic->file, &filtype, True, realname)) == NULL) {
!                       fprintf(stderr,"No such picture file: %s\n",l->pic->file);
                       return;
               }

***************
*** 962,968 ****

                   if (headers[i].pipeok) {
                       if (((*headers[i].readfunc)(picf,filtype,l->pic,&llx,&lly)) == 0) {
!                           fprintf(stderr,"%s: Bad %s format",l->pic->file, headers[i].type);
                           close_picfile(picf,filtype);
                           return;
                       }
--- 923,929 ----

                   if (headers[i].pipeok) {
                       if (((*headers[i].readfunc)(picf,filtype,l->pic,&llx,&lly)) == 0) {
!                           fprintf(stderr,"%s: Bad %s format\n",l->pic->file, headers[i].type);
                           close_picfile(picf,filtype);
                           return;
                       }
***************
*** 969,975 ****
                   } else {
                       /* routines that can't take a pipe (e.g. xpm) get the real filename */
                       if (((*headers[i].readfunc)(realname,filtype,l->pic,&llx,&lly)) == 0) {
!                           fprintf(stderr,"%s: Bad %s format",l->pic->file, headers[i].type);
                           close_picfile(picf,filtype);
                           return;
                       }
--- 930,936 ----
                   } else {
                       /* routines that can't take a pipe (e.g. xpm) get the real filename */
                       if (((*headers[i].readfunc)(realname,filtype,l->pic,&llx,&lly)) == 0) {
!                           fprintf(stderr,"%s: Bad %s format\n",l->pic->file, headers[i].type);
                           close_picfile(picf,filtype);
                           return;
                       }
***************
*** 1156,1165 ****
                           fprintf(tfp, "%% JPEG image follows:\n");
                       /* scale for size in bits */
                       fprintf(tfp, "%d %d sc\n", urx, ury);
!                       /* now write out the image data in a compressed form */
!                       (void) PSencode(tfp, wid, ht, l->pic->numcols,
                               l->pic->cmap[0], l->pic->cmap[1], l->pic->cmap[2],
                               l->pic->bitmap);

               /* EPS file */
               } else if (l->pic->subtype == P_EPS) {
--- 1117,1131 ----
                           fprintf(tfp, "%% JPEG image follows:\n");
                       /* scale for size in bits */
                       fprintf(tfp, "%d %d sc\n", urx, ury);
!                       if (l->pic->numcols > 256) {
!                           /* 24-bit image, write rgb values */
!                           (void) PSrgbimage(tfp, wid, ht, l->pic->bitmap);
!                       } else {
!                           /* now write out the image data in a compressed form */
!                           (void) PSencode(tfp, wid, ht, l->pic->numcols,
                               l->pic->cmap[0], l->pic->cmap[1], l->pic->cmap[2],
                               l->pic->bitmap);
+                       }

               /* EPS file */
               } else if (l->pic->subtype == P_EPS) {
***************
*** 1167,1173 ****
                   fprintf(tfp, "%% EPS file follows:\n");
                   if ((picf=open_picfile(l->pic->file, &filtype, True, realname)) == NULL) {
                       fprintf(stderr, "Unable to open EPS file '%s': error: %s (%d)\n",
!                               l->pic->file, sys_errlist[errno],errno);
                       fprintf(tfp, "gr\n");
                       return;
                   }
--- 1133,1139 ----
                   fprintf(tfp, "%% EPS file follows:\n");
                   if ((picf=open_picfile(l->pic->file, &filtype, True, realname)) == NULL) {
                       fprintf(stderr, "Unable to open EPS file '%s': error: %s (%d)\n",
!                               l->pic->file, strerror(errno),errno);
                       fprintf(tfp, "gr\n");
                       return;
                   }
***************
*** 1493,1502 ****
       sx = a->point[0].x; sy = a->point[0].y;
       ex = a->point[2].x; ey = a->point[2].y;

!       if (coord_system != 2)
!           direction = !a->direction;
!       else
!           direction = a->direction;
       set_linewidth((double)a->thickness);
       set_linecap(a->cap_style);
       dx = cx - sx;
--- 1459,1465 ----
       sx = a->point[0].x; sy = a->point[0].y;
       ex = a->point[2].x; ey = a->point[2].y;

!       direction = a->direction;
       set_linewidth((double)a->thickness);
       set_linecap(a->cap_style);
       dx = cx - sx;
***************
*** 1615,1621 ****
       unsigned char ch;
 #endif /* I18N */

!       /* ignore hidden text (new for xfig3.2.3/fig2dev3.2.2) */
       if (hidden_text(t))
           return;

--- 1578,1584 ----
       unsigned char ch;
 #endif /* I18N */

!       /* ignore hidden text (new for xfig3.2.3/fig2dev3.2.3) */
       if (hidden_text(t))
           return;

***************
*** 1642,1649 ****
          fprintf(tfp, TEXT_PS, PSFONT(t), "", PSFONTMAG(t));

       fprintf(tfp, "%d %d m\ngs ", t->base_x,  t->base_y);
!       if (coord_system == 2)
!               fprintf(tfp, "1 -1 sc ");

       if (t->angle != 0)
          fprintf(tfp, " %.1f rot ", t->angle*180.0/M_PI);
--- 1605,1611 ----
          fprintf(tfp, TEXT_PS, PSFONT(t), "", PSFONTMAG(t));

       fprintf(tfp, "%d %d m\ngs ", t->base_x,  t->base_y);
!       fprintf(tfp, "1 -1 sc ");

       if (t->angle != 0)
          fprintf(tfp, " %.1f rot ", t->angle*180.0/M_PI);
***************
*** 1840,2072 ****
     fprintf(tfp, "eoclip\n");
 }

- /****************************************************************
-
-  calc_arrow - calculate points heading from (x1, y1) to (x2, y2)
-
-  Must pass POINTER to npoints for return value and for c1x, c1y,
-  c2x, c2y, which are two points at the end of the arrowhead so:
-
-               |\     + (c1x,c1y)
-               |  \
-               |    \
-  ---------------|      \
-               |      /
-               |    /
-               |  /
-               |/     + (c2x,c2y)
-
-
-  Fills points array with npoints arrowhead coordinates
-
- ****************************************************************/
-
- static
- calc_arrow(x1, y1, x2, y2, c1x, c1y, c2x, c2y, arrow, points, npoints, nboundpts)
-     int                   x1, y1, x2, y2;
-     int                  *c1x, *c1y, *c2x, *c2y;
-     F_arrow      *arrow;
-     Point         points[];
-     int                  *npoints, *nboundpts;
- {
-     double        x, y, xb, yb, dx, dy, l, sina, cosa;
-     double        mx, my;
-     double        ddx, ddy, lpt, tipmv;
-     double        alpha;
-     double        miny, maxy;
-     double        thick;
-     int                   xa, ya, xs, ys;
-     double        xt, yt;
-     float         wd = arrow->wid;
-     float         ht = arrow->ht;
-     int                   type, style, indx;
-     int                   i, np;
-
-     /* types = 0...10 */
-     type = arrow->type;
-     /* style = 0 (unfilled) or 1 (filled) */
-     style = arrow->style;
-     /* index into shape array */
-     indx = 2*type + style;
-
-     *npoints = 0;
-     dx = x2 - x1;
-     dy = y1 - y2;
-     if (dx==0 && dy==0)
-       return;
-
-     /* lpt is the amount the arrowhead extends beyond the end of the
-        line because of the sharp point (miter join) */
-
-     tipmv = arrow_shapes[indx].tipmv;
-     lpt = 0.0;
-     /* lines are made a little thinner in set_linewidth */
-     thick = (arrow->thickness <= THICK_SCALE) ?
-               0.5* arrow->thickness :
-               arrow->thickness - THICK_SCALE;
-     if (tipmv > 0.0)
-         lpt = thick / (2.0 * sin(atan(wd / (tipmv * ht))));
-     else if (tipmv == 0.0)
-       lpt = thick / 3.0;       /* types which have blunt end */
-     /* (Don't adjust those with tipmv < 0) */
-
-     /* alpha is the angle the line is relative to horizontal */
-     alpha = atan2(dy,-dx);
-
-     /* ddx, ddy is amount to move end of line back so that arrowhead point
-        ends where line used to */
-     ddx = lpt * cos(alpha);
-     ddy = lpt * sin(alpha);
-
-     /* move endpoint of line back */
-     mx = x2 + ddx;
-     my = y2 + ddy;
-
-     l = sqrt(dx * dx + dy * dy);
-     sina = dy / l;
-     cosa = dx / l;
-     xb = mx * cosa - my * sina;
-     yb = mx * sina + my * cosa;
-
-     /* (xa,ya) is the rotated endpoint */
-     xa =  xb * cosa + yb * sina + 0.5;
-     ya = -xb * sina + yb * cosa + 0.5;
-
-     /*
-      * We approximate circles with an octagon since, at small sizes,
-      * this is sufficient.  I haven't bothered to alter the bounding
-      * box calculations.
-      */
-     miny =  100000.0;
-     maxy = -100000.0;
-     if (type == 5 || type == 6) {     /* also include half circle */
-       double rmag;
-       double angle, init_angle, rads;
-       double fix_x, fix_y;
-
-       /* get angle of line */
-       init_angle = compute_angle(dx,dy);
-
-       /* (xs,ys) is a point the length (height) of the arrowhead BACK from
-          the end of the shaft */
-       /* for the half circle, use 0.0 */
-       xs =  (xb-(type==5? ht: 0.0)) * cosa + yb * sina + 0.5;
-       ys = -(xb-(type==5? ht: 0.0)) * sina + yb * cosa + 0.5;
-
-       /* calc new (dx, dy) from moved endpoint to (xs, ys) */
-       dx = mx - xs;
-       dy = my - ys;
-       /* radius */
-       rmag = ht/2.0;
-       fix_x = xs + (dx / (double) 2.0);
-       fix_y = ys + (dy / (double) 2.0);
-       /* choose number of points for circle - 20+mag/4 points */
-       np = round(mag/4.0) + 20;
-       /* full or half circle? */
-       rads = (type==5? M_2PI: M_PI);
-
-       if (type == 5) {
-           init_angle = 5.0*M_PI_2 - init_angle;
-           /* np/2 points in the forward part of the circle for the line clip area */
-           *nboundpts = np/2;
-           /* full circle */
-           rads = M_2PI;
-       } else {
-           init_angle = 3.0*M_PI_2 - init_angle;
-           /* no points in the line clip area */
-           *nboundpts = 0;
-           /* half circle */
-           rads = M_PI;
-       }
-       /* draw the half or full circle */
-       for (i = 0; i < np; i++) {
-           if (type == 5)
-               angle = init_angle - (rads * (double) i / (double) np);
-           else
-               angle = init_angle - (rads * (double) i / (double) (np-1));
-           x = fix_x + round(rmag * cos(angle));
-           points[*npoints].x = x;
-           y = fix_y + round(rmag * sin(angle));
-           points[*npoints].y = y;
-           miny = min2(y, miny);
-           maxy = max2(y, maxy);
-           (*npoints)++;
-       }
-       x = 2.0*THICK_SCALE;
-       y = rmag;
-       xt =  x*cosa + y*sina + x2;
-       yt = -x*sina + y*cosa + y2;
-       *c1x = xt;
-       *c1y = yt;
-       y = -rmag;
-       xt =  x*cosa + y*sina + x2;
-       yt = -x*sina + y*cosa + y2;
-       *c2x = xt;
-       *c2y = yt;
-     } else {
-       /* 3 points in the arrowhead that define the line clip part */
-       *nboundpts = 3;
-       np = arrow_shapes[indx].numpts;
-       for (i=0; i<np; i++) {
-           x = arrow_shapes[indx].points[i].x * ht;
-           y = arrow_shapes[indx].points[i].y * wd;
-           miny = min2(y, miny);
-           maxy = max2(y, maxy);
-           xt =  x*cosa + y*sina + xa;
-           yt = -x*sina + y*cosa + ya;
-           points[*npoints].x = xt;
-           points[*npoints].y = yt;
-           (*npoints)++;
-       }
-       x = arrow_shapes[indx].points[arrow_shapes[indx].tipno].x * ht + THICK_SCALE;
-       y = maxy;
-       xt =  x*cosa + y*sina + x2;
-       yt = -x*sina + y*cosa + y2;
-       *c1x = xt;
-       *c1y = yt;
-       y = miny;
-       xt =  x*cosa + y*sina + x2;
-       yt = -x*sina + y*cosa + y2;
-       *c2x = xt;
-       *c2y = yt;
-     }
- }
-
- /********************* COMPUTE ANGLE ************************
-
- Input arguments :
-       (dx,dy) : the vector (0,0)(dx,dy)
- Output arguments : none
- Return value : the angle of the vector in the range [0, 2PI)
-
- *************************************************************/
-
- double
- compute_angle(dx, dy)         /* compute the angle between 0 to 2PI  */
-     double        dx, dy;
- {
-     double        alpha;
-
-     if (dx == 0) {
-       if (dy > 0)
-           alpha = M_PI_2;
-       else
-           alpha = 3 * M_PI_2;
-     } else if (dy == 0) {
-       if (dx > 0)
-           alpha = 0;
-       else
-           alpha = M_PI;
-     } else {
-       alpha = atan(dy / dx);  /* range = -PI/2 to PI/2 */
-       if (dx < 0)
-           alpha += M_PI;
-       else if (dy < 0)
-           alpha += M_2PI;
-     }
-     return (alpha);
- }
-
 static
 arc_tangent(x1, y1, x2, y2, direction, x, y)
 double        x1, y1, x2, y2;
--- 1802,1807 ----
***************
*** 2083,2134 ****
           }
       }

- /* Computes a point on a line which is a chord to the arc specified by */
- /* center (x1,y1) and endpoint (x2,y2), where the chord intersects the */
- /* arc arrow->ht from the endpoint.                                    */
- /* May give strange values if the arrow.ht is larger than about 1/4 of */
- /* the circumference of a circle on which the arc lies.                */
-
- compute_arcarrow_angle(x1, y1, x2, y2, direction, arrow, x, y)
-     double     x1, y1;
-     double     x2, y2;
-     int               *x, *y;
-     int                direction;
-     F_arrow   *arrow;
- {
-     double     r, alpha, beta, dy, dx;
-     double     lpt,h;
-     double     thick;
-
-     dy=y2-y1;
-     dx=x2-x1;
-     r=sqrt(dx*dx+dy*dy);
-     h = (double) arrow->ht;
-     thick <= THICK_SCALE ?    /* lines are made a little thinner in set_linewidth */
-               0.5* arrow->thickness :
-               arrow->thickness - THICK_SCALE;
-     /* lpt is the amount the arrowhead extends beyond the end of the line */
-     lpt = thick/2.0/(arrow->wid/h/2.0);
-     /* add this to the length */
-     h += lpt;
-
-     /* radius too small for this method, use normal method */
-     if (h > 2.0*r) {
-       arc_tangent(x1,y1,x2,y2,direction,x,y);
-       return;
-     }
-
-     beta=atan2(dy,dx);
-     if (direction) {
-       alpha = 2*asin(h/2.0/r);
-     } else {
-       alpha = -2*asin(h/2.0/r);
-     }
-
-     *x=round(x1+r*cos(beta+alpha));
-     *y=round(y1+r*sin(beta+alpha));
- }
-
 /* uses eofill (even/odd rule fill) */
 /* ulx and uly define the upper-left corner of the object for pattern alignment */

--- 1818,1823 ----
***************
*** 2319,2333 ****
       for (i=0; i<ncols; i++) {
           name = (coltabl+i)->c_color;
           /* get the rgb values from the name */
!           if (lookup_db_color(name, &rgb) < 0)
               fprintf(stderr,"Can't parse color '%s', using black.\n",name);
!           cmap[0][i] = (unsigned char) rgb.red;
!           cmap[1][i] = (unsigned char) rgb.green;
!           cmap[2][i] = (unsigned char) rgb.blue;
       }
 }

 #endif /* USE_XPM */

 struct
 driver dev_ps = {
--- 2008,2024 ----
       for (i=0; i<ncols; i++) {
           name = (coltabl+i)->c_color;
           /* get the rgb values from the name */
!           if (lookup_X_color(name, &rgb) < 0)
               fprintf(stderr,"Can't parse color '%s', using black.\n",name);
!           cmap[0][i] = (unsigned char) (rgb.red>>8);
!           cmap[1][i] = (unsigned char) (rgb.green>>8);
!           cmap[2][i] = (unsigned char) (rgb.blue>>8);
       }
 }

 #endif /* USE_XPM */
+
+ /* driver defs */

 struct
 driver dev_ps = {
diff -rc transfig.3.2.3/fig2dev/dev/genps.h transfig.3.2.3b/fig2dev/dev/genps.h
*** transfig.3.2.3/fig2dev/dev/genps.h  Tue Nov 23 14:41:35 1999
--- transfig.3.2.3b/fig2dev/dev/genps.h Mon May  8 09:48:48 2000
***************
*** 22,28 ****
--- 22,37 ----
  */

 extern Boolean        epsflag;        /* to distinguish PS and EPS */
+ extern Boolean        pdfflag;        /* to distinguish PDF and PS/EPS */

+ extern void   genps_grid();
+ extern void   genps_arc();
+ extern void   genps_ellipse();
+ extern void   genps_line();
+ extern void   genps_spline();
+ extern void   genps_text();
+
+
 #define               BEGIN_PROLOG1   "\
 /$F2psDict 200 dict def\n\
 $F2psDict begin\n\
***************
*** 141,147 ****
       3 index                 % nw nh px py str nh\n\
       {                       % nw nh px py str\n\
         currentpoint          % nw nh px py str cx cy\n\
!         2 index show          % nw nh px py str cx cy\n\
         YStep add moveto      % nw nh px py str\n\
       } repeat                % nw nh px py str\n\
     } for\n\
--- 150,156 ----
       3 index                 % nw nh px py str nh\n\
       {                       % nw nh px py str\n\
         currentpoint          % nw nh px py str cx cy\n\
!         2 index oldshow       % nw nh px py str cx cy\n\
         YStep add moveto      % nw nh px py str\n\
       } repeat                % nw nh px py str\n\
     } for\n\
***************
*** 1094,1100 ****
 8#240 /space 8#241 /exclamdown 8#242 /cent 8#243 /sterling\n\
 8#244 /currency 8#245 /yen 8#246 /brokenbar 8#247 /section 8#250 /dieresis\n\
 8#251 /copyright 8#252 /ordfeminine 8#253 /guillemotleft 8#254 /logicalnot\n\
! 8#255 /hypen 8#256 /registered 8#257 /macron 8#260 /degree 8#261 /plusminus\n\
 8#262 /twosuperior 8#263 /threesuperior 8#264 /acute 8#265 /mu 8#266 /paragraph\n\
 8#267 /periodcentered 8#270 /cedilla 8#271 /onesuperior 8#272 /ordmasculine\n\
 8#273 /guillemotright 8#274 /onequarter 8#275 /onehalf\n\
--- 1103,1109 ----
 8#240 /space 8#241 /exclamdown 8#242 /cent 8#243 /sterling\n\
 8#244 /currency 8#245 /yen 8#246 /brokenbar 8#247 /section 8#250 /dieresis\n\
 8#251 /copyright 8#252 /ordfeminine 8#253 /guillemotleft 8#254 /logicalnot\n\
! 8#255 /hyphen 8#256 /registered 8#257 /macron 8#260 /degree 8#261 /plusminus\n\
 8#262 /twosuperior 8#263 /threesuperior 8#264 /acute 8#265 /mu 8#266 /paragraph\n\
 8#267 /periodcentered 8#270 /cedilla 8#271 /onesuperior 8#272 /ordmasculine\n\
 8#273 /guillemotright 8#274 /onequarter 8#275 /onehalf\n\
diff -rc transfig.3.2.3/fig2dev/dev/genpstex.c transfig.3.2.3b/fig2dev/dev/genpstex.c
*** transfig.3.2.3/fig2dev/dev/genpstex.c       Wed Jan 12 09:15:26 2000
--- transfig.3.2.3b/fig2dev/dev/genpstex.c      Tue Jul 11 14:51:27 2000
***************
*** 136,142 ****
       gendev_null,
       genpstex_t_text,
       genlatex_end,
!       EXCLUDE_TEXT
 };

 struct driver dev_pstex = {
--- 136,142 ----
       gendev_null,
       genpstex_t_text,
       genlatex_end,
!       INCLUDE_TEXT
 };

 struct driver dev_pstex = {
diff -rc transfig.3.2.3/fig2dev/dev/gentextyl.c transfig.3.2.3b/fig2dev/dev/gentextyl.c
*** transfig.3.2.3/fig2dev/dev/gentextyl.c      Wed Nov 24 14:31:19 1999
--- transfig.3.2.3b/fig2dev/dev/gentextyl.c     Tue Jul 11 14:51:30 2000
***************
*** 44,50 ****
 static arc_tangent();
 static rtop();

- static int            coord_system;
 static double         dash_length = -1;
 static int            line_style = 0; /* Textyl solid line style */
 static int            linethick = 2;  /* Range is 1-12 `pixels' */
--- 44,49 ----
***************
*** 103,110 ****

 #define                       TOP     (10.5)  /* top of page is 10.5 inch */
 #define SCALE (65536.0*72.27)
- static double         ppi;
- static int            CONV = 0;
 #define measure 'S'

 convy(a)
--- 102,107 ----
***************
*** 127,137 ****

       texfontsizes[0] = texfontsizes[1] =
               texfontsizes[(font_size?font_size:DEFAULT_FONT_SIZE)+1];
-       coord_system = objects->nwcorner.y;
-       ppi = objects->nwcorner.x;
-
-       if (coord_system == 2)
-               CONV = 1;

       /* print any whole-figure comments prefixed with "%" */
       if (objects->comments) {
--- 124,129 ----
diff -rc transfig.3.2.3/fig2dev/dev/gentk.c transfig.3.2.3b/fig2dev/dev/gentk.c
*** transfig.3.2.3/fig2dev/dev/gentk.c  Tue Dec 21 09:52:12 1999
--- transfig.3.2.3b/fig2dev/dev/gentk.c Tue Jul 11 14:51:33 2000
***************
*** 31,37 ****
 #endif

 #define X(x) ((double)(x)/ppi)
! #define Y(y) (CONV ? (TOP - ((double)(y)/ppi)) : ((double)(y)/ppi))

 #define NONE (0xffffff + 1)

--- 31,37 ----
 #endif

 #define X(x) ((double)(x)/ppi)
! #define Y(y) ((double)(y)/ppi)

 #define NONE (0xffffff + 1)

***************
*** 56,63 ****
 static char *xbmPathName = BITMAPDIR;

 #define               TOP     8.5 /* inches */
- static double   ppi;
- static int      CONV = 0;
 static int    full_page = False;

 /*
--- 56,61 ----
***************
*** 111,125 ****
 gentk_start(F_compound *objects)
 {
       char            stfp[128];
-       int             coord_system;
       float           wid, ht, swap;
       struct paperdef *pd;

       /* adjust ppi for the difference of screen dots to points */
!       ppi = objects->nwcorner.x / mag * 80.0/72.0;
!       coord_system = objects->nwcorner.y;
!       if (coord_system == 1)
!               CONV = 1;

       /* print any whole-figure comments prefixed with "#" */
       if (objects->comments) {
--- 109,119 ----
 gentk_start(F_compound *objects)
 {
       char            stfp[128];
       float           wid, ht, swap;
       struct paperdef *pd;

       /* adjust ppi for the difference of screen dots to points */
!       ppi = ppi / mag * 80.0/72.0;

       /* print any whole-figure comments prefixed with "#" */
       if (objects->comments) {
***************
*** 272,286 ****
       case T_ELLIPSE_BY_DIA:
       case T_ELLIPSE_BY_RAD:
               if (e->style > 0)
!                       fprintf(stderr, "gentk_ellipse: only solid lines "
!                               "supported.\n");
               drawShape(tkEllipse, (void *) e, e->thickness,
                       e->pen_color, e->fill_color, e->fill_style);
               break;
       default:
               /* Stole this line from Netscape 3.03... */
!               fprintf(stderr, "gentk_ellipse: Whatchew talkin' 'bout, "
!                       "Willis?\n");
               return;
               break;
     }
--- 266,278 ----
       case T_ELLIPSE_BY_DIA:
       case T_ELLIPSE_BY_RAD:
               if (e->style > 0)
!                   fprintf(stderr, "gentk_ellipse: only solid lines supported.\n");
               drawShape(tkEllipse, (void *) e, e->thickness,
                       e->pen_color, e->fill_color, e->fill_style);
               break;
       default:
               /* Stole this line from Netscape 3.03... */
!               fprintf(stderr, "gentk_ellipse: Whatchew talkin' 'bout, Willis?\n");
               return;
               break;
     }
***************
*** 313,320 ****
               break;
       case T_POLYGON:
               if (l->style > 0) {
!                       fprintf(stderr, "gentk_line: only solid line "
!                               "styles supported.\n");
               }
               drawShape(tkPolygon, (void *) l->points, l->thickness,
                       l->pen_color, l->fill_color, l->fill_style);
--- 305,311 ----
               break;
       case T_POLYGON:
               if (l->style > 0) {
!                   fprintf(stderr, "gentk_line: only solid line styles supported.\n");
               }
               drawShape(tkPolygon, (void *) l->points, l->thickness,
                       l->pen_color, l->fill_color, l->fill_style);
***************
*** 336,341 ****
--- 327,333 ----
 {
       char    stfp[128];
       double  dx, dy;
+       int     x, y;
       F_pic   *p;
       unsigned char   buf[16];
       FILE    *fd;
***************
*** 350,357 ****
       dx = l->points->next->next->x - l->points->x;
       dy = l->points->next->next->y - l->points->y;
       if (!(dx >= 0. && dy >= 0.))
!               fprintf(stderr, "drawBitmap: rotated bitmaps not supprted"
!                       " by Tk.\n");

       /* see if GIF first */

--- 342,348 ----
       dx = l->points->next->next->x - l->points->x;
       dy = l->points->next->next->y - l->points->y;
       if (!(dx >= 0. && dy >= 0.))
!           fprintf(stderr, "drawBitmap: rotated bitmaps not supported by Tk.\n");

       /* see if GIF first */

***************
*** 363,417 ****
       /* read header */

       stat = ReadOK(fd,buf,6);
-       close_picfile(fd,filtype);
       if (!stat) {
               fprintf(stderr,"drawBitmap: Bitmap file %s too short\n",p->file);
               return;
       }

       if (strncmp((char *) buf,"GIF",3) == 0) {
!               /* GIF allright, create the image command */
!               /* first make a name without the .gif part */
!               char pname[PATH_MAX], *dot;
!               strcpy(pname,p->file);
!               if (dot=strchr(pname,'.'))
!                       *dot='\0';
!               /* image create */
!               sprintf(stfp, "image create photo %s -file %s\n",pname, p->file);
!               niceLine(stfp);
!               niceLine("\n");
!               /* now the canvas image */
!               sprintf(stfp, "%s create image %fi %fi -anchor nw -image %s",
                       canvas, X(l->points->x), Y(l->points->y), pname);
!               niceLine(stfp);
!               niceLine("\n");
       } else {
           /* Try for an X Bitmap file format. */
!           if (fopen(p->file,"r") == (FILE*) NULL) {
!                   fprintf(stderr,"drawBitmap: can't open bitmap file %s\n",p->file);
!               } else {
!                   if (ReadFromBitmapFile(p->file, &dx, &dy, &p->bitmap)) {
!                       sprintf(stfp, "%s create bitmap %fi %fi -anchor nw",
!                               canvas, X(l->points->x), Y(l->points->y));
!                       niceLine(stfp);
!                       sprintf(stfp, " -bitmap @%s", p->file);
!                       niceLine(stfp);
!                       if (l->pen_color != BLACK_COLOR && l->pen_color != DEFAULT) {
!                               sprintf(stfp, " -foreground #%6.6x",
!                                       rgbColorVal(l->pen_color));
!                               niceLine(stfp);
!                       }
!                       niceLine("\n");
!                       if (l->fill_color != UNFILLED) {
!                               sprintf(stfp, " -background #%6.6x",
!                                       rgbColorVal(l->fill_color));
!                               niceLine(stfp);
!                       }
!                       niceLine("\n");
!                   } else
!                       fprintf(stderr, "drawBitmap: only X bitmap picture objects "
!                               "are supported in Tk canvases.\n");
               }
       }
 }

--- 354,408 ----
       /* read header */

       stat = ReadOK(fd,buf,6);
       if (!stat) {
               fprintf(stderr,"drawBitmap: Bitmap file %s too short\n",p->file);
+               close_picfile(fd,filtype);
               return;
       }

       if (strncmp((char *) buf,"GIF",3) == 0) {
!           /* GIF allright, create the image command */
!           /* first make a name without the .gif part */
!           char pname[PATH_MAX], *dot;
!
!           close_picfile(fd,filtype);
!           strcpy(pname,p->file);
!           if (dot=strchr(pname,'.'))
!               *dot='\0';
!           /* image create */
!           sprintf(stfp, "image create photo %s -file %s\n",pname, p->file);
!           niceLine(stfp);
!           niceLine("\n");
!           /* now the canvas image */
!           sprintf(stfp, "%s create image %fi %fi -anchor nw -image %s",
                       canvas, X(l->points->x), Y(l->points->y), pname);
!           niceLine(stfp);
!           niceLine("\n");
       } else {
           /* Try for an X Bitmap file format. */
!           rewind(fd);
!           if (ReadFromBitmapFile(fd, &x, &y, &p->bitmap)) {
!               sprintf(stfp, "%s create bitmap %fi %fi -anchor nw",
!                       canvas, X(l->points->x), Y(l->points->y));
!               niceLine(stfp);
!               sprintf(stfp, " -bitmap @%s", p->file);
!               niceLine(stfp);
!               if (l->pen_color != BLACK_COLOR && l->pen_color != DEFAULT) {
!                       sprintf(stfp, " -foreground #%6.6x",
!                               rgbColorVal(l->pen_color));
!                       niceLine(stfp);
!               }
!               niceLine("\n");
!               if (l->fill_color != UNFILLED) {
!                       sprintf(stfp, " -background #%6.6x",
!                               rgbColorVal(l->fill_color));
!                       niceLine(stfp);
               }
+               niceLine("\n");
+           } else
+               fprintf(stderr, "drawBitmap: only X bitmap picture objects "
+                       "are supported in Tk canvases.\n");
+           close_picfile(fd,filtype);
       }
 }

***************
*** 517,524 ****
       print_comments("# ",t->comments, "");

       if (t->angle != 0.)
!               fprintf(stderr, "gentk_text: rotated text not "
!                       "supported by Tk.\n");

       sprintf(stfp, "%s create text %fi %fi", canvas, X(t->base_x),
               Y(t->base_y));
--- 508,514 ----
       print_comments("# ",t->comments, "");

       if (t->angle != 0.)
!           fprintf(stderr, "gentk_text: rotated text not supported by Tk.\n");

       sprintf(stfp, "%s create text %fi %fi", canvas, X(t->base_x),
               Y(t->base_y));
***************
*** 887,894 ****
                               niceLine(stfp);
                               break;
                       default:
!                               fprintf(stderr, "tkLine: unknown arrow "
!                                       "type.\n");
                               break;
                       }

--- 877,883 ----
                               niceLine(stfp);
                               break;
                       default:
!                               fprintf(stderr, "tkLine: unknown arrow type.\n");
                               break;
                       }

***************
*** 1024,1036 ****
 tkArc(void *shape, unsigned int outlineColor, unsigned int fillColor,
       unsigned int fillPattern, int thickness)
 {
!       char    dir[8], stfp[128];
       double  cx, cy, /* Center of circle containing arc. */
               sx, sy, /* Start point of arc. */
               ex, ey, /* Stop point of arc. */
               angle1, angle2, extent, radius, startAngle;
       F_arc   *a;
-       F_arrow *r;

       a = (F_arc *) shape;
       cx = X(a->center.x);            /* Center. */
--- 1013,1024 ----
 tkArc(void *shape, unsigned int outlineColor, unsigned int fillColor,
       unsigned int fillPattern, int thickness)
 {
!       char    stfp[128];
       double  cx, cy, /* Center of circle containing arc. */
               sx, sy, /* Start point of arc. */
               ex, ey, /* Stop point of arc. */
               angle1, angle2, extent, radius, startAngle;
       F_arc   *a;

       a = (F_arc *) shape;
       cx = X(a->center.x);            /* Center. */
***************
*** 1065,1071 ****
               cx-radius, cy-radius, cx+radius, cy+radius);
       niceLine(stfp);
       /* Start angle in degrees and its extent in degrees. */
!       sprintf(stfp, " -start %lf -extent %lf", startAngle, extent);
       niceLine(stfp);

       if (outlineColor == NONE)
--- 1053,1059 ----
               cx-radius, cy-radius, cx+radius, cy+radius);
       niceLine(stfp);
       /* Start angle in degrees and its extent in degrees. */
!       sprintf(stfp, " -start %f -extent %f", startAngle, extent);
       niceLine(stfp);

       if (outlineColor == NONE)
***************
*** 1119,1125 ****
       F_ellipse       *e;

       e = (F_ellipse *) shape;
!       sprintf(stfp, "%s create oval %lfi %lfi %lfi %lfi",
               canvas,
               X(e->center.x - e->radiuses.x),
               Y(e->center.y - e->radiuses.y),
--- 1107,1113 ----
       F_ellipse       *e;

       e = (F_ellipse *) shape;
!       sprintf(stfp, "%s create oval %fi %fi %fi %fi",
               canvas,
               X(e->center.x - e->radiuses.x),
               Y(e->center.y - e->radiuses.y),
***************
*** 1172,1187 ****

       if (q == NULL) {
               /* Degenerate line (single point). */
!               sprintf(stfp, "%s create line %lfi %lfi %lfi %lfi",
                       canvas, X(p->x), Y(p->y), X(p->x), Y(p->y));
               niceLine(stfp);
       } else {
               sprintf(stfp, "%s create line", canvas);
               niceLine(stfp);
!               sprintf(stfp, " %lfi %lfi", X(p->x), Y(p->y));
               niceLine(stfp);
               for ( /* No op. */ ; q != NULL; q = q->next) {
!                       sprintf(stfp, " %lfi %lfi", X(q->x), Y(q->y));
                       niceLine(stfp);
               }
       }
--- 1160,1175 ----

       if (q == NULL) {
               /* Degenerate line (single point). */
!               sprintf(stfp, "%s create line %fi %fi %fi %fi",
                       canvas, X(p->x), Y(p->y), X(p->x), Y(p->y));
               niceLine(stfp);
       } else {
               sprintf(stfp, "%s create line", canvas);
               niceLine(stfp);
!               sprintf(stfp, " %fi %fi", X(p->x), Y(p->y));
               niceLine(stfp);
               for ( /* No op. */ ; q != NULL; q = q->next) {
!                       sprintf(stfp, " %fi %fi", X(q->x), Y(q->y));
                       niceLine(stfp);
               }
       }
***************
*** 1309,1318 ****
       q = p->next;
       sprintf(stfp, "%s create polygon", canvas);
       niceLine(stfp);
!       sprintf(stfp, " %lfi %lfi", X(p->x), Y(p->y));
       niceLine(stfp);
       for ( /* No op. */ ; q != NULL; q = q->next) {
!               sprintf(stfp, " %lfi %lfi", X(q->x), Y(q->y));
               niceLine(stfp);
       }

--- 1297,1306 ----
       q = p->next;
       sprintf(stfp, "%s create polygon", canvas);
       niceLine(stfp);
!       sprintf(stfp, " %fi %fi", X(p->x), Y(p->y));
       niceLine(stfp);
       for ( /* No op. */ ; q != NULL; q = q->next) {
!               sprintf(stfp, " %fi %fi", X(q->x), Y(q->y));
               niceLine(stfp);
       }

diff -rc transfig.3.2.3/fig2dev/dev/gentpic.c transfig.3.2.3b/fig2dev/dev/gentpic.c
*** transfig.3.2.3/fig2dev/dev/gentpic.c        Wed Nov 24 14:31:24 1999
--- transfig.3.2.3b/fig2dev/dev/gentpic.c       Tue Jul 11 14:51:36 2000
***************
*** 85,92 ****
 #define TPIC_ARC_BOX

 #define                       TOP     10.5    /* top of page is 10.5 inch */
- static double         ppi;
- static int            CONV = 0;
 static int            line_width = 8; /* milli-inches */
 static int            vfont = 0; /* true if using a virtual TeX font */

--- 85,90 ----
***************
*** 129,148 ****
 static double convy(a)
 double        a;
 {
!       return((double)(CONV ? TOP-a : a));
 }

 void gentpic_start(objects)
 F_compound    *objects;
 {
!       int             coord_system;

-       ppi = objects->nwcorner.x/mag;
-       coord_system = objects->nwcorner.y;
-       if (coord_system == 2) CONV = 1;
-
       fprintf(tfp, ".PS\n");  /* PIC preamble */
-
 }

 int
--- 127,141 ----
 static double convy(a)
 double        a;
 {
!       return((double) TOP-a);
 }

 void gentpic_start(objects)
 F_compound    *objects;
 {
!       ppi = ppi/mag;

       fprintf(tfp, ".PS\n");  /* PIC preamble */
 }

 int
diff -rc transfig.3.2.3/fig2dev/dev/psencode.c transfig.3.2.3b/fig2dev/dev/psencode.c
*** transfig.3.2.3/fig2dev/dev/psencode.c       Wed Nov 24 14:31:26 1999
--- transfig.3.2.3b/fig2dev/dev/psencode.c      Tue Jul 11 09:38:18 2000
***************
*** 162,169 ****
     sprintf(s,"%02x%02x%02x", R[k], G[k], B[k]);   put_string;
     if (k % 10 == 9 || k == Ncol-1) {
       sprintf(s,"\n");                             put_string;
-     }else{
-       sprintf(s," ");                              put_string;
     }
   }

--- 162,167 ----
***************
*** 208,211 ****
--- 206,248 ----
   s[nc]   = '\0';
   put_string;
   return Nbyte;
+ }
+
+
+ /* write 24-bit bitmap as PostScript image (no colortable) */
+
+ void
+ PSrgbimage(file, width, height, data)
+        FILE           *file;
+          int           width, height;
+        unsigned char  *data;
+ {
+     int                c, h, w, left;
+     unsigned char *p;
+
+     fprintf(file,"/picstr 192 string def\n");
+     fprintf(file,"%d %d 8\n",width, height);
+     fprintf(file,"[%d 0 0 %d 0 %d]\n",width, -height, height);
+     fprintf(file,"{currentfile picstr readhexstring pop}\n");
+     fprintf(file,"false 3 colorimage\n");
+
+     c = 0;
+     p = data;
+     for (h=0; h<height; h++) {
+       for (w=0; w<width; w++) {
+           fprintf(file,"%02x%02x%02x", *(p+2), *(p+1), *p);
+           p += 3;
+           c++;
+           if ((c % 15) == 0)
+               fprintf(file,"\n");
+       }
+     }
+     /* now output zeroes to pad to 64 triples (length of picstr) */
+     left = ((int)((c+63) / 64)) * 64 - c;
+     for (c=0; c<left; c++) {
+       fprintf(file,"000000");
+       if ((c % 12) == 0)
+           fprintf(file,"\n");
+     }
+     fprintf(file,"\n");
 }
diff -rc transfig.3.2.3/fig2dev/dev/psfonts.h transfig.3.2.3b/fig2dev/dev/psfonts.h
*** transfig.3.2.3/fig2dev/dev/psfonts.h        Tue Nov 23 14:40:31 1999
--- transfig.3.2.3b/fig2dev/dev/psfonts.h       Wed May  3 13:56:03 2000
***************
*** 35,38 ****

 #define PSFONTMAG(T)  (((T->size) <= ULIMIT_FONT_SIZE ? \
                                    T->size :  ULIMIT_FONT_SIZE) \
!                                      * resolution/80)
--- 35,38 ----

 #define PSFONTMAG(T)  (((T->size) <= ULIMIT_FONT_SIZE ? \
                                    T->size :  ULIMIT_FONT_SIZE) \
!                                      * ppi/80)
diff -rc transfig.3.2.3/fig2dev/dev/readgif.c transfig.3.2.3b/fig2dev/dev/readgif.c
*** transfig.3.2.3/fig2dev/dev/readgif.c        Tue Dec 21 09:51:42 1999
--- transfig.3.2.3b/fig2dev/dev/readgif.c       Fri May 26 10:21:43 2000
***************
*** 90,96 ****
       FILE            *giftopcx;
       int             i, stat, size;
       int             useGlobalColormap;
-       unsigned char   localColorMap[3][MAXCOLORMAPSIZE];
       unsigned int    bitPixel, red, green, blue;
       unsigned char   c;
       char            version[4];
--- 90,95 ----
***************
*** 111,117 ****
       version[3] = '\0';

       if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) {
!               fprintf(stderr,"Unknown GIF version %s",version);
               return 0;
       }

--- 110,116 ----
       version[3] = '\0';

       if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) {
!               fprintf(stderr,"Unknown GIF version %s\n",version);
               return 0;
       }

***************
*** 126,132 ****
       GifScreen.Background      = (unsigned int) buf[5];
       GifScreen.AspectRatio     = (unsigned int) buf[6];

-       /* put in the width/height now in case there is some other failure later */
       if (BitSet(buf[4], LOCALCOLORMAP)) {    /* Global Colormap */
               if (!ReadColorMap(file,GifScreen.BitPixel,pic->cmap)) {
                       return 0;       /* error reading global colormap */
--- 125,130 ----
***************
*** 147,153 ****

               if (c == '!') {                 /* Extension */
                   if (! ReadOK(file,&c,1))
!                       fprintf(stderr,"GIF read error on extention function code");
                   (void) DoGIFextension(file, c);
                   continue;
               }
--- 145,151 ----

               if (c == '!') {                 /* Extension */
                   if (! ReadOK(file,&c,1))
!                       fprintf(stderr,"GIF read error on extention function code\n");
                   (void) DoGIFextension(file, c);
                   continue;
               }
***************
*** 156,161 ****
--- 154,163 ----
                       continue;
               }

+               if (! ReadOK(file,buf,9)) {
+                       return 1;       /* couldn't read left/top/width/height */
+               }
+
               useGlobalColormap = ! BitSet(buf[8], LOCALCOLORMAP);

               bitPixel = 1<<((buf[8]&0x07)+1);
***************
*** 162,168 ****

               if (! useGlobalColormap) {
                   if (!ReadColorMap(file, bitPixel, pic->cmap)) {
!                       fprintf(stderr,"error reading local GIF colormap" );
                       return 1;
                   }
               }
--- 164,170 ----

               if (! useGlobalColormap) {
                   if (!ReadColorMap(file, bitPixel, pic->cmap)) {
!                       fprintf(stderr,"error reading local GIF colormap\n" );
                       return 1;
                   }
               }
***************
*** 194,205 ****
       }
       /* close pipe */
       pclose(giftopcx);
!       if ((giftopcx = fopen(pcxname, "r")) == NULL) {
           fprintf(stderr,"Can't open temp output file\n");
           return 0;
       }
       /* now call _read_pcx to read the pcx file */
       stat = _read_pcx(giftopcx, pic);

       /* remove temp file */
       unlink(pcxname);
--- 196,209 ----
       }
       /* close pipe */
       pclose(giftopcx);
!       if ((giftopcx = fopen(pcxname, "rb")) == NULL) {
           fprintf(stderr,"Can't open temp output file\n");
           return 0;
       }
       /* now call _read_pcx to read the pcx file */
       stat = _read_pcx(giftopcx, pic);
+       /* close file */
+       fclose(giftopcx);

       /* remove temp file */
       unlink(pcxname);
***************
*** 207,221 ****
       /* now match original transparent colortable index with possibly new
          colortable from ppmtopcx */
       if (pic->transp != -1) {
!           if (useGlobalColormap) {
!               red = GifScreen.ColorMap[RED][pic->transp];
!               green = GifScreen.ColorMap[GREEN][pic->transp];
!               blue = GifScreen.ColorMap[BLUE][pic->transp];
!           } else {
!               red = localColorMap[RED][pic->transp];
!               green = localColorMap[GREEN][pic->transp];
!               blue = localColorMap[BLUE][pic->transp];
!           }
           for (i=0; i<pic->numcols; i++) {
               if (pic->cmap[RED][i] == red &&
                   pic->cmap[GREEN][i] == green &&
--- 211,219 ----
       /* now match original transparent colortable index with possibly new
          colortable from ppmtopcx */
       if (pic->transp != -1) {
!           red = pic->cmap[RED][pic->transp];
!           green = pic->cmap[GREEN][pic->transp];
!           blue = pic->cmap[BLUE][pic->transp];
           for (i=0; i<pic->numcols; i++) {
               if (pic->cmap[RED][i] == red &&
                   pic->cmap[GREEN][i] == green &&
***************
*** 240,246 ****

       for (i = 0; i < number; ++i) {
           if (! ReadOK(fd, rgb, sizeof(rgb))) {
!               fprintf(stderr,"bad GIF colormap" );
               return False;
           }
           cmap[RED][i]   = rgb[RED];
--- 238,244 ----

       for (i = 0; i < number; ++i) {
           if (! ReadOK(fd, rgb, sizeof(rgb))) {
!               fprintf(stderr,"bad GIF colormap\n" );
               return False;
           }
           cmap[RED][i]   = rgb[RED];
diff -rc transfig.3.2.3/fig2dev/dev/readpcx.c transfig.3.2.3b/fig2dev/dev/readpcx.c
*** transfig.3.2.3/fig2dev/dev/readpcx.c        Mon Nov 29 14:52:59 1999
--- transfig.3.2.3b/fig2dev/dev/readpcx.c       Fri Jul 14 10:28:58 2000
***************
*** 17,23 ****
 #include <unistd.h>
 #include "fig2dev.h"
 #include "object.h"
- #include "pcx.h"

 int   _read_pcx();
 void  readpcxhead();
--- 17,22 ----
***************
*** 37,235 ****
       return _read_pcx(file, pic);
 }

! /* _read_pcx() is called from read_pcx(), read_gif(), read_ppm(), read_tif(), and read_epsf().
! */

 void pcx_decode();

! _read_pcx(pcxfile, pic)
     FILE      *pcxfile;
     F_pic     *pic;
 {
!     pcxheadr          pcxhead;        /* PCX header */
!     unsigned short    wid;            /* Width of image */
!     unsigned short    ht;             /* Height of image */
!     unsigned char     *buffer;        /* current input line */
!     int                       i, bufsize;
!
!     fprintf(tfp, "%% Begin Imported PCX File: %s\n\n", pic->file);
!     pic->subtype = P_PCX;
!
!     /* Read the PCX image file header information */
!     (void) readpcxhead(&pcxhead, pcxfile);
!
!     /* Check for FILE stream error */
!     if (ferror(pcxfile)) {
!       return 0;
!     }
!
!     /* Check the identification byte value */
!     if (pcxhead.id != 0x0A) {
!       return 0;
!     }
!
!     /* copy the EGA palette now in case there is no VGA palette later in the file */
!     for (i=0; i<16; i++) {
!       pic->cmap[0][i] = (unsigned short) pcxhead.egapal[i*3];
!       pic->cmap[1][i] = (unsigned short) pcxhead.egapal[i*3+1];
!       pic->cmap[2][i] = (unsigned short) pcxhead.egapal[i*3+2];
!     }
!     pic->numcols = 16;
!
!     /* Calculate size of image in pixels and scan lines */
!     wid = pcxhead.xmax - pcxhead.xmin + 1;
!     ht = pcxhead.ymax - pcxhead.ymin + 1;
!
!     /* put in the width/height now in case there is some other failure later */
!     pic->bit_size.x = wid;
!     pic->bit_size.y = ht;
!
!     /* allocate space for the image (allocate a little more than needed to be safe) */
!     bufsize = wid * (ht+1) + 16;
!     if ((pic->bitmap = (unsigned char*) malloc(bufsize)) == NULL) {
!           return 0;   /* couldn't alloc space for image */
!     }
!
!     buffer = pic->bitmap;
!
!     switch (pcxhead.bppl) {
!       case 1:
!       case 8:
!               pcx_decode(pcxfile, buffer, bufsize, pcxhead.bppl, &pcxhead, wid, ht);
!               break;
!       default:
!                 fprintf(stderr,"Unsupported PCX format in %s",pic->file);
!                 free(pic->bitmap);
!                 return 0;
!     }
!
!     /* See if there is a VGA palette; read it into the pic->cmap */
!     if (pcxhead.vers == 5) {
!       fseek(pcxfile, -769L, SEEK_END);  /* backwards from end of file */
!
!       if (getc(pcxfile) == 0x0C) {    /* VGA Palette ID value */
!           for (i = 0; i < 256; i++) {
!               pic->cmap[0][i] = getc(pcxfile);
!               pic->cmap[1][i] = getc(pcxfile);
!               pic->cmap[2][i] = getc(pcxfile);
           }
!           pic->numcols = 256; /* for a VGA colormap */
       }
-     }
-     return 1;
- }

! unsigned short
! getwrd(file)
! FILE *file;
! {
!     unsigned char c1;
!     c1 = getc(file);
!     return (unsigned short) (c1 + (unsigned char) getc(file)*256);
! }

! void
! readpcxhead(head, pcxfile)
! pcxheadr      *head;
! FILE          *pcxfile;
! {
!     register unsigned short i;

!     head->id  = getc(pcxfile);
!     head->vers        = getc(pcxfile);
!     head->format = getc(pcxfile);
!     head->bppl = getc(pcxfile);
!     head->xmin        = getwrd(pcxfile);
!     head->ymin        = getwrd(pcxfile);
!     head->xmax        = getwrd(pcxfile);
!     head->ymax        = getwrd(pcxfile);
!     head->hdpi        = getwrd(pcxfile);
!     head->vdpi        = getwrd(pcxfile);
!
!     /* Read the EGA Palette */
!     for (i = 0; i < sizeof(head->egapal); i++)
!       head->egapal[i] = getc(pcxfile);
!
!     head->reserv = getc(pcxfile);
!     head->nplanes = getc(pcxfile);
!     head->blp = getwrd(pcxfile);
!     head->palinfo = getwrd(pcxfile);
!     head->hscrnsiz = getwrd(pcxfile);
!     head->vscrnsiz = getwrd(pcxfile);
!
!     /* Read the reserved area at the end of the header */
!     for (i = 0; i < sizeof(head->fill); i++)
!       head->fill[i] = getc(pcxfile);
 }

 void
! pcx_decode(file, image, bufsize, planes, header, w, h)
!     FILE     *file;
!     unsigned  char *image;
!     int       bufsize, planes;
!     pcxheadr *header;
!     int       w,h;
 {
!     int             row, bcnt, bpl, pd;
!     int       i, j, b, cnt;
!     unsigned char mask, plane, pmsk;
!     unsigned char *oimage;
!
!     /* clear area first */
!     bzero((char*)image,bufsize);
!
!     bpl = header->blp;
!     if (planes == 1)
!       pd = (bpl * 8) - w;
!     else
!       pd = bpl - w;
!
!     row = bcnt = 0;
!
!     plane = 0;
!     pmsk = 1;
!     oimage = image;
!
!     while ( (b=getc(file)) != EOF) {
!       if ((b & 0xC0) == 0xC0) {   /* this is a repitition count */
!           cnt = b & 0x3F;
!           b = getc(file);
!           if (b == EOF) {
!               getc(file);
!               return;
!           }
!       } else
!           cnt = 1;
!
!       for (i=0; i<cnt; i++) {
!           if (planes == 1) {
!               for (j=0, mask=0x80; j<8; j++) {
!                   *image++ |= (unsigned char) (((b & mask) ? pmsk : 0));
!                   mask = mask >> 1;
               }
!           } else {
!               *image++ = (unsigned char) b;
!           }
!
!           bcnt++;
!
!           if (bcnt == bpl) {     /* end of a scan line */
!               bcnt = 0;
!               plane++;
!
!               if (plane >= (int) header->nplanes) {   /* go to the next row */
!                   plane = 0;
!                   image -= pd;
!                   oimage = image;
!                   row++;
!                   if (row >= h) {
!                       return;   /* done */
                   }
!               } else {   /* new plane, same row */
!                       image = oimage;
!               }
!           pmsk = 1 << plane;
!           }
!       }
!     }
 }
--- 36,296 ----
       return _read_pcx(file, pic);
 }

! /* pcx2ppm 1.2 - convert pcx to ppm
!  * based on zgv's readpcx.c
!  * public domain by RJM
!  *
!  * this is incredibly messy
!  *
!  * 1999-03-16 updated to support 24-bit.
!  */
!
! typedef unsigned char byte;
!
! struct pcxhed
!   {
!   byte manuf,ver,encod,bpp;           /* 0 - 3 gen format */
!   byte x1lo,x1hi,y1lo,y1hi;           /* 4 - 11 size */
!   byte x2lo,x2hi,y2lo,y2hi;
!   byte unused1[4];                    /* 12 - 15 scrn size */
!   byte pal16[48];                     /* 16 - 63 4-bit palette */
!   byte reserved;                      /* 64 reserved */
!   byte nplanes;                               /* 65 num of bitplanes */
!   byte bytelinelo,bytelinehi;         /* 66 - 67 bytes per line */
!   byte unused2[60];                   /* 68 - 127 unused */
!   };  /* palette info is after image data */
!
!
! /* prototypes */
! void dispbyte(unsigned char *ptr,int *xp,int *yp,int c,int w,int h,
!               int real_bpp,int byteline,int *planep,int *pmaskp);
!
!
! /* _read_pcx() is called from read_pcx(), read_gif(), read_ppm(),
!    read_tif() and read_epsf().
!  */

 void pcx_decode();

! _read_pcx(pcxfile,pic)
     FILE      *pcxfile;
     F_pic     *pic;
 {
!       int              w,h,bytepp,x,y,yy,byteline,plane,pmask;
!       unsigned char   *pal, *old;
!       struct pcxhed    header;
!       int              count,waste;
!       long             bytemax,bytesdone;
!       byte             inbyte,inbyte2;
!       int              real_bpp;              /* how many bpp file really is */
!       int              mult, neu_stat, numcols, size, x3;
!       byte             col[3];
!
!       fprintf(tfp, "%% Begin Imported PCX File: %s\n\n", pic->file);
!       pic->subtype = P_PCX;
!
!       pic->bitmap=NULL;
!
!       fread(&header,1,sizeof(struct pcxhed),pcxfile);
!       if (header.manuf!=10 || header.encod!=1)
!           return 0;
!
!       /* header.bpp=1, header.nplanes=1 = 1-bit.
!        * header.bpp=1, header.nplanes=2 = 2-bit.   - added B.V.Smith 6/00
!        * header.bpp=1, header.nplanes=3 = 3-bit.   - added B.V.Smith 6/00
!        * header.bpp=1, header.nplanes=4 = 4-bit.
!        * header.bpp=8, header.nplanes=1 = 8-bit.
!        * header.bpp=8, header.nplanes=3 = 24-bit.
!        * anything else gives an `unsupported' error.
!        */
!       real_bpp=0;
!       bytepp = 1;
!       switch(header.bpp) {
!         case 1:
!           switch(header.nplanes) {
!             case 1: real_bpp=1; break;
!             case 2: real_bpp=2; break;
!             case 3: real_bpp=3; break;
!             case 4: real_bpp=4; break;
!           }
!           break;
!
!         case 8:
!           switch(header.nplanes) {
!             case 1: real_bpp=8; break;
!             case 3: real_bpp=24; bytepp = 3; break;
!           }
!           break;
!         }
!
!       if (!real_bpp)
!           return 0;
!
!       if ((pal=calloc(768,1))==NULL)
!           return 0;
!
!       w=(header.x2lo+256*header.x2hi)-(header.x1lo+256*header.x1hi)+1;
!       h=(header.y2lo+256*header.y2hi)-(header.y1lo+256*header.y1hi)+1;
!       byteline=header.bytelinelo+256*header.bytelinehi;
!
!       if (w==0 || h==0)
!           return 0;
!
!       x=0; y=0;
!       bytemax=w*h;
!       if (real_bpp==1 || real_bpp==4)
!           bytemax=(1<<30);    /* we use a 'y<h' test instead for these files */
!
!       if ((pic->bitmap=malloc(w*(h+2)*bytepp))==NULL)
!           return 0;
!
!       /* need this if more than one bitplane */
!       memset(pic->bitmap,0,w*h*bytepp);
!
!       bytesdone=0;
!
!       /* start reading image */
!       for (yy=0; yy<h; yy++) {
!         plane=0;
!         pmask=1;
!
!         y=yy;
!         x=0;
!         while (y==yy) {
!           inbyte=fgetc(pcxfile);
!           if (inbyte<192) {
!             dispbyte(pic->bitmap,&x,&y,inbyte,w,h,real_bpp,
!               byteline,&plane,&pmask);
!             bytesdone++;
!           } else {
!             inbyte2=fgetc(pcxfile);
!             inbyte&=63;
!             for (count=0; count<inbyte; count++)
!               dispbyte(pic->bitmap,&x,&y,inbyte2,w,h,real_bpp,
!                       byteline,&plane,&pmask);
!             bytesdone+=inbyte;
           }
!         }
       }

!       /* read palette */
!       switch(real_bpp) {
!           case 1:
!               pic->cmap[0][0] = pic->cmap[1][0] = pic->cmap[2][0] = 0;
!               pic->cmap[0][1] = pic->cmap[1][1] = pic->cmap[2][1] = 255;
!               pic->numcols = 2;
!               break;
!
!           case 2:
!           case 3:
!           case 4:
!               /* 2-,3-, and 4-bit, palette is embedded in header */
!               pic->numcols = (1<<real_bpp);
!               for (x=0; x < pic->numcols; x++) {
!                   pic->cmap[0][x] = header.pal16[x*3  ];
!                   pic->cmap[1][x] = header.pal16[x*3+1];
!                   pic->cmap[2][x] = header.pal16[x*3+2];
!               }
!               break;

!           case 8:
!               /* 8-bit */
!               waste=fgetc(pcxfile);                    /* ditch splitter byte */
!               for (x=0; x<256; x++) {
!                   pic->cmap[0][x] = fgetc(pcxfile);
!                   pic->cmap[1][x] = fgetc(pcxfile);
!                   pic->cmap[2][x] = fgetc(pcxfile);
!               }
!               pic->numcols = 256;
!               break;
!
!           case 24:
!               /* no palette, set flag in numcols to write out rgb values */
!               pic->numcols = 2<<24;
!               break;
!       }

!       pic->bit_size.x = w;
!       pic->bit_size.y = h;
!
!       return 1;
 }

+
 void
! dispbyte(unsigned char *ptr,int *xp,int *yp,int c,int w,int h,
!               int real_bpp,int byteline,int *planep,int *pmaskp)
 {
!       int f;
!       unsigned char *dstptr;
!
!       switch(real_bpp) {
!         case 1:
!         case 2:
!         case 3:
!         case 4:
!               /* mono or 4-bit */
!
!               if ((*yp)>=h)
!                   return;
!
!               dstptr=ptr+(*yp)*w+*xp;
!               w=byteline*8;
!
!               for (f=0; f<8; f++) {
!                  *dstptr++|=(c&(0x80>>(f&7)))?(*pmaskp):0;
!                  (*xp)++;
!                  if (*xp>=w) {
!                       if (real_bpp==1) {
!                           (*xp)=0,(*yp)++;
!                           return;
!                       }
!                       (*xp)=0;
!                       (*planep)++;
!                       (*pmaskp)<<=1;
!                       if (real_bpp==2) {
!                           if (*planep==2) {
!                               (*yp)++;
!                               return;
!                           }
!                       } else if (real_bpp==3) {
!                           if (*planep==3) {
!                               (*yp)++;
!                               return;
!                           }
!                       } else {
!                           /* otherwise, it's 4 bpp */
!                           if (*planep==4) {
!                               (*yp)++;
!                               return;
!                           }
!                       }
!                   }
!                   if ((*yp)>=h)
!                       return;
               }
!               break;
!
!         case 8:
!               *(ptr+(*yp)*w+*xp)=c;
!               (*xp)++;
!               if (*xp>=w) {
!                   (*xp)=0;
!                   (*yp)++;
!               }
!               break;
!
!         case 24:
!               *(ptr+((*yp)*w+*xp)*3+(2-(*planep)))=c;
!               (*xp)++;
!               if (*xp>=w) {
!                   (*xp)=0;
!                   (*planep)++; /* no need to change pmask */
!                   if (*planep==3) {
!                       (*yp)++;
!                       return;
                   }
!               }
!               break;
!         }
 }
diff -rc transfig.3.2.3/fig2dev/dev/readpics.c transfig.3.2.3b/fig2dev/dev/readpics.c
*** transfig.3.2.3/fig2dev/dev/readpics.c       Wed Nov 24 14:31:35 1999
--- transfig.3.2.3b/fig2dev/dev/readpics.c      Sat May 27 18:00:56 2000
***************
*** 32,38 ****
     Boolean    pipeok;
     char      *retname;
 {
!     char       unc[PATH_MAX+20];      /* temp buffer for uncompress/gunzip command */
     FILE      *fstream;               /* handle on file  */
     struct stat        status;
     char      *gzoption;
--- 32,38 ----
     Boolean    pipeok;
     char      *retname;
 {
!     char       unc[PATH_MAX+20];      /* temp buffer for gunzip command */
     FILE      *fstream;               /* handle on file  */
     struct stat        status;
     char      *gzoption;
***************
*** 44,56 ****
     else
       gzoption = "";

!     /* see if the filename ends with .Z */
!     /* if so, generate uncompress command and use pipe (filetype = 1) */
!     if (strlen(name) > 2 && !strcmp(".Z", name + (strlen(name)-2))) {
!       sprintf(unc,"uncompress %s %s", gzoption, name);
!       *type = 1;
!     /* or with .z or .gz */
!     } else if ((strlen(name) > 3 && !strcmp(".gz", name + (strlen(name)-3))) ||
             ((strlen(name) > 2 && !strcmp(".z", name + (strlen(name)-2))))) {
       sprintf(unc,"gunzip -q %s %s", gzoption, name);
       *type = 1;
--- 44,51 ----
     else
       gzoption = "";

!     /* see if the filename ends with .Z or .z or .gz */
!     if ((strlen(name) > 3 && !strcmp(".gz", name + (strlen(name)-3))) ||
             ((strlen(name) > 2 && !strcmp(".z", name + (strlen(name)-2))))) {
       sprintf(unc,"gunzip -q %s %s", gzoption, name);
       *type = 1;
***************
*** 59,65 ****
       strcpy(retname, name);
       strcat(retname, ".Z");
       if (!stat(retname, &status)) {
!           sprintf(unc, "uncompress %s %s", gzoption, retname);
           *type = 1;
           name = retname;
       } else {
--- 54,60 ----
       strcpy(retname, name);
       strcat(retname, ".Z");
       if (!stat(retname, &status)) {
!           sprintf(unc, "gunzip %s %s", gzoption, retname);
           *type = 1;
           name = retname;
       } else {
***************
*** 100,106 ****
     } else {
       switch (*type) {
         case 0:
!           fstream = fopen(name, "r");
           break;
         case 1:
           fstream = popen(unc,"r");
--- 95,101 ----
     } else {
       switch (*type) {
         case 0:
!           fstream = fopen(name, "rb");
           break;
         case 1:
           fstream = popen(unc,"r");
diff -rc transfig.3.2.3/fig2dev/dev/readppm.c transfig.3.2.3b/fig2dev/dev/readppm.c
*** transfig.3.2.3/fig2dev/dev/readppm.c        Wed Nov 24 14:49:18 1999
--- transfig.3.2.3b/fig2dev/dev/readppm.c       Fri May 26 10:21:54 2000
***************
*** 50,61 ****
       }
       /* close pipe */
       pclose(giftopcx);
!       if ((giftopcx = fopen(pcxname, "r")) == NULL) {
           fprintf(stderr,"Can't open temp output file\n");
           return 0;
       }
       /* now call _read_pcx to read the pcx file */
       stat = _read_pcx(giftopcx, pic);
       /* remove temp file */
       unlink(pcxname);

--- 50,63 ----
       }
       /* close pipe */
       pclose(giftopcx);
!       if ((giftopcx = fopen(pcxname, "rb")) == NULL) {
           fprintf(stderr,"Can't open temp output file\n");
           return 0;
       }
       /* now call _read_pcx to read the pcx file */
       stat = _read_pcx(giftopcx, pic);
+       /* close file */
+       fclose(giftopcx);
       /* remove temp file */
       unlink(pcxname);

diff -rc transfig.3.2.3/fig2dev/dev/readtif.c transfig.3.2.3b/fig2dev/dev/readtif.c
*** transfig.3.2.3/fig2dev/dev/readtif.c        Wed Nov 24 14:49:33 1999
--- transfig.3.2.3b/fig2dev/dev/readtif.c       Mon Jul 10 14:52:14 2000
***************
*** 30,36 ****
     int                  *llx, *lly;
 {
       char     buf[2*PATH_MAX+40],pcxname[PATH_MAX];
!       FILE    *giftopcx;
       int      stat, size;

       *llx = *lly = 0;
--- 30,36 ----
     int                  *llx, *lly;
 {
       char     buf[2*PATH_MAX+40],pcxname[PATH_MAX];
!       FILE    *tiftopcx;
       int      stat, size;

       *llx = *lly = 0;
***************
*** 42,48 ****
       /* make command to convert tif to pnm then to pcx into temp file */
       sprintf(buf, "tifftopnm %s 2> /dev/null | ppmtopcx > %s 2> /dev/null",
               filename, pcxname);
!       if ((giftopcx = popen(buf,"w" )) == 0) {
           fprintf(stderr,"Cannot open pipe to tifftopnm or ppmtopcx\n");
           /* remove temp file */
           unlink(pcxname);
--- 42,48 ----
       /* make command to convert tif to pnm then to pcx into temp file */
       sprintf(buf, "tifftopnm %s 2> /dev/null | ppmtopcx > %s 2> /dev/null",
               filename, pcxname);
!       if ((tiftopcx = popen(buf,"w" )) == 0) {
           fprintf(stderr,"Cannot open pipe to tifftopnm or ppmtopcx\n");
           /* remove temp file */
           unlink(pcxname);
***************
*** 49,56 ****
           return 0;
       }
       /* close pipe */
!       pclose(giftopcx);
!       if ((giftopcx = fopen(pcxname, "r")) == NULL) {
           fprintf(stderr,"Can't open temp output file\n");
           /* remove temp file */
           unlink(pcxname);
--- 49,56 ----
           return 0;
       }
       /* close pipe */
!       pclose(tiftopcx);
!       if ((tiftopcx = fopen(pcxname, "rb")) == NULL) {
           fprintf(stderr,"Can't open temp output file\n");
           /* remove temp file */
           unlink(pcxname);
***************
*** 57,64 ****
           return 0;
       }
       /* now call _read_pcx to read the pcx file */
!       stat = _read_pcx(giftopcx, pic);
!       /* remove temp file */
       unlink(pcxname);

       return stat;
--- 57,66 ----
           return 0;
       }
       /* now call _read_pcx to read the pcx file */
!       stat = _read_pcx(tiftopcx, pic);
!       /* close the temp file */
!       fclose(tiftopcx);
!       /* and remove it */
       unlink(pcxname);

       return stat;
diff -rc transfig.3.2.3/fig2dev/fig2dev.c transfig.3.2.3b/fig2dev/fig2dev.c
*** transfig.3.2.3/fig2dev/fig2dev.c    Tue Dec 21 09:48:27 1999
--- transfig.3.2.3b/fig2dev/fig2dev.c   Tue Jul 11 15:35:17 2000
***************
*** 29,38 ****
 #include "object.h"
 #include "drivers.h"

! extern int fig_getopt();
! extern char *optarg;
! extern int optind;
! char  lang[40];

 /* hex names for Fig colors */
 char  *Fig_color_names[] = {
--- 29,38 ----
 #include "object.h"
 #include "drivers.h"

! extern        int      fig_getopt();
! extern        char    *optarg;
! extern        int      optind;
! char           lang[40];

 /* hex names for Fig colors */
 char  *Fig_color_names[] = {
***************
*** 63,68 ****
--- 63,70 ----
 int           font_size = 0;
 double                mag = 1.0;
 FILE          *tfp = NULL;
+
+ int           ppi;                    /* Fig file resolution (e.g. 1200) */
 int           llx = 0, lly = 0, urx = 0, ury = 0;
 Boolean               landscape;
 Boolean               center;
***************
*** 82,87 ****
--- 84,90 ----
 char          lang[40];               /* selected output language */
 RGB           background;             /* background (if specified by -g) */
 Boolean               bgspec = False;         /* flag to say -g was specified */
+ char          gscom[1000];            /* to build up a command for ghostscript */

 struct obj_rec {
       void (*gendev)();
***************
*** 137,152 ****
 int    argc;
 char  *argv[];
 {
!       int     c, i;
!       double  atof();

       prog = *argv;
 /* add :? */
       /* sum of all arguments */
 #ifdef I18N
!       while ((c = fig_getopt(argc, argv, "aAb:cC:d:efg:hl:L:Mm:n:q:Pp:rs:S:t:vVx:X:y:Y:wWz:j?")) != EOF) {
 #else
!       while ((c = fig_getopt(argc, argv, "aAb:cC:d:efg:hl:L:Mm:n:q:Pp:rs:S:t:vVx:X:y:Y:wWz:?")) != EOF) {
 #endif

         /* generic option handling */
--- 140,155 ----
 int    argc;
 char  *argv[];
 {
!       int      c, i;
!       double   atof();

       prog = *argv;
 /* add :? */
       /* sum of all arguments */
 #ifdef I18N
!       while ((c = fig_getopt(argc, argv, "aAb:cC:d:ef:g:hl:L:Mm:n:q:Pp:rs:S:t:vVx:X:y:Y:wWz:j?")) != EOF) {
 #else
!       while ((c = fig_getopt(argc, argv, "aAb:cC:d:ef:g:hl:L:Mm:n:q:Pp:rs:S:t:vVx:X:y:Y:wWz:?")) != EOF) {
 #endif

         /* generic option handling */
***************
*** 154,165 ****

               case 'h':       /* print version message for -h too */
               case 'V':
!                       printf("fig2dev Version %s Patchlevel %s\n",
                                                       VERSION, PATCHLEVEL);
!                       if (c == 'h')
!                           help_msg();
!                       exit(0);
!                       break;

               case 'L':                       /* set output language */
                   /* save language for gen{gif,jpg,pcx,xbm,xpm,ppm,tif} */
--- 157,168 ----

               case 'h':       /* print version message for -h too */
               case 'V':
!                   printf("fig2dev Version %s Patchlevel %s\n",
                                                       VERSION, PATCHLEVEL);
!                   if (c == 'h')
!                       help_msg();
!                   exit(0);
!                   break;

               case 'L':                       /* set output language */
                   /* save language for gen{gif,jpg,pcx,xbm,xpm,ppm,tif} */
***************
*** 215,223 ****
               }

       if (optind < argc)
!               from = argv[optind++];  /*  from file  */
       if (optind < argc)
!               to   = argv[optind];  /*  to file    */
 }

 main(argc, argv)
--- 218,226 ----
               }

       if (optind < argc)
!               from = argv[optind++];  /*  from file  */
       if (optind < argc)
!               to   = argv[optind];    /*  to file    */
 }

 main(argc, argv)
***************
*** 227,235 ****
       F_compound      objects;
       int             status;

!       /* initialize the color database */
!       if (init_colordb() != 0)
!               exit(1);

       get_args(argc, argv);

--- 230,238 ----
       F_compound      objects;
       int             status;

! #ifdef HAVE_SETMODE
!       setmode(1,O_BINARY); /* stdout is binary */
! #endif

       get_args(argc, argv);

***************
*** 246,252 ****

       if (to == NULL)
           tfp = stdout;
!       else if ((tfp = fopen(to, "w")) == NULL) {
           fprintf(stderr, "Couldn't open %s", to);
           fprintf(stderr, Usage, prog);
           exit(1);
--- 249,255 ----

       if (to == NULL)
           tfp = stdout;
!       else if ((tfp = fopen(to, "wb")) == NULL) {
           fprintf(stderr, "Couldn't open %s", to);
           fprintf(stderr, Usage, prog);
           exit(1);
***************
*** 384,393 ****

 /* count primitive objects & create pointer array */
 static int compound_dump(com, array, count, dev)
! F_compound *com;
! struct obj_rec *array;
! int count;
! struct driver *dev;
 {
       F_arc           *a;
       F_compound      *c;
--- 387,396 ----

 /* count primitive objects & create pointer array */
 static int compound_dump(com, array, count, dev)
!     F_compound                *com;
!     struct obj_rec    *array;
!     int                        count;
!     struct driver     *dev;
 {
       F_arc           *a;
       F_compound      *c;
***************
*** 443,464 ****

 int
 gendev_objects(objects, dev)
! F_compound    *objects;
! struct driver *dev;
 {
       int     obj_count, rec_comp();
       int     status;
       struct  obj_rec *rec_array, *r;

-       if (objects->nwcorner.x == 0) {
-           fprintf(stderr, "Resolution is zero!! default to 80 ppi\n");
-           objects->nwcorner.x = 80;
-       }
-       if (objects->nwcorner.y != 1 && objects->nwcorner.y != 2) {
-           fprintf(stderr, "Wrong coordinate system; cannot continue\n");
-           return;
-       }
-
       /* Compute bounding box of objects, supressing texts if indicated */
       compound_bound(objects, &llx, &lly, &urx, &ury, dev->text_include);

--- 446,458 ----

 int
 gendev_objects(objects, dev)
!     F_compound                *objects;
!     struct driver     *dev;
 {
       int     obj_count, rec_comp();
       int     status;
       struct  obj_rec *rec_array, *r;

       /* Compute bounding box of objects, supressing texts if indicated */
       compound_bound(objects, &llx, &lly, &urx, &ury, dev->text_include);

***************
*** 490,499 ****
 }

 int rec_comp(r1, r2)
! struct obj_rec *r1, *r2;
 {
       return (r2->depth - r1->depth);
 }

 /* null operation */
! void gendev_null() {;}
--- 484,504 ----
 }

 int rec_comp(r1, r2)
!     struct obj_rec    *r1, *r2;
 {
       return (r2->depth - r1->depth);
 }

 /* null operation */
! void gendev_null() {
!     ;
! }
!
! void
! gs_broken_pipe(int sig)
! {
!   fprintf(stderr,"fig2dev: broken pipe (GhostScript aborted?)\n");
!   fprintf(stderr,"command was: %s\n", gscom);
!   exit(1);
! }
!
diff -rc transfig.3.2.3/fig2dev/fig2dev.h transfig.3.2.3b/fig2dev/fig2dev.h
*** transfig.3.2.3/fig2dev/fig2dev.h    Mon Jan  3 09:21:33 2000
--- transfig.3.2.3b/fig2dev/fig2dev.h   Tue Jul 11 14:49:36 2000
***************
*** 105,110 ****
--- 105,111 ----
 extern double mag;
 extern FILE   *tfp;

+ extern int    ppi;            /* Fig file resolution (e.g. 1200) */
 extern int    llx, lly, urx, ury;
 extern Boolean        landscape;
 extern Boolean        center;
***************
*** 123,128 ****
--- 124,130 ----
 extern char   *Fig_color_names[]; /* hex names for Fig colors */
 extern RGB    background;     /* background (if specified by -g) */
 extern Boolean        bgspec;         /* flag to say -g was specified */
+ extern char   gscom[];        /* to build up a command for ghostscript */

 struct paperdef
 {
***************
*** 145,151 ****
 extern int            num_usr_cols;
 extern Boolean                pats_used, pattern_used[NUMPATTERNS];

! extern void gendev_null();

 /* for GIF files */
 #define       MAXCOLORMAPSIZE 256
--- 147,154 ----
 extern int            num_usr_cols;
 extern Boolean                pats_used, pattern_used[NUMPATTERNS];

! extern void   gendev_null();
! extern void   gs_broken_pipe();

 /* for GIF files */
 #define       MAXCOLORMAPSIZE 256
***************
*** 186,188 ****
--- 189,197 ----
       !defined(__GNU_LIBRARY__) && !defined(__FreeBSD__) && !defined(__GLIBC__))
           extern char *sys_errlist[];
 #endif
+
+ typedef struct _point
+ {
+     int x,y;
+ } Point;
+
diff -rc transfig.3.2.3/fig2dev/free.c transfig.3.2.3b/fig2dev/free.c
*** transfig.3.2.3/fig2dev/free.c       Wed Nov 24 14:29:30 1999
--- transfig.3.2.3b/fig2dev/free.c      Wed May  3 09:00:03 2000
***************
*** 86,92 ****
       for (t = *list; t != NULL;) {
           text = t;
           t = t->next;
!           cfree(text->cstring);
           free((char*)text);
           }
       *list = NULL;
--- 86,92 ----
       for (t = *list; t != NULL;) {
           text = t;
           t = t->next;
!           free(text->cstring);
           free((char*)text);
           }
       *list = NULL;
diff -rc transfig.3.2.3/fig2dev/read.c transfig.3.2.3b/fig2dev/read.c
*** transfig.3.2.3/fig2dev/read.c       Tue Jan  4 14:14:17 2000
--- transfig.3.2.3b/fig2dev/read.c      Fri Jul  7 16:13:11 2000
***************
*** 103,109 ****
           }
       else
           put_msg("File \"%s\" is not accessable; %s", file, strerror(err));
!       }

 /**********************************************************
 Read_fig returns :
--- 103,109 ----
           }
       else
           put_msg("File \"%s\" is not accessable; %s", file, strerror(err));
! }

 /**********************************************************
 Read_fig returns :
***************
*** 113,120 ****
     -2 : File is empty
 err_no : if file can not be read for various reasons

! The resolution (ppi) and the cooridnate system (coord_sys) are
! stored in obj->nwcorner.x and obj->nwcorner.x respectively.
 **********************************************************/

 read_fig(file_name, obj)
--- 113,119 ----
     -2 : File is empty
 err_no : if file can not be read for various reasons

! The resolution (ppi) is stored in global "ppi"
 **********************************************************/

 read_fig(file_name, obj)
***************
*** 128,134 ****
           return errno;
       else
           return readfp_fig(fp, obj);
!       }

 readfp_fig(fp, obj)
 FILE  *fp;
--- 127,133 ----
           return errno;
       else
           return readfp_fig(fp, obj);
! }

 readfp_fig(fp, obj)
 FILE  *fp;
***************
*** 162,168 ****
           status = read_1_3_objects(fp, obj);
       (void)fclose(fp);
       return status;
!       }

 int
 read_objects(fp, obj)
--- 161,167 ----
           status = read_1_3_objects(fp, obj);
       (void)fclose(fp);
       return status;
! }

 int
 read_objects(fp, obj)
***************
*** 175,181 ****
       F_spline        *s, *ls = NULL;
       F_arc           *a, *la = NULL;
       F_compound      *c, *lc = NULL;
!       int             object, ppi, coord_sys, len;

       bzero((char*)obj, COMOBJ_SIZE);
       (void) fgets(buf, BUF_SIZE, fp);        /* get the version line */
--- 174,180 ----
       F_spline        *s, *ls = NULL;
       F_arc           *a, *la = NULL;
       F_compound      *c, *lc = NULL;
!       int             object, coord_sys, len;

       bzero((char*)obj, COMOBJ_SIZE);
       (void) fgets(buf, BUF_SIZE, fp);        /* get the version line */
***************
*** 246,253 ****
                   return -1;
               }
               if (!paperspec) {
!                   /* copy all except newline */
!                   strncpy(papersize,buf,strlen(buf)-1);
                   /* and truncate at first blank, if any */
                   if (p=strchr(papersize,' '))
                       *p = '\0';
--- 245,251 ----
                   return -1;
               }
               if (!paperspec) {
!                   strcpy(papersize,buf);
                   /* and truncate at first blank, if any */
                   if (p=strchr(papersize,' '))
                       *p = '\0';
***************
*** 278,289 ****
               }
               if (!transspec) {
                   gif_colnum = atof(buf);
!                   if (gif_colnum < NUM_STD_COLS) {
                       strcpy(gif_transparent,Fig_color_names[gif_colnum]);
-                   } else {
-                       /* set flag to get user color value once they've been read from file */
-                       gif_colnum = -gif_colnum;
-                   }
               }
           }
       } else {
--- 276,285 ----
               }
               if (!transspec) {
                   gif_colnum = atof(buf);
!                   /* if standard color, get the name from the array */
!                   /* for user colors, wait till we've read in the file to get the value */
!                   if (gif_colnum < NUM_STD_COLS && gif_colnum >= 0)
                       strcpy(gif_transparent,Fig_color_names[gif_colnum]);
               }
           }
       } else {
***************
*** 301,307 ****
           }
       }

!       /* now read for resolution and coord_sys */
       if (get_line(fp) < 0) {
           put_msg("File is truncated at resolution specification.");
           return -1;
--- 297,303 ----
           }
       }

!       /* now read for resolution and coord_sys (coord_sys is not used) */
       if (get_line(fp) < 0) {
           put_msg("File is truncated at resolution specification.");
           return -1;
***************
*** 316,323 ****
       /* attach any comments found thus far to the whole figure */
       obj->comments = attach_comments();

-       obj->nwcorner.x = ppi;
-       obj->nwcorner.y = coord_sys;
       while (get_line(fp) > 0) {
           if (sscanf(buf, "%d", &object) != 1) {
               put_msg("Incorrect format at line %d", line_no);
--- 312,317 ----
***************
*** 422,431 ****

       /* if user color was requested for GIF transparent color, get the
          rgb values from the user color array now that we've read them in */
!       if (gif_colnum < 0) {
           int i;
           for (i=0; i<num_usr_cols; i++)
!               if (user_col_indx[i] == -gif_colnum)
                   break;
           if (i < num_usr_cols)
               sprintf(gif_transparent,"#%2x%2x%2x",
--- 416,425 ----

       /* if user color was requested for GIF transparent color, get the
          rgb values from the user color array now that we've read them in */
!       if (gif_colnum >= NUM_STD_COLS) {
           int i;
           for (i=0; i<num_usr_cols; i++)
!               if (user_col_indx[i] == gif_colnum)
                   break;
           if (i < num_usr_cols)
               sprintf(gif_transparent,"#%2x%2x%2x",
***************
*** 436,442 ****
           return 0;
       else
           return errno;
!       } /*  read_objects */

 static void
 read_colordef(fp)
--- 430,437 ----
           return 0;
       else
           return errno;
!
! } /*  read_objects */

 static void
 read_colordef(fp)
***************
*** 1091,1097 ****
               &t->type, &t->color, &t->depth, &t->pen,
               &t->font, &t->size, &t->angle,
               &t->flags, &t->height, &t->length,
!               &t->base_x, &t->base_y, s, junk);
       } else {
           /* The text object is terminated by a CONTROL-A, so we read
               everything up to the CONTROL-A and then read that character.
--- 1086,1092 ----
               &t->type, &t->color, &t->depth, &t->pen,
               &t->font, &t->size, &t->angle,
               &t->flags, &t->height, &t->length,
!               &t->base_x, &t->base_y, s);
       } else {
           /* The text object is terminated by a CONTROL-A, so we read
               everything up to the CONTROL-A and then read that character.
diff -rc transfig.3.2.3/fig2dev/read1_3.c transfig.3.2.3b/fig2dev/read1_3.c
*** transfig.3.2.3/fig2dev/read1_3.c    Wed Nov 24 14:30:35 1999
--- transfig.3.2.3b/fig2dev/read1_3.c   Tue May 16 10:48:31 2000
***************
*** 276,282 ****
       if (feof(fp))
           return(com);
       else {
!           put_msg("Format error: %s", sys_errlist[errno]);
           return(NULL);
           }
       }
--- 276,282 ----
       if (feof(fp))
           return(com);
       else {
!           put_msg("Format error: %s", strerror(errno));
           return(NULL);
           }
       }
diff -rc transfig.3.2.3/fig2dev/trans_spline.c transfig.3.2.3b/fig2dev/trans_spline.c
*** transfig.3.2.3/fig2dev/trans_spline.c       Tue Dec 21 09:49:20 1999
--- transfig.3.2.3b/fig2dev/trans_spline.c      Thu Apr 13 10:51:10 2000
***************
*** 541,547 ****
   line->fill_color = s->fill_color;
   line->fill_style = s->fill_style;
   line->style_val  = s->style_val;
!   line->join_style = 0;
   line->cap_style  = s->cap_style;
   line->for_arrow  = s->for_arrow;
   line->back_arrow = s->back_arrow;
--- 541,547 ----
   line->fill_color = s->fill_color;
   line->fill_style = s->fill_style;
   line->style_val  = s->style_val;
!   line->join_style = 2;                       /* prevents spikes in tight splines */
   line->cap_style  = s->cap_style;
   line->for_arrow  = s->for_arrow;
   line->back_arrow = s->back_arrow;
diff -rc transfig.3.2.3/patchlevel.h transfig.3.2.3b/patchlevel.h
*** transfig.3.2.3/patchlevel.h Thu Jan 13 19:50:35 2000
--- transfig.3.2.3b/patchlevel.h        Tue Jul 11 15:36:50 2000
***************
*** 15,19 ****
  *
  */

! #define VERSION               "3.2.3"
! #define PATCHLEVEL    ""
--- 15,19 ----
  *
  */

! #define VERSION               "3.2"
! #define PATCHLEVEL    "3b"
diff -rc transfig.3.2.3/transfig/Imakefile transfig.3.2.3b/transfig/Imakefile
*** transfig.3.2.3/transfig/Imakefile   Tue Dec 14 10:14:18 1999
--- transfig.3.2.3b/transfig/Imakefile  Thu May  4 13:27:37 2000
***************
*** 42,48 ****
 all:: transfig.man fig2dev.man fig2ps2tex.man pic2tpic.man

 transfig.man:: ../doc/transfig.1
!       rm -f transfig.man
       -ln -s ../doc/transfig.1 transfig.man

 InstallManPage(fig2ps2tex,$(MANDIR))
--- 42,48 ----
 all:: transfig.man fig2dev.man fig2ps2tex.man pic2tpic.man

 transfig.man:: ../doc/transfig.1
!       $(RM) transfig.man
       -ln -s ../doc/transfig.1 transfig.man

 InstallManPage(fig2ps2tex,$(MANDIR))
***************
*** 49,60 ****
--- 49,63 ----
 InstallManPage(pic2tpic,$(MANDIR))

 fig2dev.man:: ../doc/fig2dev.1
+       $(RM) fig2dev.man
       -ln -s ../doc/fig2dev.1 fig2dev.man

 fig2ps2tex.man:: ../doc/fig2ps2tex.1
+       $(RM) fig2ps2tex.man
       -ln -s ../doc/fig2ps2tex.1 fig2ps2tex.man

 pic2tpic.man:: ../doc/pic2tpic.1
+       $(RM) pic2tpic.man
       -ln -s ../doc/pic2tpic.1 pic2tpic.man

 clean::
diff -rc transfig.3.2.3/transfig/mkfile.c transfig.3.2.3b/transfig/mkfile.c
*** transfig.3.2.3/transfig/mkfile.c    Thu Jan 13 19:51:41 2000
--- transfig.3.2.3b/transfig/mkfile.c   Wed Feb 16 17:07:40 2000
***************
*** 102,112 ****
       case pstex:

               /*
!                * The makefile for the pstex need to update two files.
!                * file.eps with is created using fig2dev -L pstex file.fig
                * and
                * file.tex with fig2dev -L pstex_t -p file.eps file.fig
-                *
                */
               puttarget(mk, i, "tex", "eps");
               fprintf(mk, "\tfig2dev -L pstex_t -p %s.eps ", i);
--- 102,111 ----
       case pstex:

               /*
!                * The makefile for the pstex needs to update two files:
!                * file.eps which is created using fig2dev -L pstex file.fig
                * and
                * file.tex with fig2dev -L pstex_t -p file.eps file.fig
                */
               puttarget(mk, i, "tex", "eps");
               fprintf(mk, "\tfig2dev -L pstex_t -p %s.eps ", i);