~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to Resource/Init/gs_dps2.ps

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%    Copyright (C) 1990, 1996, 1997, 1998, 2000 Aladdin Enterprises.  All rights reserved.
 
2
 
3
% This software is provided AS-IS with no warranty, either express or
 
4
% implied.
 
5
 
6
% This software is distributed under license and may not be copied,
 
7
% modified or distributed except as expressly authorized under the terms
 
8
% of the license contained in the file LICENSE in this distribution.
 
9
 
10
% For more information about licensing, please refer to
 
11
% http://www.ghostscript.com/licensing/. For information on
 
12
% commercial licensing, go to http://www.artifex.com/licensing/ or
 
13
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
 
14
% San Rafael, CA  94903, U.S.A., +1(415)492-9861.
 
15
 
 
16
% $Id: gs_dps2.ps 8954 2008-08-08 04:22:38Z ray $
 
17
% Initialization file for basic Display PostScript functions
 
18
% that are also included in Level 2.
 
19
 
 
20
level2dict begin
 
21
 
 
22
% ------ Errors ------ %
 
23
 
 
24
% These errors are only defined in Level 2 and DPS.
 
25
{ /configurationerror /undefinedresource /unregistered }
 
26
{ .registererror } forall
 
27
 
 
28
% ------ Halftones ------ %
 
29
 
 
30
/.makestackdict
 
31
        { { counttomark -1 roll } forall .dicttomark
 
32
        } bind def
 
33
/currenthalftone                % - currenthalftone <dict>
 
34
        { mark .currenthalftone
 
35
           { { exch pop }               % halftone
 
36
             { /HalftoneType 1          % screen
 
37
                { /Frequency /Angle /SpotFunction }
 
38
               .makestackdict readonly
 
39
             }
 
40
             { /HalftoneType 2          % colorscreen
 
41
                { /RedFrequency /RedAngle /RedSpotFunction
 
42
                  /GreenFrequency /GreenAngle /GreenSpotFunction
 
43
                  /BlueFrequency /BlueAngle /BlueSpotFunction
 
44
                  /GrayFrequency /GrayAngle /GraySpotFunction
 
45
                }
 
46
               .makestackdict readonly
 
47
             }
 
48
           }
 
49
          exch get exec
 
50
        } odef
 
51
% Define sethalftone so it converts types 1-4 to type 5.
 
52
/.makehalftoneRGBV {    % <dict> <type> <keys> <keysRGBV>
 
53
  4 -1 roll exch { 1 index exch get exch } forall 15 1 roll
 
54
  14 -2 roll mark 15 1 roll { /Gray /Blue /Green /Red } {
 
55
                % stack: v0 v1 v2 type keys comp
 
56
    mark
 
57
    2 index 0 get 8 -1 roll
 
58
    4 index 1 get 9 -1 roll
 
59
    6 index 2 get 10 -1 roll
 
60
                % stack: type keys comp mark k0 v0 k1 v1 k2 v2
 
61
    /HalftoneType 10 index .dicttomark
 
62
    counttomark 2 roll
 
63
  } forall pop pop
 
64
  /Default 1 index .dicttomark exch pop { .sethalftone5 }
 
65
} bind def
 
66
 
 
67
% The value of each entry in .halftonetypes is a procedure:
 
68
%       <setdict> <htdict> <<proc>> <setdict'> <htdict'> <sethalftoneproc>
 
69
% This allows us to use these procedures both for actually implementing
 
70
% sethalftone and for converting subsidiary dictionaries of HalftoneType 5
 
71
% halftones.
 
72
systemdict begin
 
73
15 dict /.halftonetypes 1 index def begin
 
74
  1 {
 
75
    mark exch /Default exch .dicttomark { .sethalftone5 }
 
76
  } bind def
 
77
  2 {
 
78
    1 { /Frequency /Angle /SpotFunction } {
 
79
      /RedFrequency /RedAngle /RedSpotFunction
 
80
      /GreenFrequency /GreenAngle /GreenSpotFunction
 
81
      /BlueFrequency /BlueAngle /BlueSpotFunction
 
82
      /GrayFrequency /GrayAngle /GraySpotFunction
 
83
    } .makehalftoneRGBV
 
84
  } bind def
 
