summaryrefslogtreecommitdiff
blob: 0271fd996376ac89af89aa3e5fd67b8c57c05e0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
diff -u lib/gs_init.ps.orig lib/gs_init.ps
--- lib/gs_init.ps.orig	2006-02-21 22:29:07.000000000 +0100
+++ lib/gs_init.ps	2006-05-17 22:31:11.000000000 +0200
@@ -152,6 +152,7 @@
 currentdict /NOFONTPATH known   /NOFONTPATH exch def
 currentdict /NOGC known   /NOGC exch def
 currentdict /NOINTERPOLATE .knownget { /INTERPOLATE exch not def } if
+currentdict /NOMEDIAATTRS known /NOMEDIAATTRS exch def
 currentdict /NOOUTERSAVE known   /NOOUTERSAVE exch def
 currentdict /NOPAGEPROMPT known   /NOPAGEPROMPT exch def
 currentdict /NOPAUSE known   /NOPAUSE exch def
diff -u lib/gs_setpd.ps.orig lib/gs_setpd.ps
--- lib/gs_setpd.ps.orig	2005-12-28 20:56:24.000000000 +0100
+++ lib/gs_setpd.ps	2006-05-17 22:33:54.000000000 +0200
@@ -375,21 +375,42 @@
     } bind
 .dicttomark readonly def
 
-% Define the keys used in input attribute matching.
-/.inputattrkeys [
-  /PageSize /MediaColor /MediaWeight /MediaType /InsertSheet /ManualFeed
-	% The following are documented in Adobe's supplement for v2017.
-  /LeadingEdge /MediaClass
-] readonly def
-% Define other keys used in media selection.
-/.inputselectionkeys [
-  /MediaPosition /Orientation
-] readonly def
-
-% Define the keys used in output attribute matching.
-/.outputattrkeys [
-  /OutputType
-] readonly def
+% M. Sweet, Easy Software Products:
+%
+% Define NOMEDIAATTRS to turn off the default (but unimplementable) media
+% selection policies for setpagedevice.  This is used by CUPS to support
+% the standard Adobe media attributes.
+NOMEDIAATTRS {
+  % Define only PageSize for input attribute matching.
+  /.inputattrkeys [
+    /PageSize
+  ] readonly def
+  % Define no other keys used in media selection.
+  /.inputselectionkeys [
+    /noInputSelectionsKeys
+  ] readonly def
+
+  % Define no keys used in output attribute matching.
+  /.outputattrkeys [
+    /noOutputAttrKeys
+  ] readonly def
+} {
+  % Define the keys used in input attribute matching.
+  /.inputattrkeys [
+    /PageSize /MediaColor /MediaWeight /MediaType /InsertSheet /ManualFeed
+     % The following are documented in Adobe's supplement for v2017.
+    /LeadingEdge /MediaClass
+  ] readonly def
+  % Define other keys used in media selection.
+  /.inputselectionkeys [
+    /MediaPosition /Orientation
+  ] readonly def
+
+  % Define the keys used in output attribute matching.
+  /.outputattrkeys [
+    /OutputType
+  ] readonly def
+} ifelse
 
 % Define all the parameters that should always be copied to the merged
 % dictionary.
@@ -418,7 +439,13 @@
   /PageSize //false		% obsolete alias for .MediaSize
   /InputAttributes //false
   .inputattrkeys
-    { dup /PageSize eq
+    % M. Sweet, Easy Software Products:
+    %
+    % Treat LeadingEdge like PageSize so that a common Ghostscript driver
+    % doesn't need the NOMEDIAATTRS definition.
+    %
+    % { dup /PageSize eq
+    { dup dup /PageSize eq exch /LeadingEdge eq or
        { pop }
        { { 2 index /InputAttributes .knownget { //null eq } { //true } ifelse } }
       ifelse
@@ -499,11 +526,23 @@
 % They are expected to consume the top 2 operands.
 % NOTE: we currently treat all values other than 0, 1, or 7 (for PageSize)
 % the same as 0, i.e., we signal an error.
+%
+% M. Sweet, Easy Software Products:
+%
+% Define NOMEDIAATTRS to turn off the default (but unimplementable) media
+% selection policies for setpagedevice.  This is used by CUPS to support
+% the standard Adobe media attributes.
+  SETPDDEBUG { (Rolling back.) = pstack flush } if
   0 {		% Set errorinfo and signal a configurationerror.
-	pop dup 4 index exch get 2 array astore
-	$error /errorinfo 3 -1 roll put
-	cleartomark
+          NOMEDIAATTRS {
+          % NOMEDIAATTRS means that the default policy is 7...
+          pop 2 index exch 7 put
+        } {
+  	pop dup 4 index exch get 2 array astore
+  	$error /errorinfo 3 -1 roll put
+  	cleartomark
 	/setpagedevice .systemvar /configurationerror signalerror
+        } ifelse
   } bind
   1 {		% Roll back the failed request to its previous status.
 SETPDDEBUG { (Rolling back.) = pstack flush } if