GhostPCL



This page discusses configuration, compilation and running of the  GhostPCL family of products:  PCL5ETM, PCL5cTM, PCLXLTM, and HPGL/2TM with RTLTM, additionally a scaled down PJLTM (Printer Job Language) interpreter is provided.  All of the PCL products use the Ghostscript Graphic Library for graphics, imaging and driver support.  A brief tour of the Ghostscript documentation (web)  (local) will be helpful to understand this document.  The following is a short overview of GhostPCL, immediately followed by a "hands on" discussion of how to build and run the software.

GhostPCL is PCLTM technology; it is not intended to be a finished software application but a collection of software components that will ultimately be included in a software application or a real time embedded system.  Generally the GhostPCL languages are compliant with the Genoa (now QualityLogic) Functional Test Suite and the Genoa Application Test suite.  Also each language should run the corresponding Genoa Comprehensive Evaluation Test (CET) without egregious errors.

In this document and the software PCL6 refers to technology that supports both PCL5TM and PCLXLTM languages.

Quickest Start For Unix environment with GCC.

tar zxvf ghostpcl-xxx.tar.gz; cd ghostpcl-xxx   # unpack the release and go to the release directory1
make fonts                                      # install the fonts.
make pcl6                                       # compile and link pcl6.
make test                                       # test pcl6 (optional).
make install                                    # install it


Now, read the example interpreter invocations provided here

Quick Start For Unix environment with GCC.

tar zxvf ghostpcl-xxx.tar.gz                    # unpack the release 1
tar zxvf urwfonts-xxx.tar.gz                    # unpack the fonts.
mkdir -p /windows/fonts/                        # make a font directory. 2
cp urwfonts-xxx/*.ttf /windows/fonts/           # copy the fonts.
cd ghostpcl-xxx/main/                           # change to build directory
make -f pcl6_gcc.mak                            # build PCL and PCLXL.
cd obj                                          # move to the executable's directory.
pcl6 ../../tools/owl.pcl  ../../tools/tiger.px3 # test with PCL and PXL test file

1. If tar 'z' option is not supported: gunzip ghostpcl-xxx.tar.gz; tar xvf ghostpcl-xxx.tar.
2. See  Fonts  to configure this differently.

Finally, read the example interpreter invocations provided here

Supported development environments

Unpacking the source

The source code will either be on CD-ROM (without any archiving or compression) or in a archived compressed format.  Zip is used for Windows environments and compressed tar format for Unix environments.  If you have a CD-ROM release you will want to replicate the directory structure from the CD-ROM to a development directory on a hard drive.  The compile process does not require a special directory name.

For Windows use:

pkunzip -d <archive_name>

For Unix use:

gunzip <archive_name.gz>
tar xvf <archive_name>

or

Some versions of tar can uncompress the archive as well:

tar zxvf <archive_name.gz>

After unpacking the resulting directory hierarchy should look like this:
 
 
pcl pcl interpreter
pl pxl and pcl common library
common pcl and pxl shared makefiles
tools miscellaneous tools
gs Ghostscript Graphics Library
gs/jpeg JPEG library
gs/libpng Portable network graphics library
gs/zlib compression library
pxl XL interpreter
main  main makefile and build directory

This directory structure is the default, but the directories can be rearranged with minor modifications to the makefiles.

Building with Microsoft Visual C/C++

The PCL tools are known to build with Visual C/C++ 4.0, 5.0 and 6.0.  There are 2 ways of building the PCL components with Microsoft Visual C/C++:  Convert the current makefile environment to a Visual C/C++ project ; or compile the source directly using nmake.  The following steps take you through converting the supplied makefile environment to a Visual C++ project:


This will build both the PCL and XL language and supporting language switching code.

Note:

Dos hackers can start up a dos window, set the DEVSTUDIO environment variable, and use the same make commands as above (the DEVSTUDIO variable should be set to the top level of the Microsoft Developer Studio, e.g. set DEVSTUDIO=c:\progra~1\devstu~1")
    or
NMAKE /f pcl6_msvc.mak DEBUG=1 DEVSTUDIO=c:\progra~1\micros~3
 

Building with Linux GCC

The pcl tools have been compiled on Linux using GCC.  The makefile should only require minor modification to work on other UNIX environments using the GCC compiler and supporting tools.
                 make /f pcl6_gcc.mak

Building on a generic UNIX platform

The PCL tools have been compiled on Solaris with the Sun Development Tools and SGI with the native SGI C compiler.  We only provide makefiles for the gcc tools and assume users can customize the gcc makefiles such that they work with vendor's compilers.  For the Sun Development tools the following workaround is sufficient to build the software:

  make -f pcl6_gcc.mak CC_=cc CCLD=cc \
  CCAUX=cc CFLAGS=-g CC_NO_WARN=cc GCFLAGS=

If you intend to do development using the software a dedicated makefile should be constructed.

Customizing the build process

The build process is completely configurable.  Here is a list of things that are most likely to change: All of these can be configured in the top level makefile or can be specified on the make command line.

The following make targets are available:

Building only one Language


PCL or PCL-XL can be built together in a language switching environment or each can be built alone with the supporting PJL interpreter.  The simplest way to implement one language is simply to remove the unwanted implementation from the pdl implementation table located in pl/plimpl.c:

For example, this is the default table with two implementations: PCL and XL.

    /* Zero-terminated list of pointers to implementations */
    pl_interp_implementation_t const * const pdl_implementation[] = {
         &pcl_implementation,
         &pxl_implementation,
         0
    };

