[gs-cvs] rev 7814 - in trunk/gs: lib src
leonardo at ghostscript.com
leonardo at ghostscript.com
Sun Apr 1 12:14:50 PDT 2007
Author: leonardo
Date: 2007-04-01 12:14:49 -0700 (Sun, 01 Apr 2007)
New Revision: 7814
Modified:
trunk/gs/lib/gs_pdfwr.ps
trunk/gs/src/gdevpdfb.h
trunk/gs/src/gdevpdfd.c
trunk/gs/src/gdevpdfp.c
trunk/gs/src/gdevpdfx.h
Log:
Fix (ps2write) : Device initialization problems.
DETAILS :
Patch from SaGS with a minor improvement.
See bug 688856 comments 11,12,13 for details.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/lib/gs_pdfwr.ps
===================================================================
--- trunk/gs/lib/gs_pdfwr.ps 2007-04-01 18:27:55 UTC (rev 7813)
+++ trunk/gs/lib/gs_pdfwr.ps 2007-04-01 19:14:49 UTC (rev 7814)
@@ -797,25 +797,33 @@
dup type /booleantype eq not { cleartomark pop } if pop pop
} bind .schedule_init
-1011 % priority
-{
- % Set a path to library files (ps2write)
- currentdevice .devicename /ps2write eq {
- mark
- systemdict /OPDFReadProcsetPath .knownget not {
- (gs_mgl_e.ps) (gs_mro_e.ps) (gs_agl.ps) (opdfread.ps) % Reverse order !
- () counttomark 1 sub {
- exch
- .libfile { .filename } { false } ifelse not {
- (Configuration error : library file opdfread.ps not found !) =
- (opdfread.ps) /undefinedfilename signalerror
- } if
- .filenamelistseparator concatstrings concatstrings
- } repeat
+% Set a path to library files (ps2write)
+.defaultdevicename /ps2write eq {
+ mark
+ /OPDFReadProcsetPath
+ systemdict /OPDFReadProcsetPath .knownget dup { % check for a value on the command-line
+ 1 index () eq {
+ (Configuration warning : empty OPDFReadProcsetPath, will use defaults.) =
+ systemdict /OPDFReadProcsetPath undef
+ pop pop false
+ } if
+ } if
+ not { % if necessary, compute a default
+ mark
+ (gs_mgl_e.ps) (gs_mro_e.ps) (gs_agl.ps) (opdfread.ps) % Reverse order !
+ () counttomark 1 sub {
+ exch
+ .libfile { .filename } { false } ifelse not {
+ (Configuration error : library file opdfread.ps not found !) =
+ (opdfread.ps) /undefinedfilename signalerror
} if
- /OPDFReadProcsetPath exch .dicttomark setpagedevice
- } if
-} bind .schedule_init
+ .filenamelistseparator concatstrings concatstrings
+ } repeat
+ exch pop
+ } if
+ %stack: mark /OPDFReadProcsetPath <filelist>
+ /ps2write finddevice putdeviceprops pop % set the default instance's procset path
+} if
2000 % priority
{ % Note, this may not work if the initial device is not pdfwrite
Modified: trunk/gs/src/gdevpdfb.h
===================================================================
--- trunk/gs/src/gdevpdfb.h 2007-04-01 18:27:55 UTC (rev 7813)
+++ trunk/gs/src/gdevpdfb.h 2007-04-01 19:14:49 UTC (rev 7814)
@@ -88,6 +88,7 @@
gdev_pdf_include_color_space /* include_color_space */
},
psdf_initial_values(PSDF_VERSION_INITIAL, 0 /*false */ ), /* (!ASCII85EncodePages) */
+ PDF_FOR_OPDFREAD, /* is_ps2write */
PDF_COMPATIBILITY_LEVEL_INITIAL, /* CompatibilityLevel */
-1, /* EndPage */
1, /* StartPage */
Modified: trunk/gs/src/gdevpdfd.c
===================================================================
--- trunk/gs/src/gdevpdfd.c 2007-04-01 18:27:55 UTC (rev 7813)
+++ trunk/gs/src/gdevpdfd.c 2007-04-01 19:14:49 UTC (rev 7814)
@@ -47,7 +47,7 @@
/* Make a special check for the initial fill with white, */
/* which shouldn't cause the page to be opened. */
- if (color == pdev->white && !is_in_page(pdev) && pdev->sbstack_depth == bottom)
+ if (color == pdev->white && !is_in_page(pdev) && pdev->sbstack_depth <= bottom)
if (x == 0 && y == 0 && w == pdev->width && h == pdev->height)
return 0;
code = pdf_open_page(pdev, PDF_IN_STREAM);
Modified: trunk/gs/src/gdevpdfp.c
===================================================================
--- trunk/gs/src/gdevpdfp.c 2007-04-01 18:27:55 UTC (rev 7813)
+++ trunk/gs/src/gdevpdfp.c 2007-04-01 19:14:49 UTC (rev 7814)
@@ -83,7 +83,7 @@
pi("NoEncrypt", gs_param_type_string, NoEncrypt),
/* Target viewer capabilities (Ghostscript-specific) */
- pi("ForOPDFRead", gs_param_type_bool, ForOPDFRead),
+ /* pi("ForOPDFRead", gs_param_type_bool, ForOPDFRead), pdfwrite-only */
pi("PatternImagemask", gs_param_type_bool, PatternImagemask),
pi("MaxClipPathSize", gs_param_type_int, MaxClipPathSize),
pi("MaxShadingBitmapSize", gs_param_type_int, MaxShadingBitmapSize),
@@ -91,7 +91,7 @@
pi("HaveTrueTypes", gs_param_type_bool, HaveTrueTypes),
pi("HaveCIDSystem", gs_param_type_bool, HaveCIDSystem),
pi("HaveTransparency", gs_param_type_bool, HaveTransparency),
- pi("OPDFReadProcsetPath", gs_param_type_string, OPDFReadProcsetPath),
+ /* pi("OPDFReadProcsetPath", gs_param_type_string, OPDFReadProcsetPath), ps2write-only */
pi("CompressEntireFile", gs_param_type_bool, CompressEntireFile),
pi("PDFX", gs_param_type_bool, PDFX),
pi("PDFA", gs_param_type_bool, PDFA),
@@ -196,6 +196,8 @@
(code = param_write_int(plist, ".EmbedFontObjects", &EmbedFontObjects)) < 0 ||
(code = param_write_int(plist, "CoreDistVersion", &cdv)) < 0 ||
(code = param_write_float(plist, "CompatibilityLevel", &cl)) < 0 ||
+ (pdev->is_ps2write && (code = param_write_string(plist, "OPDFReadProcsetPath", &pdev->OPDFReadProcsetPath)) < 0) ||
+ (!pdev->is_ps2write && (code = param_write_bool(plist, "ForOPDFRead", &pdev->ForOPDFRead)) < 0) ||
/* Indicate that we can process pdfmark and DSC. */
(param_requested(plist, "pdfmark") > 0 &&
(code = param_write_null(plist, "pdfmark")) < 0) ||
@@ -332,6 +334,10 @@
plist->memory = pdev->pdf_memory;
code = gs_param_read_items(plist, pdev, pdf_param_items);
+ if (code < 0 ||
+ (pdev->is_ps2write && (code = param_read_string(plist, "OPDFReadProcsetPath", &pdev->OPDFReadProcsetPath)) < 0) ||
+ (!pdev->is_ps2write && (code = param_read_bool(plist, "ForOPDFRead", &pdev->ForOPDFRead)) < 0)
+ );
plist->memory = mem;
}
if (code < 0)
@@ -521,6 +527,8 @@
memcpy((char *)pdev + ppi->offset,
(char *)&save_dev + ppi->offset,
gs_param_type_sizes[ppi->type]);
+ pdev->ForOPDFRead = save_dev.ForOPDFRead;
+ pdev->OPDFReadProcsetPath = save_dev.OPDFReadProcsetPath;
}
return ecode;
}
Modified: trunk/gs/src/gdevpdfx.h
===================================================================
--- trunk/gs/src/gdevpdfx.h 2007-04-01 18:27:55 UTC (rev 7813)
+++ trunk/gs/src/gdevpdfx.h 2007-04-01 19:14:49 UTC (rev 7814)
@@ -403,6 +403,7 @@
/* Define the device structure. */
struct gx_device_pdf_s {
gx_device_psdf_common;
+ bool is_ps2write; /* ps2write (true) versus pdfwrite (false); never changed */
/* PDF-specific distiller parameters */
double CompatibilityLevel;
int EndPage;
More information about the gs-cvs
mailing list