85
  3 {
 
86
    mark exch /Default exch .dicttomark { .sethalftone5 }
 
87
  } bind def
 
88
  4 {
 
89
    3 { /Width /Height /Thresholds } {
 
90
      /RedWidth /RedHeight /RedThresholds
 
91
      /GreenWidth /GreenHeight /GreenThresholds
 
92
      /BlueWidth /BlueHeight /BlueThresholds
 
93
      /GrayWidth /GrayHeight /GrayThresholds
 
94
    } .makehalftoneRGBV
 
95
  } bind def
 
96
  5 {
 
97
    pop dup length dict copy
 
98
    mark 1 index {
 
99
                % Even HalftoneType 5 dictionaries have entries other than
 
100
                % subsidiary halftone dictionaries.
 
101
      dup type /dicttype ne {
 
102
        0
 
103
      } {
 
104
        dup /HalftoneType .knownget not { 0 } if
 
105
      } ifelse dup 5 gt {
 
106
                % Stack: dict mark ... keyN dictN httypeN
 
107
                % Assume that all HalftoneTypes > 5 convert to 5.
 
108
        1 index 3 1 roll
 
109
        //.halftonetypes exch get exec pop /Default get
 
110
                % Stack: dict mark ... keyN setdict'N htdict'N
 
111
        counttomark 1 add index 3 index 4 -1 roll put
 
112
      } {
 
113
        pop
 
114
      } ifelse
 
115
    } forall .dicttomark { .sethalftone5 }
 
116
  } bind def
 
117
end
 
118
end
 
119
/sethalftone {          % <dict> sethalftone -
 
120
        % We must create the new dictionary in the same VM as the
 
121
        % operand; otherwise, invalidaccess errors may occur.
 
122
  .currentglobal 1 .argindex dup gcheck .setglobal
 
123
  dup //.halftonetypes 1 index /HalftoneType get
 
124
  dup type /integertype ne {
 
125
    /sethalftone .systemvar /typecheck signalerror
 
126
  } if
 
127
  .knownget not {
 
128
    /sethalftone .systemvar /rangecheck signalerror
 
129
  } if
 
130
  exec exec
 
131
  .setglobal pop
 
132
} .bind odef
 
133
% Redefine setscreen and setcolorscreen to recognize halftone dictionaries,
 
134
% and to insert the Frequency and Angle into Type 1 halftones, per
 
135
% Adobe TN 5085.
 
136
/.fixsethalftonescreen          % <freq> <angle> <dict> .fix...screen
 
137
                                %   <freq> <angle> <dict> <dict'>
 
138
 { dup dup /HalftoneType get 1 eq
 
139
    { dup wcheck not { dup length .copydict } if
 
140
      dup /Frequency 5 index put
 
141
      dup /Angle 4 index put
 
142
      languagelevel 3 ge { dup /AccurateScreens dup getuserparam put } if
 
143
    }
 
144
   if
 
145
 } bind def
 
146
/setscreen              % <ignore*2> <dict> setscreen -
 