If you only wish to use the pcl interpreter use the following table:

   /* Zero-terminated list of pointers to implementations */
    pl_interp_implementation_t const * const pdl_implementation[] = {
         &pcl_implementation,
         0
    };

Running the products.

"Few things are harder to put up with than a good example"  - Mark Twain

All options supplied to the interpreter in the following examples are described in the  Ghostscript documentation.  (local)

pcl6 mypcl.pcl

Interpret a pcl file called mypcl.pcl and render it to the default device.  For now the default device on systems with x11 is a full color x11 display, other system default to laserjet 4 output suitable for a monochrome laser printer.

pcl6 -dTextAlphaBits=4 mypcltext.pcl

This example answers our most frequently asked question: Why do fonts look bad?  When rendering pcl text at low (screen) resolution display device use the TextAlphaBits option to enable anti-aliasing.  GhostPCL does not support hinting of TrueType fonts because of patent issues.

pcl6 -sDEVICE=x11 mypcl.pcl

Interpret a pcl file called mypcl.pcl and render to the x11 device.

pcl6 -sDEVICE=ljet4 -sOutputFile="| lpr" -dNOPAUSE mypcl.pcl

Interpret mypcl.pcl and send the Laserjet 4 formatted output to the command lpr, lpr should then send it to a real printer.  Note this is for unix systems.

pcl6 -sDEVICE=pcxcmyk -sOutputFile="pcxpage.%d" -dNOPAUSE mypcl.pcl

Interpret mypcl.pcl and generate CMYK output. Pages are to be put in files named pcxpage.1, pcxpage.2, pcxpage.3, etc.

pcl6 -r72 -sDEVICE=x11mono mypcl.pcl -r100 -sDEVICE=x11 mypcl.pcl

Render a pcl file at 72dpi on the monochrome X11 device, then render the same file at 100 dpi  on color X11 device.  This demonstrates on-the-fly device switching.

pcl6 -sDEVICE=bmpamono -sOutputFile=foo.bmp mypcl.pcl

The bmpamono (1 bit)  and bmpa16m (full color) run asynchronously.  In short, the language and graphics library produce bands in one thread while the device renders the bands in a second thread.
  
pcl6

Simply running the interpreter should generate some useful information about the available options and devices.
 

PCL Personality


The PCL emulation comes in three flavors: PCL5E, PCL5C, and RTL.  The PCL5E personality thresholds colors to black and white irrespective of the color parameters of the output device.  PCL5C is the color personality, used with a monochrome device it will grayscale colors.  The RTL personality can be used to print HPGL/2 RTL plot files.

pcl6 -PRTL myrtl.rtl

run the interpreter with the rtl personality.

pcl6 -PPCL5E -sDEVICE=ljet4 mypcl.pcl

run the interpreter with the pcl5e personality.  This will threshold colors to black and white (ljet4 is a 1 bit device).

pcl6 -PPCL5C -sDEVICE=ljet4 mypcl.pcl

run the interpreter with the pcl5c personality.  This will grayscale colors on the 1 bit output device.

If not set on the command line the pcl interpreter personality will be set to PCL5E if the output device is 1 bit per pixel otherwise it is set to PCL5C.  RTL must be explicitly set on the command line.  RTL always grayscales and never thresholds colors to black and white.

Fonts

The release is packaged with 45 high quality URW TrueType fonts.  For commercial use of the GhostPCL technology these fonts can be licensed from Artifex.  The fonts are searched for in either the fonts, /windows/fonts, or a directory specified with the PCLFONTSOURCE environment variable.

Fonts from a third-party vendor such as  Agfa  or  Bitstream  may also be used.  There is an existing interface for hooking in the AGFA Universal Font Scaler Technology, several Artifex customers currently use this solution.  The software can use Hewlett Packard FONTSMART version 1.5 or Windows TrueType fonts, using either of these font solutions require minor PCL code modifications.

PCL Code changes required to use other TrueType fonts.

At this time, PCL does not have a font mapping technology so to use a new set of TrueType fonts requires modifying the C code in the file pl/pllfont.c.  The C structure resident_table contains a list of Windows TrueType font names.  In the released package these names will correspond with the Windows True Type
font names in the URW font set.  To use a different font set these names must be replaced with the new font names and the code (minimally the pllfont.c module) should be recompiled and linked.

Reporting bugs

A frequently asked question file is under construction  here.

If you find a bug or have comments about this documentation, please send  mail to bug-pcl@ghostscript.com .