- paps-cups.patch: Fix printing with -o landscape in CUPS. (#222137)

This commit is contained in:
Akira TAGOH 2008-05-16 02:43:31 +00:00
parent 391cd9529f
commit b4b5931a22
3 changed files with 58 additions and 52 deletions

View File

@ -1,6 +1,6 @@
diff -pruN paps-0.6.8.orig/configure.in paps-0.6.8/configure.in
--- paps-0.6.8.orig/configure.in 2007-01-19 20:06:10.000000000 +0900
+++ paps-0.6.8/configure.in 2007-11-30 18:40:32.000000000 +0900
+++ paps-0.6.8/configure.in 2008-05-15 22:46:49.000000000 +0900
@@ -7,6 +7,19 @@ AC_LANG_C
AC_PROG_CC
AM_PROG_LIBTOOL
@ -22,8 +22,8 @@ diff -pruN paps-0.6.8.orig/configure.in paps-0.6.8/configure.in
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
diff -pruN paps-0.6.8.orig/src/Makefile.am paps-0.6.8/src/Makefile.am
--- paps-0.6.8.orig/src/Makefile.am 2007-11-30 18:40:15.000000000 +0900
+++ paps-0.6.8/src/Makefile.am 2007-11-30 18:40:32.000000000 +0900
--- paps-0.6.8.orig/src/Makefile.am 2008-05-15 22:46:34.000000000 +0900
+++ paps-0.6.8/src/Makefile.am 2008-05-15 22:46:49.000000000 +0900
@@ -5,10 +5,10 @@ libpapsinc_HEADERS = libpaps.h
libpapsincdir = $(includedir)
@ -38,8 +38,8 @@ diff -pruN paps-0.6.8.orig/src/Makefile.am paps-0.6.8/src/Makefile.am
EXTRA_DIST = test_libpaps.c paps.1
diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
--- paps-0.6.8.orig/src/paps.c 2007-11-30 18:40:15.000000000 +0900
+++ paps-0.6.8/src/paps.c 2007-11-30 18:47:28.000000000 +0900
--- paps-0.6.8.orig/src/paps.c 2008-05-15 22:46:34.000000000 +0900
+++ paps-0.6.8/src/paps.c 2008-05-15 22:48:42.000000000 +0900
@@ -31,6 +31,7 @@
#include <string.h>
#include <time.h>
@ -80,7 +80,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
/* Set locale from environment. */
setlocale(LC_ALL, "");
@@ -348,6 +353,134 @@ int main(int argc, char *argv[])
@@ -348,6 +353,128 @@ int main(int argc, char *argv[])
g_option_context_add_main_entries(ctxt, entries, NULL);
#endif
@ -148,15 +148,9 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
+ if ((val = cupsGetOption("landscape", num_options, options)) != NULL) {
+ if (g_ascii_strcasecmp(val, "no") &&
+ g_ascii_strcasecmp(val, "off") &&
+ g_ascii_strcasecmp(val, "false")) {
+ /* We really need to deal with the landscape orientation because
+ * pstops doesn't deal with the position where it should appears.
+ * However this causes the unnecessary rotation by pstops. so paps
+ * will puts the fake Orientation tag and stop rotating in PS.
+ */
+ g_ascii_strcasecmp(val, "false"))
+ do_landscape = TRUE;
+ }
+ }
+ /* XXX: need to support orientation-requested? */
+ if ((val = cupsGetOption("page-left", num_options, options)) != NULL) {
+ left_margin = (int)atof(val);
@ -215,7 +209,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
/* Parse command line */
if (!g_option_context_parse(ctxt, &argc, &argv, &error))
{
@@ -374,6 +507,8 @@ int main(int argc, char *argv[])
@@ -374,6 +501,8 @@ int main(int argc, char *argv[])
IN = stdin;
}
title = filename_in;
@ -224,7 +218,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
paps = paps_new();
pango_context = paps_get_pango_context (paps);
@@ -392,8 +527,10 @@ int main(int argc, char *argv[])
@@ -392,8 +521,10 @@ int main(int argc, char *argv[])
pango_context_set_font_description (pango_context, font_description);
/* Page layout */
@ -237,7 +231,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
if (num_columns == 1)
total_gutter_width = 0;
@@ -456,6 +593,8 @@ int main(int argc, char *argv[])
@@ -456,6 +587,8 @@ int main(int argc, char *argv[])
page_layout.pango_dir = pango_dir;
page_layout.filename = filename_in;
page_layout.header_font_desc = header_font_desc;
@ -246,7 +240,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
/* calculate x-coordinate scale */
if (page_layout.cpi > 0.0L)
@@ -756,6 +895,12 @@ split_text_into_paragraphs (PangoContext
@@ -756,6 +889,12 @@ split_text_into_paragraphs (PangoContext
if (wc == (gunichar)-1)
{
fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
@ -259,15 +253,19 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
wc = 0;
}
if (!*p || !wc || wc == '\n' || wc == '\f')
@@ -925,6 +1070,7 @@ void print_postscript_header(FILE *OUT,
@@ -925,21 +1064,32 @@ void print_postscript_header(FILE *OUT,
int orientation = page_layout->page_width > page_layout->page_height;
int bb_page_width = page_layout->page_width;
int bb_page_height = page_layout->page_height;
+ char *owner = NULL;
/* Keep bounding box non-rotated to make ggv happy */
if (orientation)
@@ -934,12 +1080,20 @@ void print_postscript_header(FILE *OUT,
- if (orientation)
+ /* ensure the correct bounding box for CUPS */
+ if (orientation && !page_layout->cups_mode)
{
int tmp = bb_page_width;
bb_page_width = bb_page_height;
bb_page_height = tmp;
}
@ -281,6 +279,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
+ }
fprintf(OUT,
"%%!PS-Adobe-3.0\n"
+ "%s"
"%%%%Title: %s\n"
"%%%%Creator: paps version 0.6.7 by Dov Grobgeld\n"
"%%%%Pages: (atend)\n"
@ -289,31 +288,35 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
"%%%%BeginProlog\n"
"%%%%Orientation: %s\n"
"/papsdict 1 dict def\n"
@@ -989,8 +1143,13 @@ void print_postscript_header(FILE *OUT,
@@ -961,7 +1111,7 @@ void print_postscript_header(FILE *OUT,
" pagewidth\n"
" /pagewidth pageheight def\n"
" /pageheight exch def\n"
- " /orientation 3 def\n"
+ " /orientation %d def\n"
" } if\n"
" 2 dict\n"
" dup /PageSize [pagewidth pageheight] put\n"
@@ -986,11 +1136,21 @@ void print_postscript_header(FILE *OUT,
" 90 rotate\n"
" 0 pageheight neg translate\n"
"} def\n",
+ /*
+ * Put %%cupsRotation tag to prevent the rotation in pstops.
+ * This breaks paps's behavior to make it in landscape say.
+ * (RH#222137)
+ */
+ (page_layout->cups_mode ? "%cupsRotation: 0\n" : ""),
title,
bb_page_width,
bb_page_height,
- orientation_names[orientation]
+ owner,
+ /* Put the fake orientation tag if paps is currently running under
+ * the CUPS filter mode. (#222137)
+ */
+ orientation_names[orientation && !page_layout->cups_mode]
+ orientation_names[orientation],
+ /* For landscape, rotate page to portrait orientation for CUPS (RH#222137) */
+ page_layout->cups_mode ? 2 : 3
);
+ g_free(owner);
fprintf(OUT,
"%% User settings\n"
@@ -1015,7 +1174,11 @@ void print_postscript_header(FILE *OUT,
page_layout->left_margin,
page_layout->page_height - bodytop,
bool_name[page_layout->do_separation_line>0],
- bool_name[page_layout->do_landscape>0],
+ /* just ignore the landscape flag when paps is currently running
+ * under the CUPS filter mode. this will stop rotating in PS that
+ * paps generates. (#222137)
+ */
+ bool_name[page_layout->do_landscape>0 && !page_layout->cups_mode],
bool_name[page_layout->do_tumble>0],
bool_name[page_layout->do_duplex>0]
);

View File

@ -1,6 +1,6 @@
diff -pruN paps-0.6.8.orig/src/libpaps.c paps-0.6.8/src/libpaps.c
--- paps-0.6.8.orig/src/libpaps.c 2008-01-15 11:09:30.000000000 +0900
+++ paps-0.6.8/src/libpaps.c 2008-01-15 11:10:10.000000000 +0900
--- paps-0.6.8.orig/src/libpaps.c 2008-05-14 23:07:14.000000000 +0900
+++ paps-0.6.8/src/libpaps.c 2008-05-14 23:11:12.000000000 +0900
@@ -118,7 +118,6 @@ gchar *paps_get_postscript_header_strdup
gchar *ret_str;
g_string_append_printf(paps->header,
@ -42,9 +42,9 @@ diff -pruN paps-0.6.8.orig/src/libpaps.c paps-0.6.8/src/libpaps.c
}
diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
--- paps-0.6.8.orig/src/paps.c 2008-01-15 11:09:30.000000000 +0900
+++ paps-0.6.8/src/paps.c 2008-01-15 11:10:46.000000000 +0900
@@ -665,7 +665,7 @@ int main(int argc, char *argv[])
--- paps-0.6.8.orig/src/paps.c 2008-05-14 23:07:14.000000000 +0900
+++ paps-0.6.8/src/paps.c 2008-05-14 23:12:53.000000000 +0900
@@ -659,7 +659,7 @@ int main(int argc, char *argv[])
fprintf(OUT, "%s", paps_header);
g_free(paps_header);
@ -53,7 +53,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
fprintf(OUT, "%s", ps_pages_string->str);
print_postscript_trailer(OUT, num_pages);
@@ -1094,8 +1094,9 @@ void print_postscript_header(FILE *OUT,
@@ -1089,8 +1089,9 @@ void print_postscript_header(FILE *OUT,
"%%%%Creator: paps version 0.6.7 by Dov Grobgeld\n"
"%%%%Pages: (atend)\n"
"%%%%BoundingBox: 0 0 %d %d\n%s"
@ -64,17 +64,17 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
"/papsdict 1 dict def\n"
"papsdict begin\n"
"\n"
@@ -1139,7 +1140,8 @@ void print_postscript_header(FILE *OUT,
@@ -1134,7 +1135,8 @@ void print_postscript_header(FILE *OUT,
"/turnpage {\n"
" 90 rotate\n"
" 0 pageheight neg translate\n"
- "} def\n",
+ "} def\n"
+ "%%%%EndProlog\n",
title,
bb_page_width,
bb_page_height,
@@ -1152,6 +1154,7 @@ void print_postscript_header(FILE *OUT,
/*
* Put %%cupsRotation tag to prevent the rotation in pstops.
* This breaks paps's behavior to make it in landscape say.
@@ -1150,6 +1152,7 @@ void print_postscript_header(FILE *OUT,
g_free(owner);
fprintf(OUT,
@ -82,7 +82,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
"%% User settings\n"
"/pagewidth %d def\n"
"/pageheight %d def\n"
@@ -1238,8 +1241,8 @@ void print_postscript_trailer(FILE *OUT,
@@ -1232,8 +1235,8 @@ void print_postscript_trailer(FILE *OUT,
int num_pages)
{
fprintf(OUT,

View File

@ -1,6 +1,6 @@
Name: paps
Version: 0.6.8
Release: 5%{?dist}
Release: 6%{?dist}
License: LGPLv2+
URL: http://paps.sourceforge.net/
@ -19,7 +19,7 @@ Patch3: paps-0.6.6-lcnumeric.patch
Patch4: paps-0.6.6-exitcode.patch
Patch50: paps-cups.patch
Patch51: paps-cpilpi.patch
Patch52: paps-0.6.8-dsc-compliant.patch
Patch52: paps-dsc-compliant.patch
Patch61: paps-0.6.6-fix-wcswidth.patch
Summary: Plain Text to PostScript converter
@ -98,6 +98,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libpaps.so
%changelog
* Fri May 16 2008 Akira TAGOH <tagoh@redhat.com> - 0.6.8-6
- paps-cups.patch: Fix printing with -o landscape in CUPS. (#222137)
* Tue Feb 12 2008 Akira TAGOH <tagoh@redhat.com> - 0.6.8-5
- Rebuild for gcc-4.3.