147
        { dup type /dicttype eq
 
148
           { .fixsethalftonescreen sethalftone pop pop pop }
 
149
           { //setscreen }
 
150
          ifelse
 
151
        } .bind odef
 
152
/setcolorscreen         % <ignore*11> <dict> setcolorscreen -
 
153
        { dup type /dicttype eq
 
154
           { .fixsethalftonescreen sethalftone 12 { pop } repeat }
 
155
           { //setcolorscreen }
 
156
          ifelse
 
157
        } .bind odef
 
158
% Redefine currentscreen and currentcolorscreen to extract the Frequency
 
159
% and Angle from Type 1 halftones, per Adobe TN 5085.
 
160
/.fixcurrenthalftonescreen      % <dict> .fix... <freq> <angle> <proc>
 
161
 { dup /HalftoneType get 1 eq
 
162
    { dup /Frequency get 1 index /Angle get }
 
163
    { 60.0 0.0 }        % Adobe returns these as reals
 
164
   ifelse 3 2 roll
 
165
 } bind def
 
166
/currentscreen          % - currentscreen 60 0 <dict>
 
167
        { .currenthalftone
 
168
           { { .fixcurrenthalftonescreen }      % halftone
 
169
             { }                                % screen
 
170
             { 12 3 roll 9 { pop } repeat       % colorscreen
 
171
               dup type /dicttype eq { .fixcurrenthalftonescreen } if
 
172
             }
 
173
           }
 
174
          exch get exec
 
175
        } odef
 
176
/currentcolorscreen     % - currentcolorscreen (60 0 <dict>)*4
 
177
{ .currenthalftone
 
178
   { { .fixcurrenthalftonescreen 3 copy 6 copy }        % halftone
 
179
     {                                  % screen
 
180
         % The procedure might not be readable....
 
181
         dup rcheck { dup length array copy cvx } if
 
182
         3 copy 6 copy
 
183
     }
 
184
     { }                                % colorscreen
 
185
   }
 
186
  exch get exec
 
187
} odef
 
188
 
 
189
% ------ User objects ------ %
 
190
 
 
191
/.UserObjects {
 
192
  .userdict /UserObjects
 
193
} odef
 
194
% In order to get proper error recovery behavior, we need to be careful
 
195
% not to pop any operands from the stack until we're done.
 
196
% The code below faithfully duplicates the apparent array-growing
 
197
% behavior of Adobe interpreters.
 
198
/defineuserobject {             % <index> <value> defineuserobject -
 
199
  1 index 65535 gt {
 
200
    % .localvmarray throws limitcheck but CET 31-02 wants rangecheck
 
201
    /defineuserobject .systemvar /rangecheck signalerror 
 
202
  } if
 
203
  .UserObjects .knownget {
 
204
    length dup 3 .argindex le {
 
205
                % Stack: index value len
 
206
      2 index eq { 1 index 2 mul } { 1 index 1 add } ifelse
 
207
      .localvmarray .UserObjects get
 
208
      1 index copy pop
 
209
      .UserObjects 3 -1 roll put
 
210
    } {
 
211
      pop
 
212
    } ifelse
 
213
  } {
 
214
    .UserObjects 3 .argindex 1 add 10 .max .localvmarray put
 
215
  } ifelse
 
216
  .UserObjects get 2 .argindex 2 index put pop pop
 
217
} odef
 
218
/execuserobject {               % <index> execuserobject -
 
219
  dup type /integertype ne {
 
220
    % Adobe validates the argument before accessing UserObjects - CET 31-03 
 
221
    /execuserobject .systemvar /typecheck signalerror 
 
222
  } if
 
223
  .UserObjects get 1 .argindex get exch pop exec
 
224
} odef
 
225
/undefineuserobject {           % <index> undefineuserobject -
 
226
  dup type /integertype ne {
 
227
    % Adobe validates the argument before accessing UserObjects - CET 31-11 
 
228
    /undefineuserobject .systemvar /typecheck signalerror
 
229
  } if
 
230
  .UserObjects get 1 .argindex //null put pop
 
231
} odef
 
232
 
 
233
% ------ Cache control ------ %
 
234
 
 
235
% Dummy definitions for cache control operators
 
236
 
 
237
/ucachestatus {                 % - ucachestatus -mark- ? ? ? ? <size>
 
238
        mark 0 0 0 0 /MaxUPathItem getuserparam
 
239
} odef
 
240
/setucacheparams {              % -mark- ... <size> setucacheparams -
 
241
                % Provoke an appropriate error if needed.
 
242
        counttomark 1 lt { () 0 get } if
 
243
        dup 0 or /MaxUPathItem getuserparam .max
 
244
        1 dict dup /MaxUPathItem 4 -1 roll put setuserparams cleartomark
 
245
} odef
 
246
 
 
247
end                             % level2dict