Recent changes :
- Fix parsing of MG.

- Fix parsing of AD and SD. Made SD6,9999 change the penwidth of the active font
  immediately as there may be no SS before LB

- Made sure that penwidth is always initialized to a sane default.

- Added output mode "iso", ISO G-code optimized for Gerber cutters
  with special option for conventions used in the textile business


- more PDF updates/fixes related to libharu2 (dot/line sequences,
  error handling - both fixes contributed by Andrew Jackson)
- Added some support for embedded PCL images using TIFF encoding
  and/or color planes (based on sample file from Prakash Gajera,
  which unfortunately still does not work)


- Implemented polygon filling by winding rule (FP1 instruction).
- Improved paper size selection in the PCL module

- more PDF updates/fixes related to libharu2.
- number of fill lines for solid fills now calculated from dpi,
  should improve performance without changing quality.
- Solid fills now also draw the outline of the polygon to catch
  special cases where one of the boundary lines is not an edge.

- updated libharu-based PDF output for new libharu2.

Adapted pdf output to new, plain-c libharu2.
Fixed PCL offset generation in to_pcl.c to properly support negative offsets.
Fixed cut-and-paste error in the truetype font rendering code.

Added support for password protection and usage restrictions to the
PDF export module (based on a patch by Horst Liesinger, see sample resource
file PDF_Per.ini in the doc directory)
Removed an extraneous character set conversion that could cause wrong
characters to be output when using truetype fonts.

Made truetype font support compile again, added -T option to activate
it. Added full truetye glyph support for plotter font 7 (national language
characters and common symbols). Fixed two syntactical errors in the manpage. 
Number of pen lines used for solid fills was larger than necessary for 
solid appearance.

RTL supports ROtation now; uses grayscale palette instead of b/w.

Very rudimentary RTL support (only unencoded or delta-encoded, color-by-pixel
images are rendered (black and white only), most other formats are at least
read and reported).

Adjusted tolerance factor for polygon outline detection. Updated to_pdf.c
for current libharu.

Replaced  the broken fillpoly.c with the correct version that should already 
have been in a19 (sorry). Added linecap and linejoin style support in SVG
mode. Removed or reworded obsolete warnings about missing features.

Removed remaining epsilon values from the scanline polygon fill code; added
proper handling of the special case of intersection at a vertex. Removed some
debugging printouts. Reinstated scaling transformation in IW code.

fixed some typos (missing commas) in the initializing lists of character
sets 2 and 3 (Anton Hadinger). Suppressed wide-line miter filling if the
calculated miter length exceeds the penwidth (basically just a stupid sanity
check to cover an unfound bug). Removed the noisy-and-useless "zero linelength"
warning. Corrected parsing of Esc-E (PCL reset) sequences in preambles.
Corrected calculation of "square" line ends. Replaced individual epsilon
values in the scanline fill code with a single variable that defaults to zero.
Replaced several C++ comment characters with their standard-conforming C

hp2xx no longer terminates when it encounters an empty (sub)drawing, unless
the end of the input file has been reached. It also does a better job of
suppressing empty drawings. The 'simplified hpgl' sub-mode of to_vec.c no
longer outputs an SP for the current pen in response to a penwidth change.

hp2xx no longer aborts on HP-GL syntax errors. Instead, the appropriate
HP-GL error code is set (and may be queried by OE or OS), and the offending
command is ignored. Reporting of the offending instruction can now be
suppressed by the "-q/--quiet" option. The OI (output identification)
command is now supported, it returns HP2XX- and the version number.

Fixed segfault on exit when writing image to stdout. Changed line drawing
(PU/PD/PA) code to ignore invalid coordinates (as required by the HP-GL
documentation) instead of aborting.

fixed bug in canvas size calculation for files with both SCaling and polygons
(which made calculated image area grow when rotated). Fixed clipping of final
circle segment (could cause extraneous border on clipped plots). Added new -u
--uniform_width option to select the "old", simple method of drawing wide lines
in raster modes, as the "new" mechanism of 3.4.3 can cause small fluctuations
in line width in some circumstances.

re-added GIF output and enabled LZW compression option in TIFF

Added do-while loops in AD and SD option processing to handle more than
one font option per command. IW without parameters was scaled twice if SC
was set. Character drawing now uses DtClipLine function instead of local,
broken logic.

