- New upstream release.

- Remove patches merged and unnecessary anymore:
- paps-makefile.patch
- paps-formfeed.patch
- paps-0.6.6-encoding.patch
- paps-typo-font-scale.patch
- paps-0.6.6-segfault.patch
- paps-0.6.6-font-option.patch
- paps-0.6.6-lcctype.patch
- paps-0.6.8-shared.patch: Enable building shared library.
- paps-0.6.8-wordwrap.patch: Update a bit to get it working without an
    wordwrap mode.
- Add paps-libs and paps-devel package.
- paps-cups.patch: Update.
- paps-cpilpi.patch: Update.
- Fix the wrong rendering with CPI option. (#237202)
- Fix the unnecessary rotation with the landscape option when paps is
    running as CUPS filter. (#222137)
This commit is contained in:
Akira TAGOH 2007-11-30 11:29:46 +00:00
parent 48f32acf62
commit 1a8b5cd74a
14 changed files with 312 additions and 1216 deletions

View File

@ -1,644 +0,0 @@
diff -ruN paps-0.6.6.orig/src/libpaps.c paps-0.6.6/src/libpaps.c
--- paps-0.6.6.orig/src/libpaps.c 2006-04-27 04:09:03.000000000 +0900
+++ paps-0.6.6/src/libpaps.c 2006-07-17 13:33:13.000000000 +0900
@@ -52,16 +52,20 @@
int last_char_idx;
double last_pos_y;
double last_pos_x;
+ double scale_x;
+ double scale_y;
} paps_private_t;
// Forward declarations
-static void add_postscript_prologue(GString *ps_string);
+static void add_postscript_prologue(paps_private_t *paps);
static gchar *get_next_char_id_strdup(paps_private_t *paps);
static void add_line_to_postscript(paps_private_t *paps,
GString *line_str,
double x_pos,
double y_pos,
+ double scale_x,
+ double scale_y,
PangoLayoutLine *line);
paps_t *paps_new()
@@ -76,12 +80,27 @@
paps->last_pos_x = -1e67;
paps->last_pos_y = -1e67;
paps->last_char_idx = 0;
+ paps->scale_x = 1.0;
+ paps->scale_y = 1.0;
- add_postscript_prologue(paps->header);
+ add_postscript_prologue(paps);
return paps;
}
+void
+paps_set_scale(paps_t *paps_,
+ gdouble scale_x,
+ gdouble scale_y)
+{
+ paps_private_t *paps = (paps_private_t *)paps_;
+
+ paps->scale_x = scale_x;
+ paps->scale_y = scale_y;
+ g_string_erase(paps->header, 0, -1);
+ add_postscript_prologue(paps);
+}
+
PangoContext *paps_get_pango_context()
{
return pango_ft2_get_context (PAPS_DPI, PAPS_DPI);
@@ -124,14 +143,18 @@
GString *line_str,
PangoLayoutLine *pango_line,
double line_start_pos_x,
- double line_start_pos_y
+ double line_start_pos_y,
+ double scale_x,
+ double scale_y
);
void draw_bezier_outline(paps_private_t *paps,
GString *layout_str,
FT_Face face,
PangoGlyphInfo *glyph_info,
double pos_x,
- double pos_y
+ double pos_y,
+ double scale_x,
+ double scale_y
);
/* Countour traveling functions */
static int paps_ps_move_to( FT_Vector* to,
@@ -166,6 +189,8 @@
gchar *paps_layout_to_postscript_strdup(paps_t *paps_,
double pos_x,
double pos_y,
+ double scale_x,
+ double scale_y,
PangoLayout *layout)
{
paps_private_t *paps = (paps_private_t*)paps_;
@@ -189,6 +214,8 @@
layout_str,
pos_x,
pos_y,
+ scale_x,
+ scale_y,
pango_line);
pos_y -= logical_rect.height * scale;
@@ -203,6 +230,8 @@
gchar *paps_layout_line_to_postscript_strdup(paps_t *paps_,
double pos_x,
double pos_y,
+ double scale_x,
+ double scale_y,
PangoLayoutLine *layout_line)
{
paps_private_t *paps = (paps_private_t*)paps_;
@@ -213,6 +242,8 @@
layout_str,
pos_x,
pos_y,
+ scale_x,
+ scale_y,
layout_line);
ret_str = layout_str->str;
@@ -221,9 +252,10 @@
return ret_str;
}
-void add_postscript_prologue(GString *ps_string)
+static void
+add_postscript_prologue(paps_private_t *paps)
{
- g_string_append_printf(ps_string,
+ g_string_append_printf(paps->header,
"%%%%BeginProlog\n"
"/papsdict 1 dict def\n"
"papsdict begin\n"
@@ -231,7 +263,7 @@
);
/* Outline support */
- g_string_append_printf(ps_string,
+ g_string_append_printf(paps->header,
"/conicto {\n"
" /to_y exch def\n"
" /to_x exch def\n"
@@ -249,7 +281,7 @@
"/start_ol { gsave } bind def\n"
"/end_ol { closepath fill grestore } bind def\n"
/* Specify both x and y. */
- "/draw_char { fontdict begin gsave %f dup scale last_x last_y translate load exec end grestore} def\n"
+ "/draw_char { fontdict begin gsave %f dup scale last_x last_y translate %f %f scale load exec end grestore} def\n"
"/goto_xy { fontdict begin /last_y exch def /last_x exch def end } def\n"
"/goto_x { fontdict begin /last_x exch def end } def\n"
"/fwd_x { fontdict begin /last_x exch last_x add def end } def\n"
@@ -261,14 +293,15 @@
// The scaling is a combination of the scaling due
// to the dpi and the difference in the coordinate
// systems of postscript and freetype2.
- 1.0 / PAPS_DPI
+ 1.0 / PAPS_DPI,
+ paps->scale_x, paps->scale_y
);
// The following is a dispatcher for an encoded string that contains
// a packed version of the pango layout data. Currently it just executes
// the symbols corresponding to the encoded characters, but in the future
// it will also contain some meta data, e.g. the size of the layout.
- g_string_append_printf(ps_string,
+ g_string_append_printf(paps->header,
"/paps_exec {\n"
" 1 dict begin\n"
" /ps exch def\n"
@@ -320,7 +353,7 @@
);
/* Open up dictionaries */
- g_string_append(ps_string,
+ g_string_append(paps->header,
"/fontdict 1 dict def\n"
"papsdict begin fontdict begin\n");
}
@@ -331,6 +364,8 @@
GString *line_str,
double x_pos,
double y_pos,
+ double scale_x,
+ double scale_y,
PangoLayoutLine *line)
{
PangoRectangle ink_rect, logical_rect;
@@ -349,7 +384,7 @@
}
#endif
- draw_contour(paps, line_str, line, x_pos, y_pos);
+ draw_contour(paps, line_str, line, x_pos, y_pos, scale_x, scale_y);
}
/* draw_contour() draws all of the contours that make up a line.
@@ -359,7 +394,9 @@
GString *layout_str,
PangoLayoutLine *pango_line,
double line_start_pos_x,
- double line_start_pos_y
+ double line_start_pos_y,
+ double scale_x,
+ double scale_y
)
{
GSList *runs_list;
@@ -389,7 +426,7 @@
glyph_pos_x = x_pos + 1.0*geometry.x_offset * scale;
glyph_pos_y = line_start_pos_y - 1.0*geometry.y_offset * scale;
- x_pos += geometry.width * scale;
+ x_pos += geometry.width * scale * scale_x;
if (glyphs->glyphs[glyph_idx].glyph == PANGO_GLYPH_EMPTY)
continue;
@@ -399,7 +436,9 @@
ft_face,
&glyphs->glyphs[glyph_idx],
glyph_pos_x,
- glyph_pos_y
+ glyph_pos_y,
+ scale_x,
+ scale_y
);
}
@@ -415,13 +454,15 @@
FT_Face face,
PangoGlyphInfo *glyph_info,
double pos_x,
- double pos_y
+ double pos_y,
+ double scale_x,
+ double scale_y
)
{
static gchar glyph_hash_string[100];
double scale = 72.0 / PANGO_SCALE / PAPS_DPI;
double epsilon = 1e-2;
- double glyph_width = glyph_info->geometry.width * scale;
+ double glyph_width = glyph_info->geometry.width * scale * scale_x;
gchar *id = NULL;
/* Output outline */
@@ -480,7 +521,7 @@
g_string_append_printf(glyph_def_string,
"%.0f fwd_x\n"
"end_ol\n",
- glyph_info->geometry.width * scale * PAPS_DPI
+ glyph_info->geometry.width * scale * scale_x * PAPS_DPI
);
// TBD - Check if the glyph_def_string is empty. If so, set the
diff -ruN paps-0.6.6.orig/src/libpaps.h paps-0.6.6/src/libpaps.h
--- paps-0.6.6.orig/src/libpaps.h 2005-12-21 04:35:39.000000000 +0900
+++ paps-0.6.6/src/libpaps.h 2006-07-17 13:27:59.000000000 +0900
@@ -40,6 +40,19 @@
*/
void paps_free(paps_t *paps);
+/**
+ * Set the scales for characters.
+ *
+ * @param paps Paps object
+ * @param scale_x x-coordinate scale
+ * @param scale_y y-coordinate scale
+ *
+ */
+void
+paps_set_scale(paps_t *paps,
+ gdouble scale_x,
+ gdouble scale_y);
+
/**
* libpaps may currently be used only with a PangoContext that it
* is creating. The context returned may of course be changed though
@@ -78,6 +91,8 @@
gchar *paps_layout_to_postscript_strdup(paps_t *paps,
double pos_x,
double pos_y,
+ double scale_x,
+ double scale_y,
PangoLayout *layout);
/**
* Create postscript related to a single PangoLayout line at position
@@ -95,6 +110,8 @@
gchar *paps_layout_line_to_postscript_strdup(paps_t *paps_,
double pos_x,
double pos_y,
+ double scale_x,
+ double scale_y,
PangoLayoutLine *layout_line);
/**
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-07-17 13:27:27.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-07-17 13:27:59.000000000 +0900
@@ -22,6 +22,7 @@
#include <pango/pango.h>
+#include <pango/pangoft2.h>
#include "libpaps.h"
#include <errno.h>
#include <stdlib.h>
@@ -29,6 +30,7 @@
#include <string.h>
#include <time.h>
#include <locale.h>
+#include <wchar.h>
#define BUFSIZE 1024
#define DEFAULT_FONT_FAMILY "Monospace"
@@ -71,6 +73,8 @@
int header_sep;
int header_height;
int footer_height;
+ gdouble scale_x;
+ gdouble scale_y;
gboolean do_draw_header;
gboolean do_draw_footer;
gboolean do_duplex;
@@ -110,7 +114,8 @@
};
/* Information passed in user data when drawing outlines */
-GList *split_paragraphs_into_lines (GList *paragraphs);
+GList *split_paragraphs_into_lines (page_layout_t *page_layout,
+ GList *paragraphs);
static char *read_file (FILE *file,
GIConv handle);
static GList *split_text_into_paragraphs (PangoContext *pango_context,
@@ -136,6 +141,8 @@
static void draw_line_to_page (FILE *OUT,
int column_idx,
int column_pos,
+ gdouble scale_x,
+ gdouble scale_y,
page_layout_t *page_layout,
PangoLayoutLine *line);
static int draw_page_header_line_to_page(FILE *OUT,
@@ -158,6 +165,7 @@
double last_pos_x = -1;
paps_t *paps;
paper_type_t paper_type = PAPER_TYPE_A4;
+gdouble lpi = 0.0L, cpi = 0.0L;
#define CASE(s) if (strcmp(S_, s) == 0)
@@ -190,6 +198,60 @@
return retval;
}
+static gboolean
+_paps_arg_lpi_cb(const gchar *option_name,
+ const gchar *value,
+ gpointer data)
+{
+ gboolean retval = TRUE;
+ gchar *p = NULL;
+
+ if (value && *value)
+ {
+ errno = 0;
+ lpi = g_strtod(value, &p);
+ if ((p && *p) || errno == ERANGE)
+ {
+ fprintf(stderr, "given LPI value was invalid.\n");
+ retval = FALSE;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "You must specify the amount of lines per inch.\n");
+ retval = FALSE;
+ }
+
+ return retval;
+}
+
+static gboolean
+_paps_arg_cpi_cb(const gchar *option_name,
+ const gchar *value,
+ gpointer data)
+{
+ gboolean retval = TRUE;
+ gchar *p = NULL;
+
+ if (value && *value)
+ {
+ errno = 0;
+ cpi = g_strtod(value, &p);
+ if ((p && *p) || errno == ERANGE)
+ {
+ fprintf(stderr, "given CPI value was invalid.\n");
+ retval = FALSE;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "You must specify the amount of characters per inch.\n");
+ retval = FALSE;
+ }
+
+ return retval;
+}
+
static PangoLanguage *
get_language(void)
{
@@ -233,6 +295,8 @@
{"left-margin", 0, 0, G_OPTION_ARG_INT, &left_margin, "Set left margin. (Default: 36)", "NUM"},
{"header", 0, 0, G_OPTION_ARG_NONE, &do_draw_header, "Draw page header for each page.", NULL},
{"encoding", 0, 0, G_OPTION_ARG_STRING, &encoding, "Assume the documentation encoding.", "ENCODING"},
+ {"lpi", 0, 0, G_OPTION_ARG_CALLBACK, _paps_arg_lpi_cb, "Set the amount of lines per inch.", "REAL"},
+ {"cpi", 0, 0, G_OPTION_ARG_CALLBACK, _paps_arg_cpi_cb, "Set the amount of characters per inch.", "REAL"},
{NULL}
};
GError *error = NULL;
@@ -243,6 +307,9 @@
PangoContext *pango_context;
PangoFontDescription *font_description;
PangoDirection pango_dir = PANGO_DIRECTION_LTR;
+ PangoFontMap *fontmap;
+ PangoFontset *fontset;
+ PangoFontMetrics *metrics;
int num_pages = 1;
int gutter_width = 40;
int total_gutter_width;
@@ -254,6 +321,7 @@
gchar *header_font_desc = MAKE_FONT_NAME (HEADER_FONT_FAMILY, HEADER_FONT_SCALE);
gchar *filename_in, *title, *text;
int header_sep = 20;
+ int max_width = 0, w;
GIConv cvh = NULL;
/* Prerequisite when using glib. */
@@ -343,6 +411,8 @@
page_layout.header_height = 0;
page_layout.footer_height = 0;
page_layout.do_wordwrap = do_wordwrap;
+ page_layout.scale_x = 1.0L;
+ page_layout.scale_y = 1.0L;
if (do_draw_header)
page_layout.header_sep = header_sep;
else
@@ -365,7 +435,22 @@
page_layout.pango_dir = pango_dir;
page_layout.filename = filename_in;
page_layout.header_font_desc = header_font_desc;
-
+
+ /* calculate x-coordinate scale */
+ if (cpi > 0.0L)
+ {
+ fontmap = pango_ft2_font_map_new ();
+ fontset = pango_font_map_load_fontset (fontmap, pango_context, font_description, get_language ());
+ metrics = pango_fontset_get_metrics (fontset);
+ max_width = pango_font_metrics_get_approximate_char_width (metrics);
+ w = pango_font_metrics_get_approximate_digit_width (metrics);
+ if (w > max_width)
+ max_width = w;
+ page_layout.scale_x = 1 / cpi * 72.0 * PANGO_SCALE / max_width;
+ pango_font_metrics_unref (metrics);
+ g_object_unref (G_OBJECT (fontmap));
+ }
+
if (encoding != NULL)
{
cvh = g_iconv_open ("UTF-8", encoding);
@@ -385,11 +470,12 @@
&page_layout,
page_layout.column_width * page_layout.pt_to_pixel,
text);
- pango_lines = split_paragraphs_into_lines(paragraphs);
+ pango_lines = split_paragraphs_into_lines(&page_layout, paragraphs);
if (OUT == NULL)
OUT = stdout;
+ paps_set_scale(paps, page_layout.scale_x, page_layout.scale_y);
print_postscript_header(OUT, title, &page_layout);
ps_pages_string = g_string_new("");
@@ -493,6 +579,58 @@
para->text = last_para;
para->length = p - last_para;
para->layout = pango_layout_new (pango_context);
+
+ if (cpi > 0.0L && page_layout->do_wordwrap)
+ {
+ PangoRectangle ink_rect, logical_rect;
+ wchar_t *wtext, *wnewtext;
+ gchar *newtext;
+ size_t i, len, wwidth = 0, n;
+
+ wtext = (wchar_t *)g_utf8_to_ucs4 (para->text, para->length, NULL, NULL, NULL);
+ if (wtext == NULL)
+ {
+ fprintf (stderr, "Failed to convert UTF-8 to UCS-4.\n");
+ return NULL;
+ }
+
+ len = wcswidth (wtext);
+ /* the amount of characters to be able to put on the line against CPI */
+ n = page_layout->column_width / 72.0 * cpi;
+ if (len > n)
+ {
+ wnewtext = g_new (wchar_t, wcslen (wtext) + 1);
+ if (wnewtext == NULL)
+ {
+ fprintf (stderr, "Failed to allocate a memory.\n");
+ g_free (wtext);
+ return NULL;
+ }
+ for (i = 0; i < len; i++)
+ {
+ wwidth += wcwidth (wtext[i]);
+ if (wwidth > n)
+ break;
+ wnewtext[i] = wtext[i];
+ }
+ wnewtext[i] = 0L;
+
+ newtext = g_ucs4_to_utf8 ((const gunichar *)wnewtext, i, NULL, NULL, NULL);
+ if (newtext == NULL)
+ {
+ fprintf (stderr, "Failed to convert UCS-4 to UTF-8.\n");
+ return NULL;
+ }
+
+ pango_layout_set_text (para->layout, newtext, -1);
+ pango_layout_get_extents (para->layout, &ink_rect, &logical_rect);
+ /* update paint_width to wrap_against CPI */
+ paint_width = logical_rect.width / PANGO_SCALE;
+ g_free (newtext);
+ g_free (wnewtext);
+ }
+ g_free (wtext);
+ }
pango_layout_set_text (para->layout, para->text, para->length);
pango_layout_set_justify (para->layout, page_layout->do_justify);
pango_layout_set_alignment (para->layout,
@@ -523,9 +661,11 @@
/* Split a list of paragraphs into a list of lines.
*/
GList *
-split_paragraphs_into_lines(GList *paragraphs)
+split_paragraphs_into_lines(page_layout_t *page_layout,
+ GList *paragraphs)
{
GList *line_list = NULL;
+ int max_height = 0;
/* Read the file */
/* Now split all the pagraphs into lines */
@@ -554,10 +694,14 @@
line_link->formfeed = 1;
line_link->ink_rect = ink_rect;
line_list = g_list_prepend(line_list, line_link);
+ if (logical_rect.height > max_height)
+ max_height = logical_rect.height;
}
par_list = par_list->next;
}
+ if (lpi > 0.0L)
+ page_layout->scale_y = 1 / lpi * 72.0 * page_layout->pt_to_pixel * PANGO_SCALE / max_height;
return g_list_reverse(line_list);
@@ -612,9 +756,14 @@
draw_line_to_page(OUT,
column_idx,
column_y_pos+line_link->logical_rect.height,
+ page_layout->scale_x, page_layout->scale_y,
page_layout,
line);
- column_y_pos += line_link->logical_rect.height;
+
+ if (lpi > 0.0L)
+ column_y_pos += (1 / lpi * 72.0 * page_layout->pt_to_pixel * PANGO_SCALE);
+ else
+ column_y_pos += line_link->logical_rect.height;
pango_lines = pango_lines->next;
}
@@ -840,6 +989,8 @@
draw_line_to_page(FILE *OUT,
int column_idx,
int column_pos,
+ gdouble scale_x,
+ gdouble scale_y,
page_layout_t *page_layout,
PangoLayoutLine *line)
{
@@ -874,6 +1025,7 @@
ps_layout = paps_layout_line_to_postscript_strdup(paps,
x_pos, y_pos,
+ scale_x, scale_y,
line);
g_string_append(ps_pages_string,
@@ -935,6 +1087,7 @@
}
ps_layout = paps_layout_line_to_postscript_strdup(paps,
x_pos, y_pos,
+ page_layout->scale_x, page_layout->scale_y,
line);
g_string_append(ps_pages_string,
ps_layout);
@@ -948,6 +1101,7 @@
x_pos = (page_layout->page_width - (logical_rect.width / PANGO_SCALE * page_layout->pixel_to_pt)) / 2;
ps_layout = paps_layout_line_to_postscript_strdup(paps,
x_pos, y_pos,
+ page_layout->scale_x, page_layout->scale_y,
line);
g_string_append(ps_pages_string,
ps_layout);
@@ -961,6 +1115,7 @@
x_pos = page_layout->page_width - page_layout->right_margin - (logical_rect.width / PANGO_SCALE * page_layout->pixel_to_pt);
ps_layout = paps_layout_line_to_postscript_strdup(paps,
x_pos, y_pos,
+ page_layout->scale_x, page_layout->scale_y,
line);
g_string_append(ps_pages_string,
ps_layout);
@@ -977,4 +1132,3 @@
return logical_rect.height;
}
-
diff -ruN paps-0.6.6.orig/src/test_libpaps.c paps-0.6.6/src/test_libpaps.c
--- paps-0.6.6.orig/src/test_libpaps.c 2005-12-21 04:35:39.000000000 +0900
+++ paps-0.6.6/src/test_libpaps.c 2006-07-17 13:27:59.000000000 +0900
@@ -83,6 +83,7 @@
ps_layout = paps_layout_to_postscript_strdup(paps,
0, 0,
+ 1.0, 1.0,
layout);
g_string_append_printf(ps_text,
"gsave\n"
@@ -110,6 +111,7 @@
);
ps_layout = paps_layout_to_postscript_strdup(paps,
0, 0,
+ 1.0, 1.0,
layout);
g_string_append_printf(ps_text,
"gsave\n"

View File

@ -1,104 +0,0 @@
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-05-25 13:23:07.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-05-25 14:55:03.000000000 +0900
@@ -105,7 +105,8 @@
/* Information passed in user data when drawing outlines */
GList *split_paragraphs_into_lines (GList *paragraphs);
-static char *read_file (FILE *file);
+static char *read_file (FILE *file,
+ GIConv handle);
static GList *split_text_into_paragraphs (PangoContext *pango_context,
page_layout_t *page_layout,
int paint_width,
@@ -188,7 +189,7 @@
gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE;
int num_columns = 1, font_scale = 12;
int top_margin = 36, bottom_margin = 36, right_margin = 36, left_margin = 36;
- char *font_family = "Monospace";
+ char *font_family = "Monospace", *encoding = NULL;
GOptionContext *ctxt = g_option_context_new("[text file]");
GOptionEntry entries[] = {
{"landscape", 0, 0, G_OPTION_ARG_NONE, &do_landscape, "Landscape output. (Default: portrait)", NULL},
@@ -205,6 +206,7 @@
{"right-margin", 0, 0, G_OPTION_ARG_INT, &right_margin, "Set right margin. (Default: 36)", "NUM"},
{"left-margin", 0, 0, G_OPTION_ARG_INT, &left_margin, "Set left margin. (Default: 36)", "NUM"},
{"header", 0, 0, G_OPTION_ARG_NONE, &do_draw_header, "Draw page header for each page.", NULL},
+ {"encoding", 0, 0, G_OPTION_ARG_STRING, &encoding, "Assume the documentation encoding.", "ENCODING"},
{NULL}
};
GError *error = NULL;
@@ -228,6 +230,7 @@
gchar *paps_header = NULL;
gchar *header_font_desc = "Monospace Bold 12";
int header_sep = 20;
+ GIConv cvh = NULL;
/* Prerequisite when using glib. */
g_type_init();
@@ -339,7 +342,21 @@
page_layout.filename = filename_in;
page_layout.header_font_desc = header_font_desc;
- text = read_file(IN);
+ if (encoding != NULL)
+ {
+ cvh = g_iconv_open ("UTF-8", encoding);
+ if (cvh == NULL)
+ {
+ fprintf(stderr, "%s: Invalid encoding: %s\n", g_get_prgname (), encoding);
+ exit(-1);
+ }
+ }
+
+ text = read_file(IN, cvh);
+
+ if (encoding != NULL && cvh != NULL)
+ g_iconv_close(cvh);
+
paragraphs = split_text_into_paragraphs(pango_context,
&page_layout,
page_layout.column_width * page_layout.pt_to_pixel,
@@ -373,7 +390,8 @@
/* Read an entire file into a string
*/
static char *
-read_file (FILE *file)
+read_file (FILE *file,
+ GIConv handle)
{
GString *inbuf;
char *text;
@@ -382,7 +400,9 @@
inbuf = g_string_new (NULL);
while (1)
{
- char *bp = fgets (buffer, BUFSIZE-1, file);
+ char *ib, *ob, obuffer[BUFSIZE * 6], *bp = fgets (buffer, BUFSIZE-1, file);
+ gsize iblen, oblen;
+
if (ferror (file))
{
fprintf(stderr, "%s: Error reading file.\n", g_get_prgname ());
@@ -392,7 +412,20 @@
else if (bp == NULL)
break;
- g_string_append (inbuf, buffer);
+ if (handle != NULL)
+ {
+ ib = bp;
+ iblen = strlen (ib);
+ ob = bp = obuffer;
+ oblen = BUFSIZE * 6 - 1;
+ if (g_iconv (handle, &ib, &iblen, &ob, &oblen) == -1)
+ {
+ fprintf (stderr, "%s: Error while converting strings.\n", g_get_prgname ());
+ return NULL;
+ }
+ obuffer[BUFSIZE * 6 - 1 - oblen] = 0;
+ }
+ g_string_append (inbuf, bp);
}
fclose (file);

View File

@ -1,92 +0,0 @@
--- paps-0.6.6.orig/src/paps.1 2006-06-20 04:09:58.000000000 +0900
+++ paps-0.6.6/src/paps.1 2006-06-20 04:12:23.000000000 +0900
@@ -34,11 +34,8 @@
.B \-\-columns=cl
Number of columns output. Default is 1.
.TP
-.B \-\-font\-scale=fs
-Font scaling. Default is 12.
-.TP
-.B \-\-family=f
-Pango ft2 font family. Default is Monospace.
+.B \-\-font=desc
+Set the font description. Default is Monospace 12.
.TP
.B \-\-rtl
Do rtl layout.
--- paps-0.6.6/src/paps.c 2006-06-20 04:01:57.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-06-29 15:08:48.000000000 +0100
@@ -30,7 +30,11 @@
#include <time.h>
#define BUFSIZE 1024
-#define HEADER_FONT_SCALE 12
+#define DEFAULT_FONT_FAMILY "Monospace"
+#define DEFAULT_FONT_SIZE "12"
+#define HEADER_FONT_FAMILY "Monospace Bold"
+#define HEADER_FONT_SCALE "12"
+#define MAKE_FONT_NAME(f,s) f " " s
typedef enum {
PAPER_TYPE_A4 = 0,
@@ -187,15 +191,14 @@
int main(int argc, char *argv[])
{
gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE;
- int num_columns = 1, font_scale = 12;
+ int num_columns = 1;
int top_margin = 36, bottom_margin = 36, right_margin = 36, left_margin = 36;
- char *font_family = "Monospace", *encoding = NULL;
+ gchar *font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE), *encoding = NULL;
GOptionContext *ctxt = g_option_context_new("[text file]");
GOptionEntry entries[] = {
{"landscape", 0, 0, G_OPTION_ARG_NONE, &do_landscape, "Landscape output. (Default: portrait)", NULL},
{"columns", 0, 0, G_OPTION_ARG_INT, &num_columns, "Number of columns output. (Default: 1)", "NUM"},
- {"font-scale", 0, 0, G_OPTION_ARG_INT, &font_scale, "Font scaling. (Default: 12)", "NUM"},
- {"family", 0, 0, G_OPTION_ARG_STRING, &font_family, "Pango FT2 font family. (Default: Monospace)", "FAMILY"},
+ {"font", 0, 0, G_OPTION_ARG_STRING, &font, "Set the font description. (Default: Monospace 12)", "DESC"},
{"rtl", 0, 0, G_OPTION_ARG_NONE, &do_rtl, "Do rtl layout.", NULL},
{"justify", 0, 0, G_OPTION_ARG_NONE, &do_justify, "Do justify the lines.", NULL},
{"paper", 0, 0, G_OPTION_ARG_CALLBACK, _paps_arg_paper_cb,
@@ -210,11 +213,8 @@
{NULL}
};
GError *error = NULL;
- char *filename_in;
- char *title;
FILE *IN, *OUT = NULL;
page_layout_t page_layout;
- char *text;
GList *paragraphs;
GList *pango_lines;
PangoContext *pango_context;
@@ -228,7 +228,8 @@
int do_tumble = -1; /* -1 means not initialized */
int do_duplex = -1;
gchar *paps_header = NULL;
- gchar *header_font_desc = "Monospace Bold 12";
+ gchar *header_font_desc = MAKE_FONT_NAME (HEADER_FONT_FAMILY, HEADER_FONT_SCALE);
+ gchar *filename_in, *title, *text;
int header_sep = 20;
GIConv cvh = NULL;
@@ -271,13 +272,12 @@
pango_context_set_language (pango_context, pango_language_from_string ("en_US"));
pango_context_set_base_dir (pango_context, pango_dir);
- font_description = pango_font_description_new ();
- pango_font_description_set_family (font_description, g_strdup(font_family));
- pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
- pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL);
- pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
- pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL);
- pango_font_description_set_size (font_description, font_scale * PANGO_SCALE);
+ /* create the font description */
+ font_description = pango_font_description_from_string (font);
+ if ((pango_font_description_get_set_fields (font_description) & PANGO_FONT_MASK_FAMILY) == 0)
+ pango_font_description_set_family (font_description, DEFAULT_FONT_FAMILY);
+ if ((pango_font_description_get_set_fields (font_description) & PANGO_FONT_MASK_SIZE) == 0)
+ pango_font_description_set_size (font_description, atoi(DEFAULT_FONT_SIZE) * PANGO_SCALE);
pango_context_set_font_description (pango_context, font_description);

View File

@ -1,47 +0,0 @@
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 04:17:28.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-06-20 04:24:27.000000000 +0900
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
+#include <locale.h>
#define BUFSIZE 1024
#define DEFAULT_FONT_FAMILY "Monospace"
@@ -188,6 +188,26 @@
return retval;
}
+static PangoLanguage *
+get_language(void)
+{
+ PangoLanguage *retval;
+ gchar *lang = g_strdup (setlocale (LC_CTYPE, NULL));
+ gchar *p;
+
+ p = strchr (lang, '.');
+ if (p)
+ *p = 0;
+ p = strchr (lang, '@');
+ if (p)
+ *p = 0;
+
+ retval = pango_language_from_string (lang);
+ g_free (lang);
+
+ return retval;
+}
+
int main(int argc, char *argv[])
{
gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE;
@@ -269,7 +289,7 @@
pango_context = paps_get_pango_context (paps);
/* Setup pango */
- pango_context_set_language (pango_context, pango_language_from_string ("en_US"));
+ pango_context_set_language (pango_context, get_language ());
pango_context_set_base_dir (pango_context, pango_dir);
/* create the font description */

View File

@ -1,12 +0,0 @@
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-05-25 15:12:02.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-05-25 15:15:58.000000000 +0900
@@ -453,7 +453,7 @@
GList *result = NULL;
char *last_para = text;
- while (*p)
+ while (p != NULL && *p)
{
wc = g_utf8_get_char (p);
next = g_utf8_next_char (p);

View File

@ -1,38 +0,0 @@
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-07-04 12:16:49.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-07-04 12:19:20.000000000 +0900
@@ -79,6 +79,7 @@
gboolean do_justify;
gboolean do_separation_line;
gboolean do_draw_contour;
+ gboolean do_wordwrap;
PangoDirection pango_dir;
gchar *filename;
gchar *header_font_desc;
@@ -212,6 +213,7 @@
int main(int argc, char *argv[])
{
gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE;
+ gboolean do_wordwrap = TRUE;
int num_columns = 1;
int top_margin = 36, bottom_margin = 36, right_margin = 36, left_margin = 36;
gchar *font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE), *encoding = NULL;
@@ -340,6 +342,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
@@ -496,6 +499,10 @@
page_layout->pango_dir == PANGO_DIRECTION_LTR
? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
+ if (page_layout->do_wordwrap)
+ pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR);
+ else
+ pango_layout_set_width (para->layout, -1);
para->height = 0;
if (wc == '\f')

35
paps-0.6.8-shared.patch Normal file
View File

@ -0,0 +1,35 @@
diff -ruN paps-0.6.8.orig/src/Makefile.am paps-0.6.8/src/Makefile.am
--- paps-0.6.8.orig/src/Makefile.am 2006-04-17 16:42:08.000000000 +0900
+++ paps-0.6.8/src/Makefile.am 2007-11-16 11:50:07.000000000 +0900
@@ -1,15 +1,15 @@
man_MANS = paps.1
-lib_LIBRARIES = libpaps.a
-libpaps_a_SOURCES = libpaps.c
-libpaps_a_inc_HEADERS = libpaps.h
-libpaps_a_incdir = $(includedir)
+lib_LTLIBRARIES = libpaps.la
+libpaps_la_SOURCES = libpaps.c
+libpapsinc_HEADERS = libpaps.h
+libpapsincdir = $(includedir)
bin_PROGRAMS = paps
paps_CFLAGS = -Wall
paps_SOURCES = paps.c
-paps_LDADD = $(lib_LIBRARIES) $(all_libraries)
+paps_LDADD = $(lib_LTLIBRARIES) $(all_libraries)
paps_LDFLAGS = `pkg-config --libs pangoft2`
-paps_DEPENDENCIES = $(lib_LIBRARIES)
+paps_DEPENDENCIES = $(lib_LTLIBRARIES)
EXTRA_DIST = test_libpaps.c paps.1
@@ -21,7 +21,7 @@
test_libpaps_SOURCES = test_libpaps.c
-test_libpaps_LDADD = $(lib_LIBRARIES) $(all_libraries)
+test_libpaps_LDADD = $(lib_LTLIBRARIES) $(all_libraries)
test_libpaps_LDFLAGS = `pkg-config --libs pangoft2`
-test_libpaps_DEPENDENCIES = $(lib_LIBRARIES)
+test_libpaps_DEPENDENCIES = $(lib_LTLIBRARIES)

35
paps-0.6.8-wordwrap.patch Normal file
View File

@ -0,0 +1,35 @@
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-04-13 14:04:14.000000000 +0900
+++ paps-0.6.8/src/paps.c 2007-11-16 12:28:11.000000000 +0900
@@ -723,9 +723,12 @@ split_text_into_paragraphs (PangoContext
pango_layout_set_alignment (para->layout,
page_layout->pango_dir == PANGO_DIRECTION_LTR
? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
- pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR);
-
- pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
+ if (page_layout->do_wordwrap) {
+ pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR);
+ pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
+ } else {
+ pango_layout_set_width (para->layout, -1);
+ }
para->height = 0;
result = g_list_prepend (result, para);
@@ -754,9 +757,13 @@ split_text_into_paragraphs (PangoContext
pango_layout_set_alignment (para->layout,
page_layout->pango_dir == PANGO_DIRECTION_LTR
? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
- 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);
+ pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
+ } else {
+ pango_layout_set_width (para->layout, -1);
+ }
- pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
para->height = 0;
last_para = next;

80
paps-cpilpi.patch Normal file
View File

@ -0,0 +1,80 @@
diff -pruN -x .libs -x '*o' -x '*ps' ../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-28 16:20:56.000000000 +0900
+++ paps-0.6.8/src/paps.c 2007-11-30 17:53:06.000000000 +0900
@@ -92,8 +92,8 @@ typedef struct {
gchar *filename;
gchar *header_font_desc;
gchar *owner;
- gint lpi;
- gint cpi;
+ gdouble lpi;
+ gdouble cpi;
} page_layout_t;
typedef struct {
@@ -376,6 +376,7 @@ int main(int argc, char *argv[])
bottom_margin = 36;
page_width = 612;
page_height = 792;
+ do_stretch_chars = TRUE;
if (argc < 6 || argc > 7) {
fprintf(stderr, "ERROR: %s job-id user title copies options [file]\n", prgname);
@@ -596,7 +597,8 @@ int main(int argc, char *argv[])
/* calculate x-coordinate scale */
if (page_layout.cpi > 0.0L)
{
- double scale;
+ gint font_size;
+
fontmap = pango_ft2_font_map_new ();
fontset = pango_font_map_load_fontset (fontmap, pango_context, font_description, get_language ());
metrics = pango_fontset_get_metrics (fontset);
@@ -608,13 +610,10 @@ int main(int argc, char *argv[])
pango_font_metrics_unref (metrics);
g_object_unref (G_OBJECT (fontmap));
- // Now figure out how to scale the font to get that size
- scale = 1 / page_layout.cpi * 72.0 * PANGO_SCALE / max_width;
-
+ font_size = pango_font_description_get_size (font_description);
// update the font size to that width
- pango_font_description_set_size (font_description, (int)(atoi(DEFAULT_FONT_SIZE) * PANGO_SCALE * scale));
+ pango_font_description_set_size (font_description, font_size * page_layout.scale_x);
pango_context_set_font_description (pango_context, font_description);
-
}
page_layout.scale_x = page_layout.scale_y = 1.0;
@@ -1002,6 +1001,7 @@ output_pages(FILE *OUT,
int column_y_pos = 0;
int page_idx = 1;
int pango_column_height = page_layout->column_height * page_layout->pt_to_pixel * PANGO_SCALE;
+ int height = 0;
LineLink *prev_line_link = NULL;
start_page(OUT, page_idx);
@@ -1039,17 +1039,17 @@ output_pages(FILE *OUT,
);
}
}
+ if (page_layout->lpi > 0.0L)
+ height = (int)(1.0 / page_layout->lpi * 72.0 * page_layout->pt_to_pixel * PANGO_SCALE);
+ else
+ height = line_link->logical_rect.height;
draw_line_to_page(OUT,
column_idx,
- column_y_pos+line_link->logical_rect.height,
+ column_y_pos+height,
page_layout,
line);
- if (page_layout->lpi > 0.0L)
- column_y_pos += (int)(1.0 / page_layout->lpi * 72.0 * page_layout->pt_to_pixel * PANGO_SCALE);
- else
- column_y_pos += line_link->logical_rect.height;
-
+ column_y_pos += height;
pango_lines = pango_lines->next;
prev_line_link = line_link;
}

View File

@ -1,7 +1,7 @@
diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*' -x configure -x doc -x libtool -x .deps -x .libs -x '*.ps' -x foo -x paps -x 'lib*' -x texttopaps -x '*o' -x '*.cups' -x 'test*' -x 'stamp*' paps-0.6.6.orig/configure.in paps-0.6.6/configure.in diff -pruN paps-0.6.8.orig/configure.in paps-0.6.8/configure.in
--- paps-0.6.6.orig/configure.in 2006-04-28 04:41:36.000000000 +0900 --- paps-0.6.8.orig/configure.in 2007-01-19 20:06:10.000000000 +0900
+++ paps-0.6.6/configure.in 2007-02-15 23:34:24.000000000 +0900 +++ paps-0.6.8/configure.in 2007-11-30 18:40:32.000000000 +0900
@@ -7,4 +7,17 @@ AC_LANG_C @@ -7,6 +7,19 @@ AC_LANG_C
AC_PROG_CC AC_PROG_CC
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
@ -10,55 +10,57 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
+dnl ====================================================== +dnl ======================================================
+AC_PATH_PROG(CUPS_CONFIG, cups-config, no) +AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
+if test "$CUPS_CONFIG" = "no"; then +if test "$CUPS_CONFIG" = "no"; then
+ AC_MSG_ERROR([Please install cups development packages]) + AC_MSG_ERROR([Please install cups development packages/files])
+fi +fi
+CUPS_CFLAGS=`$CUPS_CONFIG --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'` +CUPS_CFLAGS=`$CUPS_CONFIG --cflags | sed -e 's/-O[0-9]*//' -e 's/-m[^\t]*//g'`
+CUPS_LIBS=`$CUPS_CONFIG --libs` +CUPS_LIBS=`$CUPS_CONFIG --libs`
+ +
+AC_SUBST(CUPS_CFLAGS) +AC_SUBST(CUPS_CFLAGS)
+AC_SUBST(CUPS_LIBS) +AC_SUBST(CUPS_LIBS)
+ +
AC_OUTPUT(Makefile src/Makefile doc/Makefile) DX_HTML_FEATURE(ON)
diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*' -x configure -x doc -x libtool -x .deps -x .libs -x '*.ps' -x foo -x paps -x 'lib*' -x texttopaps -x '*o' -x '*.cups' -x 'test*' -x 'stamp*' paps-0.6.6.orig/src/Makefile.am paps-0.6.6/src/Makefile.am DX_CHM_FEATURE(OFF)
--- paps-0.6.6.orig/src/Makefile.am 2007-02-15 22:59:47.000000000 +0900 DX_CHI_FEATURE(OFF)
+++ paps-0.6.6/src/Makefile.am 2007-02-15 23:34:24.000000000 +0900 diff -pruN paps-0.6.8.orig/src/Makefile.am paps-0.6.8/src/Makefile.am
@@ -5,10 +5,10 @@ libpaps_a_inc_HEADERS = libpaps.h --- paps-0.6.8.orig/src/Makefile.am 2007-11-30 18:40:15.000000000 +0900
libpaps_a_incdir = $(includedir) +++ paps-0.6.8/src/Makefile.am 2007-11-30 18:40:32.000000000 +0900
@@ -5,10 +5,10 @@ libpapsinc_HEADERS = libpaps.h
libpapsincdir = $(includedir)
bin_PROGRAMS = paps bin_PROGRAMS = paps
-paps_CFLAGS = -Wall -paps_CFLAGS = -Wall
+paps_CFLAGS = -Wall $(CUPS_CFLAGS) +paps_CFLAGS = -Wall $(CUPS_CFLAGS)
paps_SOURCES = paps.c paps_SOURCES = paps.c
paps_LDADD = $(noinst_LIBRARIES) $(all_libraries) paps_LDADD = $(lib_LTLIBRARIES) $(all_libraries)
-paps_LDFLAGS = `pkg-config --libs pangoft2` -paps_LDFLAGS = `pkg-config --libs pangoft2`
+paps_LDFLAGS = `pkg-config --libs pangoft2` $(CUPS_LIBS) +paps_LDFLAGS = `pkg-config --libs pangoft2` $(CUPS_LIBS)
paps_DEPENDENCIES = $(noinst_LIBRARIES) paps_DEPENDENCIES = $(lib_LTLIBRARIES)
EXTRA_DIST = test_libpaps.c paps.1 EXTRA_DIST = test_libpaps.c paps.1
diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*' -x configure -x doc -x libtool -x .deps -x .libs -x '*.ps' -x foo -x paps -x 'lib*' -x texttopaps -x '*o' -x '*.cups' -x 'test*' -x 'stamp*' paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
--- paps-0.6.6.orig/src/paps.c 2007-02-15 22:59:48.000000000 +0900 --- paps-0.6.8.orig/src/paps.c 2007-11-30 18:40:15.000000000 +0900
+++ paps-0.6.6/src/paps.c 2007-03-07 20:58:31.000000000 +0900 +++ paps-0.6.8/src/paps.c 2007-11-30 18:47:28.000000000 +0900
@@ -32,6 +32,7 @@ @@ -31,6 +31,7 @@
#include <string.h>
#include <time.h> #include <time.h>
#include <locale.h> #include <locale.h>
#include <wchar.h>
+#include <cups/cups.h> +#include <cups/cups.h>
#define BUFSIZE 1024 #define BUFSIZE 1024
#define DEFAULT_FONT_FAMILY "Monospace" #define DEFAULT_FONT_FAMILY "Monospace"
@@ -85,9 +86,11 @@ typedef struct { @@ -86,9 +87,11 @@ typedef struct {
gboolean do_separation_line;
gboolean do_draw_contour;
gboolean do_wordwrap; gboolean do_wordwrap;
gboolean do_use_markup;
gboolean do_stretch_chars;
+ gboolean cups_mode; + gboolean cups_mode;
PangoDirection pango_dir; PangoDirection pango_dir;
gchar *filename; gchar *filename;
gchar *header_font_desc; gchar *header_font_desc;
+ gchar *owner; + gchar *owner;
gint lpi;
gint cpi;
} page_layout_t; } page_layout_t;
@@ -320,8 +323,8 @@ int main(int argc, char *argv[])
typedef struct {
@@ -314,8 +317,8 @@ int main(int argc, char *argv[])
int num_pages = 1; int num_pages = 1;
int gutter_width = 40; int gutter_width = 40;
int total_gutter_width; int total_gutter_width;
@ -69,18 +71,18 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
int do_tumble = -1; /* -1 means not initialized */ int do_tumble = -1; /* -1 means not initialized */
int do_duplex = -1; int do_duplex = -1;
gchar *paps_header = NULL; gchar *paps_header = NULL;
@@ -324,6 +327,8 @@ int main(int argc, char *argv[]) @@ -331,6 +334,8 @@ int main(int argc, char *argv[])
int header_sep = 20;
int max_width = 0, w; int max_width = 0, w;
GIConv cvh = NULL; GIConv cvh = NULL;
GOptionGroup *options;
+ gboolean cups_mode = FALSE; + gboolean cups_mode = FALSE;
+ gchar *page_owner = NULL; + gchar *page_owner = NULL;
/* Set locale from environment. */ /* Set locale from environment. */
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
@@ -333,6 +338,128 @@ int main(int argc, char *argv[]) @@ -348,6 +353,134 @@ int main(int argc, char *argv[])
g_option_context_add_main_entries(ctxt, entries, NULL); g_option_context_add_main_entries(ctxt, entries, NULL);
#endif
+ /* check if the process is being invoked as CUPS filter */ + /* check if the process is being invoked as CUPS filter */
+ G_STMT_START { + G_STMT_START {
@ -92,13 +94,13 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
+ const char *val; + const char *val;
+ +
+ if (strncmp(prgname, "texttopaps", 10) == 0 || + if (strncmp(prgname, "texttopaps", 10) == 0 ||
+ getenv ("CUPS_SERVER") != NULL) { + getenv("CUPS_SERVER") != NULL) {
+ g_set_prgname(prgname); + g_set_prgname(prgname);
+ /* argument format should be job-id user title copies options [file] */ + /* argument format should be job-id user title copies options [file] */
+ cups_mode = TRUE; + cups_mode = TRUE;
+ /* set default values */ + /* set default values */
+ lpi = 6.0L; + page_layout.lpi = 6.0L;
+ cpi = 10.0L; + page_layout.cpi = 10.0L;
+ left_margin = 18; + left_margin = 18;
+ right_margin = 18; + right_margin = 18;
+ top_margin = 36; + top_margin = 36;
@ -115,7 +117,7 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
+ IN = stdin; + IN = stdin;
+ } else { + } else {
+ filename_in = argv[6]; + filename_in = argv[6];
+ if ((IN = fopen(argv[6], "rb")) == NULL) { + if ((IN = fopen(filename_in, "rb")) == NULL) {
+ fprintf(stderr, "ERROR: unable to open print file -\n"); + fprintf(stderr, "ERROR: unable to open print file -\n");
+ exit(1); + exit(1);
+ } + }
@ -147,9 +149,12 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
+ if (g_ascii_strcasecmp(val, "no") && + if (g_ascii_strcasecmp(val, "no") &&
+ g_ascii_strcasecmp(val, "off") && + g_ascii_strcasecmp(val, "off") &&
+ g_ascii_strcasecmp(val, "false")) { + g_ascii_strcasecmp(val, "false")) {
+ /* We don't need to process the documentation for orientation support. + /* We really need to deal with the landscape orientation because
+ * pstops certainly does. (#222137) + * 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.
+ */ + */
+ do_landscape = TRUE;
+ } + }
+ } + }
+ /* XXX: need to support orientation-requested? */ + /* XXX: need to support orientation-requested? */
@ -172,8 +177,9 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
+ ppdIsMarked(ppd, "EFDuplex", "DuplexNoTumble") || + ppdIsMarked(ppd, "EFDuplex", "DuplexNoTumble") ||
+ ppdIsMarked(ppd, "EFDuplex", "DuplexTumble") || + ppdIsMarked(ppd, "EFDuplex", "DuplexTumble") ||
+ ppdIsMarked(ppd, "KD03Duplex", "DuplexNoTumble") || + ppdIsMarked(ppd, "KD03Duplex", "DuplexNoTumble") ||
+ ppdIsMarked(ppd, "KD03Duplex", "DuplexTumble")) + ppdIsMarked(ppd, "KD03Duplex", "DuplexTumble")) {
+ do_duplex = TRUE; + do_duplex = TRUE;
+ }
+ if ((val = cupsGetOption("wrap", num_options, options)) != NULL) { + if ((val = cupsGetOption("wrap", num_options, options)) != NULL) {
+ do_wordwrap = !g_ascii_strcasecmp(val, "true") || + do_wordwrap = !g_ascii_strcasecmp(val, "true") ||
+ !g_ascii_strcasecmp(val, "on") || + !g_ascii_strcasecmp(val, "on") ||
@ -183,21 +189,23 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
+ num_columns = atoi(val); + num_columns = atoi(val);
+ } + }
+ if ((val = cupsGetOption("cpi", num_options, options)) != NULL) { + if ((val = cupsGetOption("cpi", num_options, options)) != NULL) {
+ cpi = atof(val); + page_layout.cpi = atof(val);
+ } + }
+ if ((val = cupsGetOption("lpi", num_options, options)) != NULL) { + if ((val = cupsGetOption("lpi", num_options, options)) != NULL) {
+ lpi = atof(val); + page_layout.lpi = atof(val);
+ } + }
+ if (getenv("CHARSET") != NULL) { + if (getenv("CHARSET") != NULL) {
+ char *charset = getenv("CHARSET"); + char *charset = getenv("CHARSET");
+ /* Map CUPS charset names to real ones. + /* Map CUPS charset names to real ones.
+ * http://cups.org/newsgroups.php?s9797+gcups.general+v9797+T1 + * http://cups.org/newsgroups.php?s9797+gcups.general+v9797+T1
+ */ + */
+ if (!g_ascii_strcasecmp(charset, "windows-932")) + if (!g_ascii_strcasecmp(charset, "windows-932")) {
+ charset = "WINDOWS-31J"; + charset = "WINDOWS-31J";
+ }
+ if (g_ascii_strcasecmp(charset, "utf-8") && + if (g_ascii_strcasecmp(charset, "utf-8") &&
+ g_ascii_strcasecmp(charset, "utf8")) + g_ascii_strcasecmp(charset, "utf8")) {
+ encoding = g_strdup(charset); + encoding = g_strdup(charset);
+ }
+ } + }
+ } + }
+ } G_STMT_END; + } G_STMT_END;
@ -207,7 +215,7 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
/* Parse command line */ /* Parse command line */
if (!g_option_context_parse(ctxt, &argc, &argv, &error)) if (!g_option_context_parse(ctxt, &argc, &argv, &error))
{ {
@@ -359,6 +486,8 @@ int main(int argc, char *argv[]) @@ -374,6 +507,8 @@ int main(int argc, char *argv[])
IN = stdin; IN = stdin;
} }
title = filename_in; title = filename_in;
@ -216,20 +224,20 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
paps = paps_new(); paps = paps_new();
pango_context = paps_get_pango_context (paps); pango_context = paps_get_pango_context (paps);
@@ -377,8 +506,10 @@ int main(int argc, char *argv[]) @@ -392,8 +527,10 @@ int main(int argc, char *argv[])
pango_context_set_font_description (pango_context, font_description); pango_context_set_font_description (pango_context, font_description);
/* Page layout */ /* Page layout */
- page_width = paper_sizes[(int)paper_type].width; - page_width = paper_sizes[(int)paper_type].width;
- page_height = paper_sizes[(int)paper_type].height; - page_height = paper_sizes[(int)paper_type].height;
+ if (page_width < 0) + if (page_width < 0)
+ page_width = paper_sizes[(int)paper_type].width; + page_width = paper_sizes[(int)paper_type].width;
+ if (page_height < 0) + if (page_height < 0)
+ page_height = paper_sizes[(int)paper_type].height; + page_height = paper_sizes[(int)paper_type].height;
if (num_columns == 1) if (num_columns == 1)
total_gutter_width = 0; total_gutter_width = 0;
@@ -439,6 +570,8 @@ int main(int argc, char *argv[]) @@ -456,6 +593,8 @@ int main(int argc, char *argv[])
page_layout.pango_dir = pango_dir; page_layout.pango_dir = pango_dir;
page_layout.filename = filename_in; page_layout.filename = filename_in;
page_layout.header_font_desc = header_font_desc; page_layout.header_font_desc = header_font_desc;
@ -237,21 +245,21 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
+ page_layout.cups_mode = cups_mode; + page_layout.cups_mode = cups_mode;
/* calculate x-coordinate scale */ /* calculate x-coordinate scale */
if (cpi > 0.0L) if (page_layout.cpi > 0.0L)
@@ -584,6 +717,12 @@ split_text_into_paragraphs (PangoContext @@ -756,6 +895,12 @@ split_text_into_paragraphs (PangoContext
if (wc == (gunichar)-1) if (wc == (gunichar)-1)
{ {
fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ()); fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
+ if (page_layout->cups_mode) + if (page_layout->cups_mode)
+ { + {
+ /* try to continue parsing texts */ + /* try to continue parsing texts */
+ p = next; + p = next;
+ continue; + continue;
+ } + }
wc = 0; wc = 0;
} }
if (!*p || !wc || wc == '\n' || wc == '\f') if (!*p || !wc || wc == '\n' || wc == '\f')
@@ -810,6 +949,7 @@ void print_postscript_header(FILE *OUT, @@ -925,6 +1070,7 @@ void print_postscript_header(FILE *OUT,
int orientation = page_layout->page_width > page_layout->page_height; int orientation = page_layout->page_width > page_layout->page_height;
int bb_page_width = page_layout->page_width; int bb_page_width = page_layout->page_width;
int bb_page_height = page_layout->page_height; int bb_page_height = page_layout->page_height;
@ -259,7 +267,7 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
/* Keep bounding box non-rotated to make ggv happy */ /* Keep bounding box non-rotated to make ggv happy */
if (orientation) if (orientation)
@@ -819,12 +959,20 @@ void print_postscript_header(FILE *OUT, @@ -934,12 +1080,20 @@ void print_postscript_header(FILE *OUT,
bb_page_height = tmp; bb_page_height = tmp;
} }
@ -274,21 +282,38 @@ diff -pruN -x Makefile -x Makefile.in -x '*.m4' -x autom4te.cache -x 'config.*'
fprintf(OUT, fprintf(OUT,
"%%!PS-Adobe-3.0\n" "%%!PS-Adobe-3.0\n"
"%%%%Title: %s\n" "%%%%Title: %s\n"
"%%%%Creator: paps version 0.6.3 by Dov Grobgeld\n" "%%%%Creator: paps version 0.6.7 by Dov Grobgeld\n"
"%%%%Pages: (atend)\n" "%%%%Pages: (atend)\n"
- "%%%%BoundingBox: 0 0 %d %d\n" - "%%%%BoundingBox: 0 0 %d %d\n"
+ "%%%%BoundingBox: 0 0 %d %d\n%s" + "%%%%BoundingBox: 0 0 %d %d\n%s"
"%%%%BeginProlog\n" "%%%%BeginProlog\n"
"%%%%Orientation: %s\n" "%%%%Orientation: %s\n"
"/papsdict 1 dict def\n" "/papsdict 1 dict def\n"
@@ -874,8 +1022,10 @@ void print_postscript_header(FILE *OUT, @@ -989,8 +1143,13 @@ void print_postscript_header(FILE *OUT,
title, title,
bb_page_width, bb_page_width,
bb_page_height, bb_page_height,
- orientation_names[orientation]
+ owner, + owner,
orientation_names[orientation] + /* Put the fake orientation tag if paps is currently running under
+ * the CUPS filter mode. (#222137)
+ */
+ orientation_names[orientation && !page_layout->cups_mode]
); );
+ g_free(owner); + g_free(owner);
fprintf(OUT, fprintf(OUT,
"%% User settings\n" "%% 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,93 +0,0 @@
diff -ruN -x 'Makefile*' -x autom4te.cache -x 'config*' -x doc -x libtool -x .deps -x .libs -x '*a' -x '*o' -x paps -x '*orig' -x 'stamp*' -x 'test*' paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c
--- paps-0.6.6.orig/src/paps.c 2006-05-03 18:09:58.000000000 +0900
+++ paps-0.6.6/src/paps.c 2006-08-31 17:57:47.000000000 +0900
@@ -88,6 +88,7 @@
PangoLayoutLine *pango_line;
PangoRectangle logical_rect;
PangoRectangle ink_rect;
+ int formfeed;
} LineLink;
typedef struct _Paragraph Paragraph;
@@ -98,6 +99,7 @@
char *text;
int length;
int height; /* Height, in pixels */
+ int formfeed;
PangoLayout *layout;
};
@@ -428,7 +430,7 @@
fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
wc = 0;
}
- if (!*p || !wc || wc == '\n')
+ if (!*p || !wc || wc == '\n' || wc == '\f')
{
Paragraph *para = g_new (Paragraph, 1);
para->text = last_para;
@@ -442,6 +444,11 @@
pango_layout_set_width (para->layout, paint_width * PANGO_SCALE);
para->height = 0;
+ if (wc == '\f')
+ para->formfeed = 1;
+ else
+ para->formfeed = 0;
+
last_para = next;
result = g_list_prepend (result, para);
@@ -469,6 +476,7 @@
while(par_list)
{
int para_num_lines, i;
+ LineLink *line_link;
Paragraph *para = par_list->data;
para_num_lines = pango_layout_get_line_count(para->layout);
@@ -476,12 +484,15 @@
for (i=0; i<para_num_lines; i++)
{
PangoRectangle logical_rect, ink_rect;
- LineLink *line_link = g_new(LineLink, 1);
+ line_link = g_new(LineLink, 1);
+ line_link->formfeed = 0;
line_link->pango_line = pango_layout_get_line(para->layout, i);
pango_layout_line_get_extents(line_link->pango_line,
&ink_rect, &logical_rect);
line_link->logical_rect = logical_rect;
+ if (para->formfeed && i == (para_num_lines - 1))
+ line_link->formfeed = 1;
line_link->ink_rect = ink_rect;
line_list = g_list_prepend(line_list, line_link);
}
@@ -504,6 +515,7 @@
int column_y_pos = 0;
int page_idx = 1;
int pango_column_height = page_layout->column_height * page_layout->pt_to_pixel * PANGO_SCALE;
+ LineLink *prev_line_link = NULL;
start_page(OUT, page_idx);
@@ -516,8 +528,9 @@
PangoLayoutLine *line = line_link->pango_line;
/* Check if we need to move to next column */
- if (column_y_pos + line_link->logical_rect.height
- >= pango_column_height)
+ if ((column_y_pos + line_link->logical_rect.height
+ >= pango_column_height) ||
+ (prev_line_link && prev_line_link->formfeed))
{
column_idx++;
column_y_pos = 0;
@@ -547,6 +560,7 @@
column_y_pos += line_link->logical_rect.height;
pango_lines = pango_lines->next;
+ prev_line_link = line_link;
}
eject_page(OUT);
return page_idx;

View File

@ -1,47 +0,0 @@
diff -ruN paps-0.6.5.orig/doc/Makefile.am paps-0.6.5/doc/Makefile.am
--- paps-0.6.5.orig/doc/Makefile.am 2005-12-21 04:35:35.000000000 +0900
+++ paps-0.6.5/doc/Makefile.am 2006-04-17 17:28:52.000000000 +0900
@@ -10,7 +10,7 @@
EXTRA_DIST = Doxyfile example-output.png mainpage.h
-htmldir = share/doc/libpaps/html
-install-data-hook:
- mkdir -p $(prefix)/$(htmldir)
- cp -dpR doxygen-html/* $(prefix)/$(htmldir)
+htmldir = $(datadir)/doc/paps-$(VERSION)/html
+#install-data-hook:
+# mkdir -p $(prefix)/$(htmldir)
+# cp -dpR doxygen-html/* $(prefix)/$(htmldir)
diff -ruN paps-0.6.5.orig/src/Makefile.am paps-0.6.5/src/Makefile.am
--- paps-0.6.5.orig/src/Makefile.am 2006-04-17 15:04:13.000000000 +0900
+++ paps-0.6.5/src/Makefile.am 2006-04-17 17:30:01.000000000 +0900
@@ -1,5 +1,5 @@
man_MANS = paps.1
-lib_LIBRARIES = libpaps.a
+noinst_LIBRARIES = libpaps.a
libpaps_a_SOURCES = libpaps.c
libpaps_a_inc_HEADERS = libpaps.h
libpaps_a_incdir = $(includedir)
@@ -7,9 +7,9 @@
bin_PROGRAMS = paps
paps_CFLAGS = -Wall
paps_SOURCES = paps.c
-paps_LDADD = $(lib_LIBRARIES) $(all_libraries)
+paps_LDADD = $(noinst_LIBRARIES) $(all_libraries)
paps_LDFLAGS = `pkg-config --libs pangoft2`
-paps_DEPENDENCIES = $(lib_LIBRARIES)
+paps_DEPENDENCIES = $(noinst_LIBRARIES)
EXTRA_DIST = test_libpaps.c paps.1
@@ -21,7 +21,7 @@
test_libpaps_SOURCES = test_libpaps.c
-test_libpaps_LDADD = $(lib_LIBRARIES) $(all_libraries)
+test_libpaps_LDADD = $(noinst_LIBRARIES) $(all_libraries)
test_libpaps_LDFLAGS = `pkg-config --libs pangoft2`
-test_libpaps_DEPENDENCIES = $(lib_LIBRARIES)
+test_libpaps_DEPENDENCIES = $(noinst_LIBRARIES)

View File

@ -1,34 +0,0 @@
Index: src/paps.c
===================================================================
RCS file: /cvsroot/paps/paps/paps/src/paps.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- src/paps.c 17 Apr 2006 07:42:08 -0000 1.4
+++ src/paps.c 25 May 2006 07:26:55 -0000 1.5
@@ -190,7 +190,7 @@
GOptionEntry entries[] = {
{"landscape", 0, 0, G_OPTION_ARG_NONE, &do_landscape, "Landscape output. (Default: portrait)", NULL},
{"columns", 0, 0, G_OPTION_ARG_INT, &num_columns, "Number of columns output. (Default: 1)", "NUM"},
- {"font_scale", 0, 0, G_OPTION_ARG_INT, &font_scale, "Font scaling. (Default: 12)", "NUM"},
+ {"font-scale", 0, 0, G_OPTION_ARG_INT, &font_scale, "Font scaling. (Default: 12)", "NUM"},
{"family", 0, 0, G_OPTION_ARG_STRING, &font_family, "Pango FT2 font family. (Default: Monospace)", "FAMILY"},
{"rtl", 0, 0, G_OPTION_ARG_NONE, &do_rtl, "Do rtl layout.", NULL},
{"justify", 0, 0, G_OPTION_ARG_NONE, &do_justify, "Do justify the lines.", NULL},
Index: src/paps.1
===================================================================
RCS file: /cvsroot/paps/paps/paps/src/paps.1,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- src/paps.1 17 Apr 2006 19:21:43 -0000 1.1
+++ src/paps.1 25 May 2006 07:26:55 -0000 1.2
@@ -34,7 +34,7 @@
.B \-\-columns=cl
Number of columns output. Default is 1.
.TP
-.B \-\-fontscale=fs
+.B \-\-font\-scale=fs
Font scaling. Default is 12.
.TP
.B \-\-family=f

114
paps.spec
View File

@ -1,64 +1,64 @@
Name: paps Name: paps
Version: 0.6.6 Version: 0.6.8
Release: 21%{?dist} Release: 1%{?dist}
License: LGPLv2+ License: LGPLv2+
URL: http://paps.sourceforge.net/ URL: http://paps.sourceforge.net/
Source0: http://prdownloads.sourceforge.net/paps/paps-%{version}.tar.gz Source0: http://prdownloads.sourceforge.net/paps/paps-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pango-devel automake autoconf libtool doxygen cups-devel BuildRequires: pango-devel automake autoconf libtool doxygen cups-devel
Patch0: paps-makefile.patch ## https://sourceforge.net/tracker/index.php?func=detail&aid=1832897&group_id=153049&atid=786241
## fixed in CVS Patch0: paps-0.6.8-shared.patch
Patch2: paps-formfeed.patch ## https://sourceforge.net/tracker/index.php?func=detail&aid=1832924&group_id=153049&atid=786241
## fixed in CVS Patch1: paps-0.6.8-wordwrap.patch
Patch3: paps-0.6.6-encoding.patch ## https://sourceforge.net/tracker/index.php?func=detail&aid=1832926&group_id=153049&atid=786241
## fixed in CVS Patch2: paps-0.6.6-langinfo.patch
Patch4: paps-typo-font-scale.patch ## https://sourceforge.net/tracker/index.php?func=detail&aid=1832929&group_id=153049&atid=786241
## fixed in CVS Patch3: paps-0.6.6-lcnumeric.patch
Patch5: paps-0.6.6-segfault.patch ## https://sourceforge.net/tracker/index.php?func=detail&aid=1832935&group_id=153049&atid=786241
## fixed in CVS Patch4: paps-0.6.6-exitcode.patch
Patch6: paps-0.6.6-font-option.patch
## fixed in CVS
Patch7: paps-0.6.6-lcctype.patch
## fixed in CVS
Patch8: paps-0.6.6-wordwrap.patch
## fixed in CVS
Patch9: paps-0.6.6-cpilpi.patch
Patch10: paps-0.6.6-exitcode.patch
Patch11: paps-0.6.6-fix-wcswidth.patch
Patch12: paps-0.6.6-langinfo.patch
Patch13: paps-0.6.6-lcnumeric.patch
Patch50: paps-cups.patch Patch50: paps-cups.patch
Patch51: paps-cpilpi.patch
Patch61: paps-0.6.6-fix-wcswidth.patch
Summary: Plain Text to PostScript converter Summary: Plain Text to PostScript converter
Group: Applications/Publishing Group: Applications/Publishing
%description %description
paps is a PostScript converter from plain text file using Pango. paps is a PostScript converter from plain text file using Pango.
%package libs
Summary: Libraries for paps
Group: Development/Libraries
%description libs
paps is a PostScript converter from plain text file using Pango.
This package contains the library for paps.
%package devel
Summary: Development files for paps
Group: Development/Libraries
Requires: %{name}-libs = %{version}-%{release}
%description devel
paps is a PostScript converter from plain text file using Pango.
This package contains the development files that is necessary to develop
applications using paps API.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .makefile %patch0 -p1 -b .shared
%patch2 -p1 -b .formfeed %patch1 -p1 -b .wordwrap
%patch3 -p1 -b .encoding %patch2 -p1 -b .langinfo
%patch4 -p0 -b .typo %patch3 -p1 -b .lcnumeric
%patch5 -p1 -b .segfault %patch4 -p1 -b .exitcode
%patch6 -p1 -b .fontopt
%patch7 -p1 -b .lcctype
%patch8 -p1 -b .wordwrap
%patch9 -p1 -b .cpilpi
%patch10 -p1 -b .exitcode
%patch11 -p1 -b .wcswidth
%patch12 -p1 -b .langinfo
%patch13 -p1 -b .lcnumeric
%patch50 -p1 -b .cups %patch50 -p1 -b .cups
aclocal %patch51 -p1 -b .cpilpi
automake #%patch11 -p1 -b .wcswidth
autoconf autoreconf
%build %build
%configure %configure --disable-static
make %{?_smp_mflags} make %{?_smp_mflags}
@ -66,7 +66,9 @@ make %{?_smp_mflags}
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT%{_includedir}
# remove unnecessary files
rm $RPM_BUILD_ROOT%{_libdir}/libpaps.la
# make a symlink for CUPS filter # make a symlink for CUPS filter
%{__mkdir_p} $RPM_BUILD_ROOT/usr/lib/cups/filter # Not libdir %{__mkdir_p} $RPM_BUILD_ROOT/usr/lib/cups/filter # Not libdir
@ -82,8 +84,38 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/paps.1* %{_mandir}/man1/paps.1*
/usr/lib/cups/filter/texttopaps /usr/lib/cups/filter/texttopaps
%files libs
%defattr(-, root, root, -)
%doc COPYING.LIB
%{_libdir}/libpaps.so.*
%files devel
%defattr(-, root, root, -)
%doc COPYING.LIB
%{_includedir}/libpaps.h
%{_libdir}/libpaps.so
%changelog %changelog
* Fri Nov 30 2007 Akira TAGOH <tagoh@redhat.com> - 0.6.8-1
- New upstream release.
- Remove patches merged and unnecessary anymore:
- paps-makefile.patch
- paps-formfeed.patch
- paps-0.6.6-encoding.patch
- paps-typo-font-scale.patch
- paps-0.6.6-segfault.patch
- paps-0.6.6-font-option.patch
- paps-0.6.6-lcctype.patch
- paps-0.6.8-shared.patch: Enable building shared library.
- paps-0.6.8-wordwrap.patch: Update a bit to get it working without an wordwrap
mode.
- Add paps-libs and paps-devel package.
- paps-cups.patch: Update.
- paps-cpilpi.patch: Update.
- Fix the wrong rendering with CPI option. (#237202)
- Fix the unnecessary rotation with the landscape option when paps is running
as CUPS filter. (#222137)
* Thu Aug 23 2007 Akira TAGOH <tagoh@redhat.com> - 0.6.6-21 * Thu Aug 23 2007 Akira TAGOH <tagoh@redhat.com> - 0.6.6-21
- Rebuild - Rebuild