Use upstream patch to fix duplex for some devices (bug #1068896).

Resolves: rhbz#1068896
This commit is contained in:
Tim Waugh 2014-02-27 16:16:13 +00:00
parent 7237d438e3
commit 68499706a5
2 changed files with 74 additions and 1 deletions

66
ghostscript-duplex.patch Normal file
View File

@ -0,0 +1,66 @@
diff -up ghostscript-9.10/devices/vector/opdfread.h.duplex ghostscript-9.10/devices/vector/opdfread.h
--- ghostscript-9.10/devices/vector/opdfread.h.duplex 2013-08-30 11:37:28.000000000 +0100
+++ ghostscript-9.10/devices/vector/opdfread.h 2014-02-27 15:59:45.986847087 +0000
@@ -734,10 +734,27 @@ const char *opdfread_ps [] = {
"0 0}ifelse\n",
"round cvi 2 index round cvi eq\n",
"exch round cvi 3 index round cvi eq and{\n",
+"//PDFR_DEBUG{(PageSize matches request) == flush}if\n",
"pop pop}{\n",
+"/MediaRequested where {\n",
+"//PDFR_DEBUG{(MediaRequested is true, check against new request) == flush}if\n",
+"/MediaRequested get aload pop\n",
+"round cvi 2 index round cvi eq\n",
+"exch round cvi 3 index round cvi eq and\n",
+"{//PDFR_DEBUG{(MediaRequested same as current request, ignore) == flush}if pop pop false}\n",
+"{//PDFR_DEBUG{(MediaRequested different to current request) == flush}if true}ifelse\n",
+"}{\n",
+"//PDFR_DEBUG{(No MediaRequested yet) == flush}if\n",
+"true\n",
+"}ifelse\n",
+"{\n",
+"//PDFR_DEBUG{(Setting pagesize) == flush}if\n",
"2 array astore\n",
+"dup /MediaRequested exch def\n",
"<< exch /PageSize exch >> setpagedevice\n",
-"} ifelse\n",
+"/pagesave save def\n",
+"}if\n",
+"}ifelse\n",
"userdict/PDFR_InitialGS gstate put\n",
"setglobal\n",
"}if\n",
diff -up ghostscript-9.10/lib/opdfread.ps.duplex ghostscript-9.10/lib/opdfread.ps
--- ghostscript-9.10/lib/opdfread.ps.duplex 2013-08-30 11:37:28.000000000 +0100
+++ ghostscript-9.10/lib/opdfread.ps 2014-02-27 15:59:45.987847093 +0000
@@ -896,13 +896,27 @@ currentdict end readonly def
0 0 % dummy page size values if not known
}ifelse
% bw bh px0 py0 bw bh bool bw bh Width Height
- round cvi 2 index round cvi % bw bh px0 py0 bw bh bool bw bh Width bool
+ round cvi 2 index round cvi eq % bw bh px0 py0 bw bh bool bw bh Width bool
exch round cvi 3 index round cvi eq and % bw bh px0 py0 bw bh bool bw bh bool
{ % Page Size unchanged, do not emit setpagedevice
pop pop % bw bh px0 py0 bw bh bool
} {
- 2 array astore % bw bh px0 py0 bw bh bool []
- << exch /PageSize exch >> setpagedevice % bw bh px0 py0 bw bh bool
+ /MediaRequested where {
+ % bw bh px0 py0 bw bh
+ /MediaRequested get aload pop % bw bh px0 py0 bw bh Width Height
+ round cvi 2 index round cvi eq % bw bh px0 py0 bw bh bool bw bh Width bool
+ exch round cvi 3 index round cvi eq and % bw bh px0 py0 bw bh bool bw bh bool
+ {pop pop false} % We already requested this media size, so don't re-request
+ {true} ifelse % Media request different to last request
+ } {
+ true % No stored media request, so apply setpagedevice
+ } ifelse
+ {
+ 2 array astore % bw bh px0 py0 bw bh bool []
+ dup /MediaRequested exch def
+ << exch /PageSize exch >> setpagedevice % bw bh px0 py0 bw bh bool
+ /pagesave save def
+ } if
} ifelse
userdict /PDFR_InitialGS gstate put
setglobal % bw bh px0 py0 bw bh

View File

@ -5,7 +5,7 @@ Summary: A PostScript interpreter and renderer
Name: ghostscript
Version: %{gs_ver}
Release: 5%{?dist}
Release: 6%{?dist}
# Included CMap data is Redistributable, no modification permitted,
# see http://bugzilla.redhat.com/487510
@ -32,6 +32,7 @@ Patch8: ghostscript-gdevcups-debug-uninit.patch
Patch9: ghostscript-wrf-snprintf.patch
Patch10: ghostscript-gs694154.patch
Patch11: ghostscript-gs694809.patch
Patch12: ghostscript-duplex.patch
Requires: urw-fonts >= 1.1, ghostscript-fonts
Requires: poppler-data
@ -138,6 +139,9 @@ rm -rf expat freetype icclib jasper jpeg jpegxr lcms lcms2 libpng openjpeg zlib
# Use upstream patch to fix gs segfault (bug #1039718).
%patch11 -p1 -b .gs694809
# Use upstream patch to fix duplex for some devices (bug #1068896).
%patch12 -p1 -b .duplex
# Convert manual pages to UTF-8
from8859_1() {
iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_"
@ -328,6 +332,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libgs.so
%changelog
* Thu Feb 27 2014 Tim Waugh <twaugh@redhat.com> 9.10-6
- Use upstream patch to fix duplex for some devices (bug #1068896).
* Tue Dec 10 2013 Tim Waugh <twaugh@redhat.com> 9.10-5
- Use upstream patches to fix gs segfaults (bug #1026428, bug #1039718).