- Fixed orientation of page labels when printing text in landscape mode

(bug #520141, STR #3334).
This commit is contained in:
Tim Waugh 2009-10-02 12:03:19 +00:00
parent 0b04325081
commit 4a94f7b1ab
2 changed files with 99 additions and 1 deletions

92
cups-page-label.patch Normal file
View File

@ -0,0 +1,92 @@
diff -up cups-1.4.1/filter/pstops.c.page-label cups-1.4.1/filter/pstops.c
--- cups-1.4.1/filter/pstops.c.page-label 2009-10-02 12:33:33.410719651 +0100
+++ cups-1.4.1/filter/pstops.c 2009-10-02 12:34:11.399594180 +0100
@@ -108,6 +108,7 @@ typedef struct /**** Document informa
int num_options; /* Number of document-wide options */
cups_option_t *options; /* Document-wide options */
int normal_landscape, /* Normal rotation for landscape? */
+ orientation, /* Original orientation of the document */
saw_eof, /* Saw the %%EOF comment? */
slow_collate, /* Collate copies by hand? */
slow_duplex, /* Duplex pages slowly? */
@@ -2048,7 +2049,7 @@ do_setup(pstops_doc_t *doc, /* I - Docu
* of the pages...
*/
- if (Orientation & 1)
+ if (doc->orientation & 1)
write_label_prolog(doc, doc->page_label, PageBottom,
PageWidth - PageLength + PageTop, PageLength);
else
@@ -2056,7 +2057,30 @@ do_setup(pstops_doc_t *doc, /* I - Docu
PageLength);
}
else
- write_label_prolog(doc, doc->page_label, PageBottom, PageTop, PageWidth);
+ {
+ switch (doc->orientation)
+ {
+ case 0 :
+ write_label_prolog(doc, doc->page_label, PageBottom, PageTop,
+ PageWidth);
+ break;
+
+ case 1 :
+ write_label_prolog(doc, doc->page_label, PageLeft, PageRight,
+ PageLength);
+ break;
+
+ case 2 :
+ write_label_prolog(doc, doc->page_label, PageLength - PageTop,
+ PageLength - PageBottom, PageWidth);
+ break;
+
+ case 3 :
+ write_label_prolog(doc, doc->page_label, PageWidth - PageRight,
+ PageWidth - PageLeft, PageLength);
+ break;
+ }
+ }
}
@@ -2141,7 +2165,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
case 1 :
if (doc->use_ESPshowpage)
{
- write_labels(doc, Orientation);
+ write_labels(doc, doc->orientation);
doc_puts(doc, "ESPshowpage\n");
}
break;
@@ -2156,7 +2180,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
* Rotate the labels back to portrait...
*/
- write_labels(doc, Orientation - 1);
+ write_labels(doc, doc->orientation - 1);
}
else if (Orientation == 0)
{
@@ -2182,7 +2206,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
default :
if (is_last_page(number) && doc->use_ESPshowpage)
{
- write_labels(doc, Orientation);
+ write_labels(doc, doc->orientation);
doc_puts(doc, "ESPshowpage\n");
}
break;
@@ -2385,6 +2409,12 @@ set_pstops_options(
doc->new_bounding_box[3] = INT_MIN;
/*
+ * Save original orientation of the document
+ */
+
+ doc->orientation = Orientation;
+
+ /*
* AP_FIRSTPAGE_InputSlot
*/

View File

@ -9,7 +9,7 @@
Summary: Common Unix Printing System
Name: cups
Version: 1.4.1
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source: http://ftp.easysw.com/pub/cups/1.4.0/cups-%{version}-source.tar.bz2
@ -39,6 +39,7 @@ Patch11: cups-direct-usb.patch
Patch12: cups-lpr-help.patch
Patch13: cups-peercred.patch
Patch14: cups-pid.patch
Patch15: cups-page-label.patch
Patch16: cups-eggcups.patch
Patch17: cups-getpass.patch
Patch18: cups-driverd-timeout.patch
@ -193,6 +194,7 @@ module.
%patch12 -p1 -b .lpr-help
%patch13 -p1 -b .peercred
%patch14 -p1 -b .pid
%patch15 -p1 -b .page-label
%patch16 -p1 -b .eggcups
%patch17 -p1 -b .getpass
%patch18 -p1 -b .driverd-timeout
@ -507,6 +509,10 @@ rm -rf $RPM_BUILD_ROOT
%{php_extdir}/phpcups.so
%changelog
* Fri Oct 2 2009 Tim Waugh <twaugh@redhat.com> 1:1.4.1-7
- Fixed orientation of page labels when printing text in landscape
mode (bug #520141, STR #3334).
* Wed Sep 30 2009 Tim Waugh <twaugh@redhat.com> 1:1.4.1-6
- Don't use cached PPD for raw queue (bug #526405, STR #3356).