CentraDoc 6.2 - Summary of Changes

Table Of Contents

Introduction

This document discusses the CentraDoc changes since 6.1. If you haven't upgraded since 6.0, please read the 6.1 changes document as well.

Liberty has been using a ticketing system for issue tracking since before the 6.1 release. This should help clients keep track of what specific issues have been addressed. Most of these notes will be listed by ticket number. (Liberty uses Subversion and Trac)

Here are the highlights for CentraDoc 6.2:

This document is current as of the 6.2.1 Release

Build Changes

#286 Massive Safety / Security cleanup

  • Handle all Visual Studio 2005 deprecations
  • Fixed a variety of bugs found by cl /analyze
  • Error-prone standard C functions like strcpy and sprintf have been completely removed and replaced with safe versions.
  • Change temporary file mechanisms for Windows Vista compatibility
  • Significant safety enhancements to runtime library use.
  • Other safety patches for Jasper, Little cms, FreeType and JPEG libraries
  • Extensive source changes to clean up symbol conflicts and other problems with includes.
  • Standard fixed-size integer symbols (stdint.h style) are used for consistency
  • Many include files and symbols in the gco core have been renamed with package prefix rt_
  • rt_config.h is the include file to customize for any needed #defines This should not be necessary except in unusual circumstances
  • psi.h has been reorganized to resolve dependency loops and provide a narrower interface

General

#11 DvCharEmEnd must cache glyph widths for DvCharEmStart
An Important change to the Driver Interface: DvCharEmStart must now return glyph widths for captured glyphs. The driver must cache widths from DvCharEmEnd for new glyphs, in order to return them later when it grabs the glyph rendering via DvCharEmStart.
#120 Ignore empty images, width or height == 0
Can prevent bombs in driver code
#126 Monochrome FreeType Glyph map alignment problem fixed
Makes BytesPerRow explicit in FntBitmapRec, and adds bytes_per_row to the PSDVGLYPH struct.
#178 Axial shader changes to handle special cases of extreme input
also #314 more Axial changes for special cases; and #350 Glitches in axial code for horribly small patches
#184 Confusion over abort signal
Efforts to clean up the signal abort condition, but this is superseded by the error cleanup #248: signal abort now returns the simplified error errorUserAborted
#189, 384 gxc->want_charem and gxc->want_textmode problems
These didn't work, and in ticket #189 gxc->want_charem was ignored if gxs->text_mode was set, but ticket #354 changes behavior to place responsibility on the driver; if driver sets gxc->want_charem and gxc->want_textmode, it must check gxs->text_mode in DvCharEmStart calls.

#204 Fix handling of special conics when getting FreeType outlines for fonts

#206 Shader artifacts from too-early parametric color convergence

#242 Clean up JPEG error handling (longjmp to stale buffer!) and
add ability strip leading crap from JPEG streams.

#248 Error handling

gco/errmgr.d is now the root of all errors.

There are two categories of error identifiers: simplified general errors and extended specific errors.

The simplified errors are a small set of enum values that could be meaningful to a user in the most general sense. The extended errors use string atoms for short, meaningful error names that map readily to longer error definitions. This removes the need to manage some large arbitrary "error number" space across subsystems.

The PSI and PvSDK API interfaces were both inconsistent about error return values. The PvSDK and PSI calls now return simplified error values, although a negative return may have special meaning for some calls (all the simplified errors are small positive integers).

Extra TRY wrappers have been added around the main PSI functions: psiint, psimon, and psifin, to be sure exceptions don't escape to the application.

Here is the enum for the simplified errors:

typedef enum etSimpleError
{
    errorNone=0,
    errorFailure,         /* unexpected, assert, gpf, ... */
    errorUndefinedResult, /* divide by 0 or other */

    errorOutOfMemory,
    errorDiskFull,

    errorUserAborted,

    errorFileNotFound,
    errorFileExists,      /* if unexpected... */
    errorAccessDenied,    /* Permission error */
    errorPasswordRequired,/* try again with correct password */

    errorInputOutput,     /* "device failure" */
    errorInputSyntax,     /* data / syntax / encoding */

    errorInitializing,

    errorUnsupportedVersion,
    errorUnsupportedFeature

} ESimpleError;

