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

« back to all changes in this revision

Viewing changes to cups/pstopxl.in

  • 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
1
#!/bin/sh
2
2
#
3
 
# "$Id: pstopxl.in,v 1.1.2.2 2004/06/29 13:15:10 mike Exp $"
 
3
# "$Id: pstopxl.in 9250 2008-11-29 12:27:04Z till $"
4
4
#
5
5
# CUPS PCL XL/PCL 6 filter script for Ghostscript.
6
6
#
45
45
    device="pxlmono"
46
46
fi
47
47
 
 
48
# Apply PPD settings.
 
49
 
 
50
ps_code=
 
51
ppd_opts=
 
52
 
 
53
resolution=
 
54
eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)Resolution=([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\2}"/p')"
 
55
if test -e "$PPD"; then
 
56
  eval "$(sed -nre 's/^\*DefaultResolution:\s+([0-9.]+(x[0-9.]+)?).*/resolution="${resolution:-\1}"/p' "$PPD")"
 
57
fi
 
58
echo "DEBUG: Resolution: $resolution" >&2
 
59
if test -n "$resolution"; then
 
60
  ppd_opts="${ppd_opts:+$ppd_opts }-r$resolution"
 
61
fi
 
62
 
 
63
pagesize=
 
64
eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(media|PageSize)=(\S+).*/pagesize="${pagesize:-\3}"/p')"
 
65
if test -e "$PPD"; then
 
66
  eval "$(sed -nre 's/^\*DefaultPageSize:\s+(\S+).*/pagesize="${pagesize:-\1}"/p' "$PPD")"
 
67
fi
 
68
echo "DEBUG: Page size: $pagesize" >&2
 
69
width=
 
70
height=
 
71
if test -n "$pagesize" && test -e "$PPD"; then
 
72
  eval "$(sed -nre 's|^\*PaperDimension\s+'"$pagesize"'/[^:]+:\s+"(\S+)\s+(\S+)".*|width="\1"; height="\2"|p' "$PPD")"
 
73
fi
 
74
echo "DEBUG: Width: $width, height: $height" >&2
 
75
if test -n "$width"; then
 
76
  ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEWIDTHPOINTS=$width"
 
77
fi
 
78
if test -n "$height"; then
 
79
  ppd_opts="${ppd_opts:+$ppd_opts }-dDEVICEHEIGHTPOINTS=$height"
 
80
fi
 
81
 
 
82
bl_x=
 
83
bl_y=
 
84
tr_x=
 
85
tr_y=
 
86
if test -n "$pagesize" && test -e "$PPD"; then
 
87
  eval "$(sed -nre 's|^\*ImageableArea\s+'"$pagesize"'/[^:]+:\s+"(\S+)\s+(\S+)\s+(\S+)\s+(\S+)".*|bl_x="\1"; bl_y="\2"; tr_x="\3"; tr_y="\4"|p' "$PPD")"
 
88
fi
 
89
echo "DEBUG: Absolute margins: $bl_x, $bl_y, $tr_x, $tr_y" >&2
 
90
margin_l=
 
91
margin_b=
 
92
margin_r=
 
93
margin_t=
 
94
if test -n "$width" && test -n "$height" && \
 
95
   test -n "$bl_x" && test -n "$bl_y" && \
 
96
   test -n "$tr_x" && test -n "$tr_y"; then
 
97
  margin_l="$bl_x"
 
98
  margin_b="$bl_y"
 
99
  margin_r="$(printf "scale=8; (%s)-(%s)\n" "$width" "$tr_x" | bc)"
 
100
  margin_t="$(printf "scale=8; (%s)-(%s)\n" "$height" "$tr_y" | bc)"
 
101
fi
 
102
echo "DEBUG: Relative margins: $margin_l, $margin_b, $margin_r, $margin_t" >&2
 
103
if test -n "$margin_l" && test -n "$margin_b" && \
 
104
   test -n "$margin_r" && test -n "$margin_t"; then
 
105
  ps_code="${ps_code:+$ps_code }<</.HWMargins[$margin_l $margin_b $margin_r $margin_t] /Margins[0 0]>>setpagedevice"
 
106
fi
 
107
 
 
108
inputslot=
 
109
eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(InputSlot)=(\S+).*/inputslot="${inputslot:-\3}"/p')"
 
110
if test -e "$PPD"; then
 
111
  eval "$(sed -nre 's/^\*DefaultInputSlot:\s+(\S+).*/inputslot="${inputslot:-\1}"/p' "$PPD")"
 
112
fi
 
113
echo "DEBUG: InputSlot: $inputslot" >&2
 
114
inputslot_val=
 
115
if test -n "$inputslot" && test -e "$PPD"; then
 
116
  eval "$(sed -nre 's|^\*InputSlot\s+'"$inputslot"'/[^:]+:\s+"\s*<\s*<\s*/MediaPosition\s*([0-9]+)\s*>\s*>\s*setpagedevice\s*".*|inputslot_val="\1"|p' "$PPD")"
 
117
fi
 
118
echo "DEBUG: Value for MediaPosition: $inputslot_val" >&2
 
119
if test -n "$inputslot_val"; then
 
120
  ppd_opts="${ppd_opts:+$ppd_opts }-dMediaPosition=$inputslot_val"
 
121
fi
 
122
 
 
123
colormodel=
 
124
eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(ColorModel)=(\S+).*/colormodel="${colormodel:-\3}"/p')"
 
125
if test -e "$PPD"; then
 
126
  eval "$(sed -nre 's/^\*DefaultColorModel:\s+(\S+).*/colormodel="${colormodel:-\1}"/p' "$PPD")"
 
127
fi
 
128
echo "DEBUG: ColorModel: $colormodel" >&2
 
129
colormodel_val=
 
130
if test -n "$colormodel" && test -e "$PPD"; then
 
131
  eval "$(sed -nre 's|^\*ColorModel\s+'"$colormodel"'/[^:]+:\s+"\s*<\s*<\s*/BitsPerPixel\s*([0-9]*)\s*>\s*>\s*setpagedevice\s*".*|colormodel_val="\1"|p' "$PPD")"
 
132
fi
 
133
echo "DEBUG: Value for BitsPerPixel: $colormodel_val" >&2
 
134
if test -n "$colormodel_val"; then
 
135
  ppd_opts="${ppd_opts:+$ppd_opts }-dBitsPerPixel=$colormodel_val"
 
136
fi
 
137
 
 
138
duplex=
 
139
eval "$(printf "%s" "$5" | sed -nre 's/.*(^|\s)(Duplex)=(\S+).*/duplex="${duplex:-\3}"/p')"
 
140
if test -e "$PPD"; then
 
141
  eval "$(sed -nre 's/^\*DefaultDuplex:\s+(\S+).*/duplex="${duplex:-\1}"/p' "$PPD")"
 
142
fi
 
143
echo "DEBUG: Duplex: $duplex" >&2
 
144
duplex_val=
 
145
tumble_val=
 
146
if test -n "$duplex" && test -e "$PPD"; then
 
147
  eval "$(sed -nre 's|^\*Duplex\s+'"$duplex"'/[^:]+:\s+"\s*<\s*<\s*/Duplex\s*(\S*)\s*(/Tumble\s*(\S*)\s*)?>\s*>\s*setpagedevice\s*".*|duplex_val="\1"; tumble_val="\3"|p' "$PPD")"
 
148
fi
 
149
echo "DEBUG: Value for Duplex: $duplex_val; Value for Tumble: $tumble_val" >&2
 
150
if test -n "$duplex_val"; then
 
151
  ppd_opts="${ppd_opts:+$ppd_opts }-dDuplex=$duplex_val"
 
152
fi
 
153
if test -n "$tumble_val"; then
 
154
  ppd_opts="${ppd_opts:+$ppd_opts }-dTumble=$tumble_val"
 
155
fi
 
156
 
 
157
 
 
158
echo "DEBUG: PPD options: $ppd_opts" >&2
 
159
echo "DEBUG: PostScript code from options: $ps_code" >&2
 
160
 
48
161
# Options we use with Ghostscript...
49
 
gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH"
50
 
gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=$device -sstdout=%stderr"
 
162
gsopts="-dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH"
 
163
gsopts="$gsopts -sDEVICE=$device -sstdout=%stderr"
51
164
 
52
165
# See if we have a filename on the command-line...
53
 
if test -z "$6"; then
54
 
        ifile="-_"
55
 
else
56
 
        ifile="$6"
 
166
if [ -n "$6" ]; then
 
167
  exec <"$6"
57
168
fi
58
169
 
 
170
# We read the data into a temporary file as Ghostscript needs this to be
 
171
# able to also work with PDF input
 
172
tempfiles=
 
173
trap 'rm -f $tempfiles' 0 1 2 13 15
 
174
 
 
175
ifile=$(mktemp -t pstopxl.XXXXXX)
 
176
tempfiles="$tempfiles $ifile"
 
177
 
 
178
cat >"$ifile"
 
179
 
59
180
echo INFO: Starting GPL Ghostscript `$bindir/@GS@ --version`... 1>&2
60
 
echo DEBUG: Running $bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" "$ifile" 1>&2
 
181
echo DEBUG: Running $bindir/@GS@ $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile" 1>&2
61
182
 
62
183
# Now run Ghostscript...
63
 
exec $bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" "$ifile"
 
184
$bindir/@GS@ $gsopts $ppd_opts -sOUTPUTFILE="%stdout" -c "$ps_code" -f "$ifile"
64
185
 
65
186
#
66
 
# End of "$Id: pstopxl.in,v 1.1.2.2 2004/06/29 13:15:10 mike Exp $".
 
187
# End of "$Id: pstopxl.in 9250 2008-11-29 12:27:04Z till $".
67
188
#