The fixed penwidth of 0.1 used internally for solid fills needs to be
scaled if the plot uses SC (Simon Clayton). Made another attempt to get
pen-state handling in polygon mode right - polygons declared with the pen
up should now render correctly with FP, and be invisible with EP.

Need to force pen_down state when entering polygon mode, else polygons drawn
with pen up will not render correctly or even not at all. Cannot suppress
MOVE_TO sequences in arc_increment as this would create wrong lines when
circles are clipped. Wrong ordering of cases caused unsupported AD/SD font
parameters such as pitch or posture to change the font weight. Changed all
BYTE types to Byte to avoid clashes with X11's BYTE type. Initial support
for variable-width fonts (only if truetype support is available).

Added very experimental support for variable-width fonts (truetype mode only).
Corrected (non-)rendering of polygons starting with a pen-up move. Corrected
clipping of arcs and circles. Prevented unsupported font style options from
changing the font linewidth.

Fixed several bugs in the wide-line miter code that could lead to jagged
lines and extraneous lines. Disabled Esc%?A as separator again, as this
breaks several files including our own spectrum.plt example, where it is
immediately followed by another Esc%?B "enter HPGL mode" command.

Made filltype 11 work again (after breaking it during addition of type 10).
The 'leave HPGL mode' PCL/RTL commands Esc%0A,Esc%1A are now recognized as
separators in multi-image files.

Added support for filltypes 10 (percentage) and 11 (user-defined raster 
pattern) and the RF (raster fill pattern definition) command (using the
old-style polygon fill code).

fig and rgip output modules still aborted when trying to change the color 
of pen 0. Penwidth was erroneously reset to that of pen 1 instead of the 
current value after (old-style) polygon filling.