The PS_CONFIG (psc) struct contains detailed information about what errors have occurred:

char *       error;       /*  Current error  */
int          signalerr;   /*  cleaned and Signalled error value */
struct
{    char *raw;           /* thrown error */
     char *PostScript;            /* in PostScript error space */
     int   simple;        /* simple erorr space */
} last_error;             /* most recent error being handled */
#275 Memory reading bug in rgn2poly.c:S_TraceSimpleRing
(rgn code is for drivers that don't implement clip level 3). Was (potentially) walking each run twice its length into random memory. Bombing in release mode due to changes in memory allocation strategies.
#285 Add Unicode support in API file names
psc->etc_path, psc->ps_write_path, and run arguments can be Unicode if they start with a byte order mark (BOM) (0xfeff). Unicode byte order is assumed to be native (regardless of BOM). The contents of the ini file is still narrow, so no Unicode paths can be set via the ini file.
#305 gxc->image_raw_data improvements

Normal image processing converts images to 8 bit driver native color. For gxc->image_raw_data, the image format will convert to non-indexed 8 bit but preserve the target color space.

If the driver fails the DvImgStr by returning non-zero, the image will finish cooking to driver native color and try again. #306 adds gxc->image_raw_indexed, which will first give the driver a shot at the indexed data; again, the driver can fail the DvImgStr, and the image data will be converted to non-index and DvImgStr tried again.

#311 More rgn oddities: ClipPath not handling trailing move

#331 Multithreading errors
Clarify BIND and multithreading by adding another bind flag to the root class structure.
#333 Cleanup of Copyright and licensing issues
for some third-party modules
#342 Improved fonts.dat handling
  • fonts.dat was loaded in 2 different places - fntft.c and psfont.c - and psfont.c reparsed the file for every query. Now only loaded once, in fntft.c

  • fntft.c originally didn't support the alias syntax used by psfont.c:

    alias /original

  • Support for one leading %environment% variable in font path, needed to support %SystemRoot% for default Windows fonts.

  • The software now works under Windows without psc->etc_path or the etc Type 1 fonts

  • The default font map under Windows is now:

    % standard PDF (and PostScript) fonts
    
    Times-Roman         %SystemRoot%\FONTS\times.ttf
    Times-Italic        %SystemRoot%\FONTS\timesi.ttf
    Times-Bold          %SystemRoot%\FONTS\timesbd.ttf
    Times-BoldItalic    %SystemRoot%\FONTS\timesbi.ttf
    Helvetica           %SystemRoot%\FONTS\arial.ttf
    Helvetica-Oblique   %SystemRoot%\FONTS\ariali.ttf
    Helvetica-Bold      %SystemRoot%\FONTS\arialbd.ttf
    Helvetica-BoldOblique %SystemRoot%\FONTS\arialbi.ttf
    Courier             %SystemRoot%\FONTS\cour.ttf
    Courier-Oblique     %SystemRoot%\FONTS\couri.ttf
    Courier-Bold        %SystemRoot%\FONTS\courbd.ttf
    Courier-BoldOblique %SystemRoot%\FONTS\courbi.ttf
    Symbol              %SystemRoot%\FONTS\symbol.ttf
    ZapfDingbats        %SystemRoot%\FONTS\mtsorts.ttf
    
    % aliases for Windows standard, look out for spaces
    
    Arial               /Helvetica
    ArialBold           /Helvetica-Bold
    ArialItalic         /Helvetica-Oblique
    ArialBoldItalic     /Helvetica-BoldOblique
    TimesNewRoman       /Times-Roman
    TimesNewRomanItalic /Times-Italic
    TimesNewRomanBold   /Times-Bold
    TimesNewRomanBoldItalic /Times-BoldItalic
    CourierNew          /Courier
    CourierNewItalic    /Courier-Oblique
    CourierNewBold      /Courier-Bold
    CourierNewBoldItalic    /Courier-BoldOblique
    

The default font map for other platforms remains unchanged (uses the etc T1 fonts).

#355 (part 2) SmarterTransform=Y color manager operations buggy

#355 (part 3 and 4) Issues with image masks and image emulation

Ticket-less:

Fixed interesting nasty bug in FFsBase Create File. If create failed, it opened the output file in the etc_path directory.

Fixed monochrome image resizer to work correctly when reading multiple rows

Added polygon winding information to DvClip

Validate function Type 0 sample count and Validate get samples parameters

Removed some unused FreeType driver modules.

Updated FreeType to 2.2.1

Updated Little cms to 1.15

Updated zlib to 1.2.3

PDF Read

#2 PDF Transparency

The new RIP implements PDF transparency

High level transparency hooks have been added to the Driver Interface

Alpha and Blend Mode values have been added to the Graphic State

Note that the page-level blend mode hack from ticket #74 has been disabled, because it interferes with correct transparency function. If this feature is still desired for some drivers, an option can be added to re-enable it.

#116 Large black annotation rectangle in specific PDF file
Check annotation for visibility flag - the PDF file had black rectangle displayed for printing only, to prevent printing.
#117 Automatically close any open layers at end of PDF page
To handle buggy PDF input files.

#118 More efforts to detect bogus PDF font encodings

#119 Specific PDF file has overlapping characters due to incorrect default width for Type 0 fonts

#123 DvImageGrab no longer allows grabbing JPEG with Lab color space

#136 Improved handling of layer expressions

#137 Apply ViewState to layers; background missing, defaults to OFF
(PDF /OCG << /Usage << /View << /ViewState ... >> >> >>)

#139 Unicode strings in PDF file structure calculated length incorrectly

#144 External fonts pretend to be embedded to avoid forced driver substitution

#146 Choose correct encoding for Symbol,Italic and other Symbol related fonts

#147 JBIG2 potential crash reading past end of buffer

#149 Acrobat allows for reading short color index tables (unfortunately)
Initialize table to 0 and ignore the error, like Acrobat

#150, #154 Gradient clip rectangle could get stuck

#156, #107 Correctly handle pathological dithering patterns

#168 Handling broken XRef counts in some defective input files

#169 Make sure dash segments are at least 1 pixel long

#173 Ignore ToUnicode map if low ASCII duplicates found in map

#177 Pattern fill of empty path caused nocurrentpoint exception

#176 PDF Read and Write Font Names for Type 3 fonts
Type 3 font names is an undocumented Acrobat extension
#182 Missing lines in specific PDF file
RIP replaced, and uses floating point API

#183 Create on-the-fly appearances for fill-in form fields

#188 Image mask emulation and character emulation conflicts

#194 Outline reader chokes if pages haven't been referenced yet

#196 Dashed styles lost if matrix is whacky (whole page == 1. x 1.)

#198 Ignore /ToUnicode if /Encoding has /Differences
Assuming this signals a bogus ToUnicode map; another PDF encoding heuristic (guess)
#199 Fix DvCharEm of Type 3 font with nested embedded font
Turns off DvCharEm/DvFontEm signals if already in a DvCharEmStart/End

#201 Handle obscure FontDescriptor flag AllCap

#210 Fix bomb on input text
Nasty unterminated tables in lookup of character alternates
#212 Another case of Acrobat opening broken file
Specific PDF file has incomplete fonts; Acrobat complains but opens the file

#217 Make RLC decode more forgiving if end of input

#219 Attempt to detect uniXXXX glyph names for generating an encoding

#220 Ignore /Encoding if it's an array
(Yet another case of a bogus PDF file that opens in Acrobat)
#222 Provide automatic font uniquifier for Type 3 fonts, similar to Type 1
for cases of DvFontEm with similar font names, which was causing confusion
#232 Index color pin the index to table size instead of failing
Specific PDF file contains image with index color with only one color in the table.
#234 PDF support for Adobe Illustrator Layers
Adobe Illustrator uses a different mechanism for writing layers to the PDF or AI file. Also, #352 Adobe Illustrator layer title use UTF-8 encoding, converting to Unicode
#240 Fix misunderstanding about CID ranges in CMaps
and handle UTF8 in PDF font encoding
#243 Exception loading specific PDF file
Encrypted object streams referenced before security loaded
#244 Funky character placement in specific PDF file
JBIG2 dsOffset value is signed

#258 PDF layer bombs for degenerate OCMD with no OCGs

#288 Change psc->pdfCropped to be pdfdoc::PgExtType instead of boolean

Actual value is an int, and the enum is changed so 1 == CropBox. Sometimes client needs to use TrimBox or ArtBox.

Also, in psbbox check for %PDF header and skip the file (AI files have embedded PostScript producing false positive for %%BoundingBox)

#291 Look for more likely symbolic font names and mark them as symbolic
(therefore, unless gxc->pdf_sub_uncsym is set, these fonts won't automatically substitute if unclaimed)
#302 JPEG2000 Address some Jasper memory management issues
and handle Jpx/JPEG2000 PDF images parameters: NComponents/BitsPerComponent/ColorSpace can all come from the JPX stream

#325 /XRef /Index not parsed correctly (PDF Object Streams)

#341 Handle unbalanced q/Q on PDF input by flushing at end of page

#348 Saturation blend mode mis-spelled, causing not found error

#351 Part 2 - Pattern with alpha drawing outside pattern box
Requires pattern draw clip to pattern box
#353 More broken file testing
Fixed some cases handling missing elements in PDF input
#355 (part 5) Radial shader glitch
Radial shader radius == 0 produced random results

Ticket-less:

PSI API hooks for PDF passwords:

/* returns true if PDF file is encrypted */
int psiispdfencrypted(PS_CONFIG *psc);

/* this returns PDF permissions based on password - see PDF.d
    0 means password failure
*/
int psipdfauthorize(PS_CONFIG *psc, char *pwd);
PDF DvClip didn't actually pass down the paths -
missing elements of floating point interface.

PDF Write

#11 Distiller create Type 3 fonts for emulation

via DvFontEm / DvCharEmStart / DvCharEmEnd

See also #11 above.

#115 Distiller losing font if capturing emulated font

#133 PDF Write sets /M (modification date) entry for all text annotations

#142 PDF/A-1b compatibility mode

A new module in the PDF Update library, pdfupd/pdfa1b, has a function:

void Pdf_Make_PDFA1b(PdfDoc *doc);

which will place an sRGB profile in the PDF file, and place XMP markers in the file for PDF/A-1b compatibility. Note: This does not mean the file will actually be PDF/A-1b compatible! PDF/A has many restrictions that must be followed to produce a compatibile file. Adobe Acrobat has an Advanced/Preflight tool that can be used to verify compliance with PDF/A-1b. Please refer to the PDF/A Specification, or contact Liberty Systems for more information.

#155 Fixed buffer overflow on CCITT compress

#197 Correct measurement of text for PDF output annotation bounding box

#228 Add PDF_ShowWideText to the PDF Output API

#306 Distiller enhancement PostScript Duotone Colorspace Detection
Detects PhotoshopDuotoneColorSpace and PhotoshopDuotoneAltColorspace and produces a hybrid color space for storing in the PDF file, similar to what Acrobat Distiller does. This is a rather obscure but extensive change - more information is available if needed for other drivers.

#336 Create encryption broken in revision 5349 (11/11/2005)

#337 Enhancements for command line distillers psipdf and ps2pdf
  • psipdf default pages to all
  • progress reporting fixed
  • -q for quiet option
  • -w and -h width and height in inches, millimeters, or pixels
  • -r Rotation parameter
#347 Fixing full adjust for text with external fonts
integer math dropped the relevant data

Ticket-less:

JPEG image target turn off any row padding or bad things happen

For PDF write API BT and ET are automatic, so BT has to restore the current text matrix

Do form wrote the do twice

Begin form reset bbox to specified causing a problem

Use any pattern referenced by shader, to avoid possible leakage

Added PdfStreamDeferred for caching output instead of interrupting page contents

Distiller fonts always need PSDVFONT origmtx

Distiller receiving DvChar if no Type 1 fonts available, return best-guess rectangle

Orient wasn't plugged into the PvSDK LS_ Distiller calls

PostScript

#134 makefont cache could mess up Encoding array

#151 DistillerParams configuration option, defaults to off
some PostScript files won't interpret if they think they are being distilled
#162 Hack to disable CIE colors
IgnoreCIEColors=Y or extern int gIgnoreCIEColors; gIgnoreCIEColors=1;
#166 Important PostScript now recognizes gxc->multichar == 0.
which causes text strings to break up into single characters. This moves text around subtly, sometimes not so subtly, beware. Please set gxc->multichar = 1 for the old behavior.
#170 kExplicitMaskInterleave and Image_Copy2
added kExplicitMaskInterleave to imaging.d mask types, to deal with short term problem of interleaved mask and data; if Interleave, read 1 row of each at a time. Use Image_Copy2 for copying interleaved source and target at once.

#174 DistillerParams set /CoreDistVersion to 5000 (or pdfmark won't execute)

#185 Fix special case problems of Type 3 character measurement
the Type 3 / 203 bit is squirrely, includes a work around. See also #166

#187 copypage operator wrote to random stack location (ouch)

#195 Fix handling of degenerate arcs

#209 Client specific PostScript enhancement AutoTiff=Y
Handling PostScript files with external tiffs or JPEGs without explicit decoder in the PostScript file. If gcx->auto_tiff, checks FFsBase source for "tiffness". Detects external CMYK JPEG and inverts (actual #209)
#216 Disable DistillerParams by default
Note that this is opposite of the previous, which provided a hook to turn it off; interested parties will need the hook to turn it back on. See also tickets #151, #174
#218 Clipping problem with specific EPS file
Previous fix for clipping edge (6/30/2005) didn't check which edge; eps file flips the coordinate system
#221 For performance, cache single component /DeviceN conversions
Handles special case from specific PostScript file (pscript.dll version of standard altona.pdf test file). Won't help with /DeviceN with more than one component. General case is problematic.
#223 PostScript force a font reset at beginning of page
Can fix several oddities with different drivers capturing fonts

#228 PostScript some odd page sizes added for specific client

#233 Specific PostScript file shows inverted monochrome image
The file uses /Decode on an indexed color space, which wasn't handled correctly.
#245 Specific PostScript file undefined result error
assumed setscreen proc actually runs - setscreen now goes through the motions.
#250 Random lines appearing emulating text in specific scenario
fill was refactoring the path, so path size had to be re-established

#251 Infinite loop in pathforall operator (ouch)

#252 Bad text placement in specific EPS file
Relates to font matrix issues, dx and dy offsets != 0
#256 Back out misguided type 3 optimization
Came and went during 6.1 branch life cycle
#260 Fix for a CIE bug
Also came and went during 6.1 branch life cycle
#262 and #300 Default PostScript font is now a null dictionary
to avoid asking the driver for a font that isn't used (previously TimesRoman) and to avoid bombing in currentfont if the default font is undefined (#300)
#265 Allow for character 0 in char adjust
specific PostScript file has /space in encoding slot 0
#266 setpageparams was unimplemented
needed for odd-size pages in input

#271 Fixing special case of embedded Type 0 font

#277 Spurious black line in specific PostScript file
PostScript token reader was a little loose about end of line whitespace. Read an extra white space null after reading \r terminating beginimage which expected the null to be the first byte of the image data. Because of multiple source cmyk, all the colors were fine except k was out of sync, producing trailing black line.
#279 PostScript file system security

PostScript allows write access to the file system; this could be a source of mischief. Most PostScript files don't do any writing, but some write out temporary files that contain PostScript sub-programs.

psc->ps_write_path now controls where PostScript can write to; any files created are created in this location. By default, psc->ps_write_path is set to psc->etc_path + "tmp", although this is potentially a problem under Windows Vista.

#281 Error in eexec stopped handling
The eexec cleanup ran deferred and didn't happen changed IPC if_ to C if()
#294 Wrong font name passed to driver in specific PostScript file
Make a copy of the font name string when defining a font, because PostScript code can whack the strings after the font is defined.
#298 Character clipping glitch
Overriding the polygon elimination for DvCharEm is a problem for drivers that can't do full clipping
#299 Fix case of "unfortunate file filter combination" for specific file
subfiledecode on top of proc file

#306 See #306, above

#315 Work around for "forgetting" dbcs for driver override of embedded font

#316 Drivers implementing DvImgGrab watch for PSDVIMGRAB is_unbounded_WARNING
if this is set, they can't read the FFs to EOF; either parse the structure and stop at EOF, or fail grabbing the image, and let PostScript parse it.

#321 Dummy /SpotFunction needs to at least behave properly.

#322 PostScript shader bypassed regular fill logic
making PSDVPOLY path null.
#323 PostScript undefined behavior, possible bomb (ouch)
not checking return from psdsrch
#327 PostScript crash for specific file
Image with MultipleDataSources; if bits per component < 8, the logic was completely wrong
#330 PostScript Bold Proc idiom recognition
Windows PostScript output often contains procs to generate bold characters by stroking the outline. The common proc names are grabbed and use gxs->text_mode instead, if the driver is interested (gxc->want_text_mode)
#332 Allow for ESC%-12345X and @PJL commands without TBCP filter
Also inspired some additional clean up of TBCP filter
#343 rcurveto produced wild results
typo dating back to 10/18/2005
#344 Don't force Type 1 font data to be on integer boundaries
fixes for the floating point interface, when running a low DPI
#353 More broken file testing
  • PostScript parser FFS_ReadUntil buffer overrun by 1 null byte
  • PostScript parser chokes if expected system name not found in binary mode

Ticket-less:

image_mask = 0 caused all PostScript images to emulate.

Add RRCustomProcs setjobtype to handle Xerox document

For ps_ispsfile 1024 bytes was not enough, increased to 4096

Don't choke if /Decode is missing from image dictionary

Changed default substitution font from Courier to Times-Roman

pstack and stack had stopped working

Windows and Preview SDK

#108 ini options to control image memory use
ImageSegmentThreshold=64
If an image is larger than this value (in megabytes), the Windows driver will make multiple calls to StretchDIBits, passing segments of the image smaller than this threshold.
ImageVMThreshold=64
If an image is larger than this value (in megabytes), the Windows driver will create a temporary virtual memory file for the image.

#148 WMF and Placeable WMF output removed from PvSDK - unsupported

#164 AlwaysUseWindowsFonts=Y will substitute Windows
fonts for (almost?) any font detected on input
#179 WinAnsiEncoding=Y instead of standard encoding for driver defined fonts.
This appears to relate to CE font encoding mentioned in the PLRM
#192 More attempts to handle Windows PostScript driver output for

wide GID_CHARSET fonts; this is in the Windows driver, but also affects the distiller. This set of changes is complex - more information is available if needed.

  • ini setting for PPDDefaultEncoding= to control default wide encoding / locale

  • for encoding CMaps, also look in the unadorned etc path

  • Distiller can now reference external Windows fonts

  • The Distiller now supports AlwaysUseEmbeddedFonts (gxc->embedded == 0) so it's now possible to override embedded fonts if desired.

  • Windows now has HFONT[#]= and VFONT[#]= ini settings to override the Unicode/dbcs font search. [#] is the charset (gfx/encoding.h), H/V for horizontal or vertical for example:

    HFONT[134]=SimSun
    

    to force SimSun as the Chinese font.

  • PPDDefaultEncoding= can be a problem for any "normal" PostScript fonts; any normal encoding manipulations are ignored. Disabled for embedded fonts.

  • Apparently GlyphNames2Unicode would help, but we don't use it yet

#217 Windows only: PDF read error throw leaves PDF open
A couple of try/finally blocks to clean up while unwinding; not ignoring the error, just cleaning up better.

#310 initial clipping clobbered when printing

Adding LS_GetCap so sample.exe can ask if distiller is available deletes menu items instead of disabling them, to avoid confusion.

Print warnings in release mode if swallowing a hardware error NO_FAILURE_STDERR can turn them off - see rt_config.h

psijpg EMF creation: get extents or bad things will happen

RIP and AntiGrain

The RIP has been completely replaced. This uses a newer AntiGrain (2.4) as well as a new driver architecture called VITAL. The new RIP has extensive support for the PDF Transparency model.

Several bug reports that were fixed in the branch are no longer relevant; Other issues may require revisiting in the new architecture.

Some features that are not present in the new RIP: The old RIP supported direct CMYK rendering, although this was never used by any customers. The old RIP also had special support for fat pixels (16 bits per component) and very wide lines (> 32767 pixels). This is for a specific customer, and will be added to a RIP update in the future.

riptest Added dpi and page size to command line parameters

Previous RIP bugs:

#126 Aliasing options and related bugs

#129 Fixing holes in gradients

#351 Part 1 - Transparency glitch - funky alpha math

Other

#231 HP-GL/2 output improvements
The HP-GL/2 output driver has been expanded to a fairly complete state including some support for HP-RTL.

Driver Interface

The driver interface consists of:

  • The Interpreter Context: PS_CONFIG (psc)
  • The Driver Caps: PSDEVCAP (gxc),
  • The Graphic State: PSGXSTAT (gxs)
  • The driver call parameter constants and structs.
  • Any other portions of the PSI API that might be referenced by the driver
#238 UniFunc enhancements
expanded gfx/function.d UniFunc interface to make driver-based gradient / shader implementations easier

#248 pserr.h is now generated from psio/pserr.d

#286 In order to clean up some dependency cycles and narrow the exposed symbols,

the PSI include files have been reorganized.

psi.h and psgxs.h have been split into:

  • psibase.h - low level PSI types and defines like PS_OBJECT
  • psix.h - PS_CONFIG (psc) and PSDEVCAP (gxc)
  • psgxs.h - PSGXSTAT (gxs) and all the driver constants and structs
  • psi.h - full interface, just includes other files
#307 DriverEscape operator - escape to the driver from arbitrary PostScript.
DriverEscape expects two arguments: a PostScript "object" and an integer. It calls the driver passing the integer and the object as the two parameters. It pops the two arguments off the PostScript stack before calling the driver. You can use any integer to switch in the driver - just stay away from low numbers where the existing driver call numbers are. Take a look at the pdfmark implementation for an example.

#324 gxc->clip_rect is now float

#355 (part 1) Image floating point interface -
DvImgStr / PSDVIMGS was pinning pts and matrix to integer, now matrix is unpinned floating point for completeness

PS_CONFIG

PS_CONFIG is defined in psix.h

#248 Error cleanup

changed:

char *  error;                 /*  Current error  */
int     signalerr;             /*  cleaned and Signalled error value */

and added:

struct
{    char *raw;                /* thrown error */
     char *PostScript;                 /* in PostScript error space */
     int   simple;             /* simple erorr space */
} last_error;                  /* most recent error being handled (overkill) */
#279 PostScript write security

added:

char *  ps_write_path;   /*  force file write operations to be in this area */
#288 PDF crop box

changed the meaning of:

int     pdfCropped;            /*  pdfdoc::PgExtType */

added some fields for internal use:

PS_DICT *  last_font_dict;
int        parsingCustomColors;    /* parser flag */
int        makingDuoTone;          /* cspace.c flag */
FFsPtr     run_file;               /* debugging, and DvImgGrab check `#316`_ */

removed some fields no longer in use:

int  in_text;      /*  In text rendering  */
int  in_getchar;   /*  In the middle of getchar  */
int  in_charem;    /*  already capturing character (DvCharEm) */
int *time_count;   /*  Pointer to time counter  */

Driver Caps

PSDEVCAP (gxc) is defined in psix.h

Important read #166 PostScript now recognizes gxc->multichar == 0.

#179 Driver fonts optionally Windows ANSI encoding instead of PostScript Standard

adds:

int use_winansi; /* use WinAnsiEncoding for driver fonts, instead of StandardEncoding */
#306 Distiller enhancement PostScript Duotone Colorspace Detection

adds:

int image_raw_indexed:1; /*  Device wants raw image data AND indexed (requires both!) */
int want_duotone;        /* #306 turns on duotone logic (and DeviceNSeparations) */

which extends the meaning of image_raw_data

#324 gxc->clip_rect is now float

changes:

FRECT   clip_rect;  /*  Device default clip rect  */

This flag will substitute explicitly masked images in place of stencil masked images:

int image_explicit4stencil; /* emulate stencils using explicit masks; requires image_mask=1 */

These flags enable new driver Dv calls:

int  want_BT_ET;   /*  send DvBegin/EndText */
int  want_xpc;     /*  send XpcGroup and SoftMask calls */
int  want_imgsrc;  /*  send DvImgSrc - return 0 if grabbed */

The auto tiff logic (client specific) is enabled by:

int  auto_tiff;    /* enable PostScript Automatic tiff detection */

Graphic State

PSGXSTAT (gxs) is defined in psgxsh.h

These fields are part of the transparency model (#2):

int     blend_mode;    /*  PDFREF 7.2.4 */
float   stroke_alpha;  /*  PDFREF 4.3.4 */
float   fill_alpha;

While alpha is part of many of the driver parameter structs, this is the only place to pick up the blend_mode.

Additional driver signals

  • DvImgSrc (requires gxc->want_imgsrc)

    PSDVIMGS adds the image_source (gfx/imaging.d Class ImageSource) parameter which can be read by the driver instead of using DvImgRow and DvImgEnd. (By convention, if DvImgStr returns < 0, the driver has handled the image.) However, at DvImgStr time, the image data isn't fully cooked, which can put additional burdens on the driver. DvImgSrc is another chance for the driver to use PSDVIMGS image_source to grab the image, after the image format and color space have been cooked. If the driver sets gxc->want_imgsrc it will receive DvImgSrc; if the driver handles the image, it should return 0.

  • DvBeginText and DvEndText (requires gxc->want_BT_ET)

    For PDF, sends these driver signals on BT and ET operators, to help organize text input. There is no equivalent for PostScript.

  • Transparency (requires gxc->want_xpc)

    This set of driver calls support the PDF transparency model. The model is quite complex, and beyond the scope of this document. If you are interested in implementing transparency, please see The PDF Reference, and the current RIP implementation. The source file psgxs.h has the detailed definitions for the parameter blocks.

    • Transparency Groups
      • DvBeginXpcGroup - parameter PsDvBeginXpcGroup
      • DvEndXpcGroup - no parameters
    • Soft Masks
      • DvBeginSoftMask - parameter PsDvBeginSoftMask
      • DvEndSoftMask - parameter PsDvSetSoftMask
      • DvSetSoftMask - parameter PsDvSetSoftMask
      • DvDiscardSoftMask - parameter PsDvDiscardSoftMask

Extended font operations

DvFont adds the additional sub-functions:
FtGetInfo, FtGetGIDMap, FtGetGIDWidths
and their parameter blocks:
PSDVFONTINFO, PSDVGIDMAP, PSDVGIDWIDTHS

which are used specifically by the Distiller to talk to the Windows driver about fonts.

Changes to driver parameter structs

PSDVCLIP adds:

rt_Bool *evenOdd;        /*  winding flags for paths */

PSDVIMGS adds:

ClrPtr   color_space;    /*  image_raw_data : rather than tuck it in gxs */
ImagePtr image_source;   /*  quick hook to grab the ImageSource */
float    alpha;          /*  also in gxs->fill_alpha */

PSDVIMGRAB adds this for #316:

int  is_unbounded_WARNING;  /* inline PostScript - can't read to eof */

PSDVGLYPH adds this for #126:

int  bytes_per_row;   /* pitch / stride */

PSDVCHAREM changes the meaning of these fields for ticket #11:

double x2;     /* end point */  /*returned if driver handles glyph!*/
double width;  /* character width - *returned if driver handles glyph!* */

PSDVCHAREM adds this for ticket #384:

int   text_mode;       /* optional: text rendering mode PDFREF 5.2.5 */

References