- use dist tag.
- paps-cups.patch: applied to work paps as CUPS filter. - paps-0.6.6-encoding.patch: null-terminates the output.
This commit is contained in:
parent
eda028a6cd
commit
259f8a876f
@ -1 +1,4 @@
|
|||||||
|
*rpm
|
||||||
|
*gz
|
||||||
|
*bz2
|
||||||
paps-0.6.6.tar.gz
|
paps-0.6.6.tar.gz
|
||||||
|
@ -80,7 +80,7 @@ diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
|
|||||||
if (ferror (file))
|
if (ferror (file))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Error reading file.\n", g_get_prgname ());
|
fprintf(stderr, "%s: Error reading file.\n", g_get_prgname ());
|
||||||
@@ -392,7 +412,19 @@
|
@@ -392,7 +412,20 @@
|
||||||
else if (bp == NULL)
|
else if (bp == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -96,6 +96,7 @@ diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
|
|||||||
+ fprintf (stderr, "%s: Error while converting strings.\n", g_get_prgname ());
|
+ fprintf (stderr, "%s: Error while converting strings.\n", g_get_prgname ());
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+ }
|
+ }
|
||||||
|
+ obuffer[BUFSIZE * 6 - 1 - oblen] = 0;
|
||||||
+ }
|
+ }
|
||||||
+ g_string_append (inbuf, bp);
|
+ g_string_append (inbuf, bp);
|
||||||
}
|
}
|
||||||
|
220
paps-cups.patch
Normal file
220
paps-cups.patch
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
diff -ruN paps-0.6.6.orig/configure.in paps-0.6.6/configure.in
|
||||||
|
--- paps-0.6.6.orig/configure.in 2006-04-28 04:41:36.000000000 +0900
|
||||||
|
+++ paps-0.6.6/configure.in 2006-06-29 17:45:59.000000000 +0900
|
||||||
|
@@ -7,4 +7,17 @@
|
||||||
|
AC_PROG_CC
|
||||||
|
AM_PROG_LIBTOOL
|
||||||
|
|
||||||
|
+dnl ======================================================
|
||||||
|
+dnl check for CUPS
|
||||||
|
+dnl ======================================================
|
||||||
|
+AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
|
||||||
|
+if test "$CUPS_CONFIG" = "no"; then
|
||||||
|
+ AC_MSG_ERROR([Please install cups development packages])
|
||||||
|
+fi
|
||||||
|
+CUPS_CFLAGS=`$CUPS_CONFIG --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'`
|
||||||
|
+CUPS_LIBS=`$CUPS_CONFIG --libs`
|
||||||
|
+
|
||||||
|
+AC_SUBST(CUPS_CFLAGS)
|
||||||
|
+AC_SUBST(CUPS_LIBS)
|
||||||
|
+
|
||||||
|
AC_OUTPUT(Makefile src/Makefile doc/Makefile)
|
||||||
|
diff -ruN paps-0.6.6.orig/src/Makefile.am paps-0.6.6/src/Makefile.am
|
||||||
|
--- paps-0.6.6.orig/src/Makefile.am 2006-06-20 20:40:11.000000000 +0900
|
||||||
|
+++ paps-0.6.6/src/Makefile.am 2006-06-29 19:09:12.000000000 +0900
|
||||||
|
@@ -5,10 +5,10 @@
|
||||||
|
libpaps_a_incdir = $(includedir)
|
||||||
|
|
||||||
|
bin_PROGRAMS = paps
|
||||||
|
-paps_CFLAGS = -Wall
|
||||||
|
+paps_CFLAGS = -Wall $(CUPS_CFLAGS)
|
||||||
|
paps_SOURCES = paps.c
|
||||||
|
paps_LDADD = $(noinst_LIBRARIES) $(all_libraries)
|
||||||
|
-paps_LDFLAGS = `pkg-config --libs pangoft2`
|
||||||
|
+paps_LDFLAGS = `pkg-config --libs pangoft2` $(CUPS_LIBS)
|
||||||
|
paps_DEPENDENCIES = $(noinst_LIBRARIES)
|
||||||
|
|
||||||
|
EXTRA_DIST = test_libpaps.c paps.1
|
||||||
|
diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
|
||||||
|
--- paps-0.6.6.orig/src/paps.c 2006-06-20 20:40:11.000000000 +0900
|
||||||
|
+++ paps-0.6.6/src/paps.c 2006-06-29 19:06:46.000000000 +0900
|
||||||
|
@@ -29,6 +29,7 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <locale.h>
|
||||||
|
+#include <cups/cups.h>
|
||||||
|
|
||||||
|
#define BUFSIZE 1024
|
||||||
|
#define DEFAULT_FONT_FAMILY "Monospace"
|
||||||
|
@@ -79,6 +80,7 @@
|
||||||
|
gboolean do_justify;
|
||||||
|
gboolean do_separation_line;
|
||||||
|
gboolean do_draw_contour;
|
||||||
|
+ gboolean do_wordwrap;
|
||||||
|
PangoDirection pango_dir;
|
||||||
|
gchar *filename;
|
||||||
|
gchar *header_font_desc;
|
||||||
|
@@ -244,8 +246,8 @@
|
||||||
|
int num_pages = 1;
|
||||||
|
int gutter_width = 40;
|
||||||
|
int total_gutter_width;
|
||||||
|
- int page_width = paper_sizes[0].width;
|
||||||
|
- int page_height = paper_sizes[0].height;
|
||||||
|
+ int page_width = -1;
|
||||||
|
+ int page_height = -1;
|
||||||
|
int do_tumble = -1; /* -1 means not initialized */
|
||||||
|
int do_duplex = -1;
|
||||||
|
gchar *paps_header = NULL;
|
||||||
|
@@ -253,12 +255,112 @@
|
||||||
|
gchar *filename_in, *title, *text;
|
||||||
|
int header_sep = 20;
|
||||||
|
GIConv cvh = NULL;
|
||||||
|
+ gboolean cups_mode = FALSE, do_wordwrap = TRUE;
|
||||||
|
|
||||||
|
/* Prerequisite when using glib. */
|
||||||
|
g_type_init();
|
||||||
|
|
||||||
|
g_option_context_add_main_entries(ctxt, entries, NULL);
|
||||||
|
|
||||||
|
+ /* check if the process is being invoked as CUPS filter */
|
||||||
|
+ G_STMT_START {
|
||||||
|
+ gchar *prgname = g_path_get_basename(argv[0]);
|
||||||
|
+ cups_option_t *options = NULL;
|
||||||
|
+ ppd_file_t *ppd;
|
||||||
|
+ ppd_size_t *pagesize;
|
||||||
|
+ int num_options;
|
||||||
|
+ const char *val;
|
||||||
|
+
|
||||||
|
+ if (strncmp(prgname, "texttopaps", 10) == 0) {
|
||||||
|
+ /* argument format should be job-id user title copies options [file] */
|
||||||
|
+ cups_mode = TRUE;
|
||||||
|
+ if (argc < 6 || argc > 7) {
|
||||||
|
+ fprintf(stderr, "ERROR: %s job-id user title copies options [file]\n", prgname);
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ if (argc == 6) {
|
||||||
|
+ filename_in = "stdin";
|
||||||
|
+ IN = stdin;
|
||||||
|
+ } else {
|
||||||
|
+ filename_in = argv[6];
|
||||||
|
+ if ((IN = fopen(argv[6], "rb")) == NULL) {
|
||||||
|
+ fprintf(stderr, "ERROR: unable to open print file -\n");
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ title = argv[3];
|
||||||
|
+ num_options = cupsParseOptions(argv[5], 0, &options);
|
||||||
|
+
|
||||||
|
+ if ((val = cupsGetOption("prettyprint", num_options, options)) != NULL &&
|
||||||
|
+ g_ascii_strcasecmp(val, "no") &&
|
||||||
|
+ g_ascii_strcasecmp(val, "off") &&
|
||||||
|
+ g_ascii_strcasecmp(val, "false")) {
|
||||||
|
+ /* XXX: need to support the keywords highlighting */
|
||||||
|
+ }
|
||||||
|
+ ppd = ppdOpenFile(getenv("PPD"));
|
||||||
|
+ ppdMarkDefaults(ppd);
|
||||||
|
+ cupsMarkOptions(ppd, num_options, options);
|
||||||
|
+
|
||||||
|
+ if ((pagesize = ppdPageSize(ppd, NULL)) != NULL) {
|
||||||
|
+ page_width = pagesize->width;
|
||||||
|
+ page_height = pagesize->length;
|
||||||
|
+ top_margin = pagesize->length - pagesize->top;
|
||||||
|
+ bottom_margin = pagesize->bottom;
|
||||||
|
+ left_margin = pagesize->left;
|
||||||
|
+ right_margin = pagesize->width - pagesize->right;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((val = cupsGetOption("landscape", num_options, options)) != NULL) {
|
||||||
|
+ if (g_ascii_strcasecmp(val, "no") != 0 &&
|
||||||
|
+ g_ascii_strcasecmp(val, "off") != 0 &&
|
||||||
|
+ g_ascii_strcasecmp(val, "false") != 0) {
|
||||||
|
+ /* XXX: need to support other orientations? */
|
||||||
|
+ do_landscape = TRUE;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ /* XXX: need to support orientation-requested? */
|
||||||
|
+ if ((val = cupsGetOption("page-left", num_options, options)) != NULL) {
|
||||||
|
+ left_margin = (int)atof(val);
|
||||||
|
+ }
|
||||||
|
+ if ((val = cupsGetOption("page-right", num_options, options)) != NULL) {
|
||||||
|
+ right_margin = (int)atof(val);
|
||||||
|
+ }
|
||||||
|
+ if ((val = cupsGetOption("page-bottom", num_options, options)) != NULL) {
|
||||||
|
+ bottom_margin = (int)atof(val);
|
||||||
|
+ }
|
||||||
|
+ if ((val = cupsGetOption("page-top", num_options, options)) != NULL) {
|
||||||
|
+ top_margin = (int)atof(val);
|
||||||
|
+ }
|
||||||
|
+ if (ppdIsMarked(ppd, "Duplex", "DuplexNoTumble") ||
|
||||||
|
+ ppdIsMarked(ppd, "Duplex", "DuplexTumble") ||
|
||||||
|
+ ppdIsMarked(ppd, "JCLDuplex", "DuplexNoTumble") ||
|
||||||
|
+ ppdIsMarked(ppd, "JCLDuplex", "DuplexTumble") ||
|
||||||
|
+ ppdIsMarked(ppd, "EFDuplex", "DuplexNoTumble") ||
|
||||||
|
+ ppdIsMarked(ppd, "EFDuplex", "DuplexTumble") ||
|
||||||
|
+ ppdIsMarked(ppd, "KD03Duplex", "DuplexNoTumble") ||
|
||||||
|
+ ppdIsMarked(ppd, "KD03Duplex", "DuplexTumble"))
|
||||||
|
+ do_duplex = TRUE;
|
||||||
|
+ if ((val = cupsGetOption("wrap", num_options, options)) != NULL) {
|
||||||
|
+ do_wordwrap = !g_ascii_strcasecmp(val, "true") ||
|
||||||
|
+ !g_ascii_strcasecmp(val, "on") ||
|
||||||
|
+ !g_ascii_strcasecmp(val, "yes");
|
||||||
|
+ }
|
||||||
|
+ if ((val = cupsGetOption("columns", num_options, options)) != NULL) {
|
||||||
|
+ num_columns = atoi(val);
|
||||||
|
+ }
|
||||||
|
+ if ((val = cupsGetOption("cpi", num_options, options)) != NULL) {
|
||||||
|
+ /* XXX */
|
||||||
|
+ }
|
||||||
|
+ if ((val = cupsGetOption("lpi", num_options, options)) != NULL) {
|
||||||
|
+ /* XXX */
|
||||||
|
+ }
|
||||||
|
+ if (getenv("CHARSET") != NULL)
|
||||||
|
+ encoding = getenv("CHARSET");
|
||||||
|
+ }
|
||||||
|
+ } G_STMT_END;
|
||||||
|
+
|
||||||
|
+ if (!cups_mode) {
|
||||||
|
+
|
||||||
|
/* Parse command line */
|
||||||
|
if (!g_option_context_parse(ctxt, &argc, &argv, &error))
|
||||||
|
{
|
||||||
|
@@ -285,6 +387,8 @@
|
||||||
|
IN = stdin;
|
||||||
|
}
|
||||||
|
title = filename_in;
|
||||||
|
+
|
||||||
|
+ } /* if (!cups_mode) */
|
||||||
|
|
||||||
|
paps = paps_new();
|
||||||
|
pango_context = paps_get_pango_context (paps);
|
||||||
|
@@ -303,8 +407,10 @@
|
||||||
|
pango_context_set_font_description (pango_context, font_description);
|
||||||
|
|
||||||
|
/* Page layout */
|
||||||
|
- page_width = paper_sizes[(int)paper_type].width;
|
||||||
|
- page_height = paper_sizes[(int)paper_type].height;
|
||||||
|
+ if (page_width < 0)
|
||||||
|
+ page_width = paper_sizes[(int)paper_type].width;
|
||||||
|
+ if (page_height < 0)
|
||||||
|
+ page_height = paper_sizes[(int)paper_type].height;
|
||||||
|
|
||||||
|
if (num_columns == 1)
|
||||||
|
total_gutter_width = 0;
|
||||||
|
@@ -340,6 +446,7 @@
|
||||||
|
page_layout.header_ypos = page_layout.top_margin;
|
||||||
|
page_layout.header_height = 0;
|
||||||
|
page_layout.footer_height = 0;
|
||||||
|
+ page_layout.do_wordwrap = do_wordwrap;
|
||||||
|
if (do_draw_header)
|
||||||
|
page_layout.header_sep = header_sep;
|
||||||
|
else
|
||||||
|
@@ -495,7 +602,8 @@
|
||||||
|
page_layout->pango_dir == PANGO_DIRECTION_LTR
|
||||||
|
? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
|
||||||
|
pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
|
||||||
|
- pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
+ if (page_layout->do_wordwrap)
|
||||||
|
+ pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
para->height = 0;
|
||||||
|
|
||||||
|
if (wc == '\f')
|
14
paps.spec
14
paps.spec
@ -1,6 +1,6 @@
|
|||||||
Name: paps
|
Name: paps
|
||||||
Version: 0.6.6
|
Version: 0.6.6
|
||||||
Release: 7.fc6
|
Release: 8%{?dist}
|
||||||
|
|
||||||
License: LGPL
|
License: LGPL
|
||||||
URL: http://paps.sourceforge.net/
|
URL: http://paps.sourceforge.net/
|
||||||
@ -22,6 +22,7 @@ Patch6: paps-0.6.6-font-option.patch
|
|||||||
Patch7: paps-0.6.6-lcctype.patch
|
Patch7: paps-0.6.6-lcctype.patch
|
||||||
## http://sourceforge.net/tracker/index.php?func=detail&aid=1512385&group_id=153049&atid=786239
|
## http://sourceforge.net/tracker/index.php?func=detail&aid=1512385&group_id=153049&atid=786239
|
||||||
Patch8: paps-0.6.6-wordwrap.patch
|
Patch8: paps-0.6.6-wordwrap.patch
|
||||||
|
Patch50: paps-cups.patch
|
||||||
|
|
||||||
Summary: Plain Text to PostScript converter
|
Summary: Plain Text to PostScript converter
|
||||||
Group: Applications/Publishing
|
Group: Applications/Publishing
|
||||||
@ -39,6 +40,7 @@ paps is a PostScript converter from plain text file using Pango.
|
|||||||
%patch6 -p1 -b .fontopt
|
%patch6 -p1 -b .fontopt
|
||||||
%patch7 -p1 -b .lcctype
|
%patch7 -p1 -b .lcctype
|
||||||
%patch8 -p1 -b .wordwrap
|
%patch8 -p1 -b .wordwrap
|
||||||
|
%patch50 -p1 -b .cups
|
||||||
aclocal
|
aclocal
|
||||||
automake
|
automake
|
||||||
autoconf
|
autoconf
|
||||||
@ -55,6 +57,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
make install DESTDIR=$RPM_BUILD_ROOT
|
make install DESTDIR=$RPM_BUILD_ROOT
|
||||||
rm -rf $RPM_BUILD_ROOT%{_includedir}
|
rm -rf $RPM_BUILD_ROOT%{_includedir}
|
||||||
|
|
||||||
|
# make a symlink for CUPS filter
|
||||||
|
%{__mkdir_p} $RPM_BUILD_ROOT%{_libdir}/cups/filter
|
||||||
|
ln -s %{_bindir}/paps $RPM_BUILD_ROOT%{_libdir}/cups/filter/texttopaps
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
@ -63,9 +69,15 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%doc AUTHORS COPYING.LIB README TODO
|
%doc AUTHORS COPYING.LIB README TODO
|
||||||
%{_bindir}/paps
|
%{_bindir}/paps
|
||||||
%{_mandir}/man1/paps.1*
|
%{_mandir}/man1/paps.1*
|
||||||
|
%{_libdir}/cups/filter/texttopaps
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jun 29 2006 Akira TAGOH <tagoh@redhat.com> - 0.6.6-8
|
||||||
|
- use dist tag.
|
||||||
|
- paps-cups.patch: applied to work paps as CUPS filter.
|
||||||
|
- paps-0.6.6-encoding.patch: null-terminates the output.
|
||||||
|
|
||||||
* Tue Jun 27 2006 Akira TAGOH <tagoh@redhat.com> - 0.6.6-7
|
* Tue Jun 27 2006 Akira TAGOH <tagoh@redhat.com> - 0.6.6-7
|
||||||
- rebuilt to import into Core.
|
- rebuilt to import into Core.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user