Adapted the pdf module to the new high-level command handling scheme.
hp2xx can now be compiled/linked against Takeshi Kanno's libharu (see
for PDF output support (which, unlike the commercial PDFLIB, is available under
the PNG/ZLIB license and thus may be used royalty-free even in commercial 

Files containing both SC and polygons were rendered with extra margins
(original patch by Hans-Peter Rueger) and sometimes with unfilled or 
missing polygons

Lowercase HPGL commands were ignored (very old bug, found and fixed
by Yuishi Fujishige)
Several of the Makefile templates were missing closing quotation marks
on echo commands (Christian Zuckschwerdt)

Several fixes contributed by Eugene Doudine: 
-I had misapplied part of his 3.5.0a1 patch, thereby breaking IW.
-the formula used in AT (arc through three points) was wrong, giving
 correct results for some trivial cases only
-fixed some more cases where the pen is lowered and raised but not
 moved in between, and hp2xx did not draw a dot as a plotter would
-added mandatory SP command in pages.hp example

General code changes to use highlevel drawing commands (currently 
implemented for polygon fills) instead of line drawing if the output 
format supports it, and addition of an experimental Postscript driver
that makes use of this. (Eugene Doudine)

3.4.4 released 03/06/23
Corrected WG (filled wedge) drawing, which got horribly broken in 3.4.3.
Updated documentation and 'indent'ed sources.

Corrected color PNG output. Added commandline option to remap pen 0 drawing
commands to another pen number (to workaround the problem that pen0 doubles
as background color in the raster output modes).

Corrected the page counting of multi-image files.

Corrected a typo that caused drawing of arcs (AA) with tolerance set to
deviation distance (CT1) to fail. Adapted the optional ttf renderer to the
freely available Bitstream Vera Mono font (

Corrected the handling of the DT command (non-default terminators were 
always printed, default "DT;" command would set terminator to ";").

Fixed missing function prototypes (leading to compilation of an unusable
program) when the -ansi compiler flag was used on some platforms. Added 
another workaround for the miter code generating spurious lines in text
characters. Added commandline arguments -W and -H to set the perceived 
'hardware device limits' of hp2xx (in plotter units, to fix default character
size for plotfiles intended for a particular, e.g. A4-size plotter model).
More fixes to the polygon fill code, particularly for vertical fills. This
also solves a problem with the raster buffer receiving invalid image rows.
Reduced the default miter limit in EPS and PDF mode to a more realistic value.
Added special case S=4 for the Epson ESC/P2 output mode to support the recent 
six-color Stylus Photo models (untested).

Added optional support for line color and width in DXF output and improved
the DXF header (Georg Viehoever). Made the error handler print the offending
HPGL command, not only its sequence number. Fixed a bug that could allow
polygon sides to avoid clipping. Changed the simplified HPGL output to avoid
writing small numbers in exponential notation.

Added rectangle mode support for PE, modified PJL parser to support lines
up to 256 characters (Eugene Doudine).
Added NR to the list of commands that may separate drawings in multi-image
plot files. Removed some debug messages (from 3.4.4a1) from the eps driver.

Bugfixes for -p not working with numeric arguments; wrong penwidth after
drawing labels; wrong lines in polygon fills; broken color support in xfig
and rgip output. 
Added preliminary support for truetype fonts instead of the ugly stick 
fonts. Needs a fixed-width font (LucidaTypewriterRegular from Sun's JRE
is ok, but does not seem to be freely redistributable). Fixed sloppy coding
found by 'splint -weak'.

3.4.3 (completed on Dec.29, but appeared on in late January)

Documentation updates and source indentation.

3.4.3a26 (release candidate for 3.4.3):
Silenced a few messages that were printed even in quiet mode. Added a new
output module, CNC G-code for engravings (Michael Rooke).

Switched off the wide-line mitre code for lines with round endcaps (where
it is unnecessary). Added some small improvements to the PCL3GUI output -
a designjet500 at least plots now, but the image is separated into inch-wide
(printhead-wide?) strips with equal amounts of whitespace in between).
Corrected handling of arc commands with a chord setting of zero (Steve Edmonds) 

Yet more fixes to the 'wide line miter' stuff (the previous code sometimes
added extraneous lines in characters). The PCL3GUI code definitely does not
work, and i do not yet know why.

Simplified HPGL output (-mhpgl) did not honor any rescaling done with -h,-w.
Added experimental initialization code for HP 'PCL3GUI' devices, and new -I
command to select it.

Fixed a bug in the miter fill code that could cause gaps in the filled area.
Modified circle drawing code to create an overlapping segment to join the
first and last segments when drawing wide lines. Modified polygon_PicBuf to
draw fill lines directly instead of calling the bresenham code. Removed all
references to (l)rint as they only created portability problems. Line join
logic should be correct now.

Some code cleanup (Andrew Bird). Modified criteria for drawing miter sections
to fix some cases where non-consecutive lines were erroneosly joined. Improved
sorting of miter region corners. Still have some pathological cases to study.

Reduced the default raster mode miter limit. Added preliminary code for
triangular and square line ends.

Redid the butt miter code for raster output of wide lines. Fixed handling
of special cases 'PS0;' and 'IN;IW'.

Small changes to improve numerical stability - the LPattern_Generator
could enter an endless loop on Sun/Solaris.

Fixed incompletely applied patch for endcap selection in a16. Added 
experimental code for filling the miter section on wide lines.

Reverted line end changes from a15 (thin lines should already be handled in 
other parts of the code, only this was broken in the raster modes). Modified 
IW handling again to accomodate another case. Adapted initialization of line 
parameters in eps and pdf modes for multiple input files(Andrew Bird). Added
bad hack in arc drawing code as a temporary workaround for the missing miter
support in the raster modes (switching to round ends even for wide lines to
avoid leaving holes between the segments of the arc). Another ugly hack now
allows specifying penwidths beyond 0.9mm on the commandline by using capital
letters (A being 1.0mm, and Z 3.5mm). Keep EP from drawing the final edge
if it was created by implicit closure while in pen up state (fixes files
generated by transfig, which were broken by the addition of implicit closure
support). Probably need to keep track of penstate for individual edges - EP 
edges only pendown moves, while FP fills regardless of penstate. Made frame
selection in multi-image files (-P option) work again.

Fixed bug in a14 that set all pencolors to black unless explicitly defined
using -c. Rewrote IW parameter shuffling to fix all known cases including
those that a14 broke.  Line ends were erroneously defaulted to butt-shaped
instead of rounded for thin lines. Reduced pensize used for polygon fills,
and removed check for duplicate intersections. Removed leftover file named
sources/outfile that had somehow crept into the a14 source tree.

Reset default colors only if they were not overridden by the -c option.
Reset penwidths and IW clipping flag between plots.
Fixed several memory leaks in output filename generation and png output.
Fixed PJL header misinterpretation introduced with the treatment of unknown
esc sequences. Added missing $(EX_DEFS) in HPUX section of generic.mak.
Added special treatment of AF/AH as for PG (AF at end caused crash). Fixed
IW handling for P2