diff --git a/.fmf/version b/.fmf/version
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/.fmf/version
@@ -0,0 +1 @@
+1
diff --git a/29-paps.conf b/29-paps.conf
new file mode 100644
index 0000000..1ae98a4
--- /dev/null
+++ b/29-paps.conf
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ paps
+
+
+ true
+
+
+
+
+
+ texttopaps
+
+
+ true
+
+
+
+
+
diff --git a/paps-0.6.8-ftbfs.patch b/paps-0.6.8-ftbfs.patch
new file mode 100644
index 0000000..01bdb5c
--- /dev/null
+++ b/paps-0.6.8-ftbfs.patch
@@ -0,0 +1,13 @@
+バイナリーファイル paps-0.6.8.orig/src/paps-paps.o とpaps-0.6.8/src/paps-paps.o は異なります
+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 2025-01-27 18:18:12.130570673 +0900
++++ paps-0.6.8/src/paps.c 2025-01-27 18:47:05.214883811 +0900
+@@ -515,7 +515,7 @@ int main(int argc, char *argv[])
+ } /* if (!cups_mode) */
+
+ paps = paps_new();
+- pango_context = paps_get_pango_context (paps);
++ pango_context = paps_get_pango_context ();
+
+ /* Setup pango */
+ pango_context_set_language (pango_context, get_language ());
diff --git a/paps-0.6.8-glib282.patch b/paps-0.6.8-glib282.patch
new file mode 100644
index 0000000..7d3d165
--- /dev/null
+++ b/paps-0.6.8-glib282.patch
@@ -0,0 +1,12 @@
+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 2024-09-13 21:07:13.225683344 +0900
++++ paps-0.6.8/src/paps.c 2024-09-13 21:10:24.177041518 +0900
+@@ -784,7 +784,7 @@ split_text_into_paragraphs (PangoContext
+ while (p != NULL && *p)
+ {
+ wc = g_utf8_get_char (p);
+- next = g_utf8_next_char (p);
++ next = (char *) g_utf8_next_char (p);
+ if (wc == (gunichar)-1)
+ {
+ fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
diff --git a/paps-854897-manpage.patch b/paps-854897-manpage.patch
new file mode 100644
index 0000000..c841f44
--- /dev/null
+++ b/paps-854897-manpage.patch
@@ -0,0 +1,13 @@
+diff -pruN paps-0.6.8.orig/src/paps.1 paps-0.6.8/src/paps.1
+--- paps-0.6.8.orig/src/paps.1 2007-01-19 20:05:27.000000000 +0900
++++ paps-0.6.8/src/paps.1 2012-09-06 18:04:01.000000000 +0900
+@@ -64,6 +64,9 @@ Draw page header for each page.
+ .B \-\-markup
+ Interpret the text as pango markup.
+ .TP
++.B \-\-encoding=ENCODING
++Assume the documentation encoding is ENCODING.
++.TP
+ .B \-\-lpi
+ Set the lines per inch. This determines the line spacing.
+ .TP
diff --git a/paps-a3.patch b/paps-a3.patch
new file mode 100644
index 0000000..3628b3a
--- /dev/null
+++ b/paps-a3.patch
@@ -0,0 +1,40 @@
+--- paps-0.6.8/src/paps.c.orig 2015-02-26 14:17:29.351338514 +0530
++++ paps-0.6.8/src/paps.c 2015-02-26 14:17:29.351338514 +0530
+@@ -45,7 +45,8 @@
+ typedef enum {
+ PAPER_TYPE_A4 = 0,
+ PAPER_TYPE_US_LETTER = 1,
+- PAPER_TYPE_US_LEGAL = 2
++ PAPER_TYPE_US_LEGAL = 2,
++ PAPER_TYPE_A3 = 3
+ } paper_type_t ;
+
+ typedef struct {
+@@ -56,7 +57,8 @@
+ const paper_size_t paper_sizes[] = {
+ { 595.28, 841.89}, /* A4 */
+ { 612, 792}, /* US letter */
+- { 612, 1008} /* US legal */
++ { 612, 1008}, /* US legal */
++ { 842, 1190} /* A3 */
+ };
+
+ typedef struct {
+@@ -190,6 +192,8 @@
+ paper_type = PAPER_TYPE_US_LETTER;
+ else if (g_ascii_strcasecmp(value, "a4") == 0)
+ paper_type = PAPER_TYPE_A4;
++ else if (g_ascii_strcasecmp(value, "a3") == 0)
++ paper_type = PAPER_TYPE_A3;
+ else {
+ retval = FALSE;
+ fprintf(stderr, "Unknown page size name: %s.\n", value);
+@@ -300,7 +304,7 @@
+ {"rtl", 0, 0, G_OPTION_ARG_NONE, &do_rtl, "Do rtl layout.", NULL},
+ {"paper", 0, 0, G_OPTION_ARG_CALLBACK, _paps_arg_paper_cb,
+ "Choose paper size. Known paper sizes are legal,\n"
+- " letter, a4. (Default: a4)", "PAPER"},
++ " letter, a3, a4. (Default: a4)", "PAPER"},
+ {"bottom-margin", 0, 0, G_OPTION_ARG_INT, &bottom_margin, "Set bottom margin in postscript point units (1/72inch). (Default: 36)", "NUM"},
+ {"top-margin", 0, 0, G_OPTION_ARG_INT, &top_margin, "Set top margin. (Default: 36)", "NUM"},
+ {"right-margin", 0, 0, G_OPTION_ARG_INT, &right_margin, "Set right margin. (Default: 36)", "NUM"},
diff --git a/paps-c99.patch b/paps-c99.patch
new file mode 100644
index 0000000..115043e
--- /dev/null
+++ b/paps-c99.patch
@@ -0,0 +1,44 @@
+Use AC_USE_SYSTEM_EXTENSIONS and include , so that
+makes a declaration of wcwidth available. Include
+for a declaration of g_vasprintf. This avoids implicit function
+declarations and build failures with future compilers.
+
+No need to upstream this because it only impacts the bundled 0.6.8
+sources, the later 0.8.0 version has already been fixed upstream. The
+g_vasprintf call was introduced in the paps-0.6.6-lcnumeric.patch
+downstream patch.
+
+diff -ur paps-0.8.0.orig/paps-0.6.8/configure.in paps-0.8.0/paps-0.6.8/configure.in
+--- paps-0.8.0.orig/paps-0.6.8/configure.in 2023-04-13 11:56:29.571277839 +0200
++++ paps-0.8.0/paps-0.6.8/configure.in 2023-04-13 12:00:03.228135149 +0200
+@@ -6,6 +6,7 @@
+ AC_LANG_C
+ AC_PROG_CC
+ AM_PROG_LIBTOOL
++AC_USE_SYSTEM_EXTENSIONS
+
+ dnl ======================================================
+ dnl check for CUPS
+diff -ur paps-0.8.0.orig/paps-0.6.8/src/paps.c paps-0.8.0/paps-0.6.8/src/paps.c
+--- paps-0.8.0.orig/paps-0.6.8/src/paps.c 2023-04-13 11:56:29.583277719 +0200
++++ paps-0.8.0/paps-0.6.8/src/paps.c 2023-04-13 12:02:28.958673663 +0200
+@@ -20,7 +20,7 @@
+ *
+ */
+
+-
++#include
+ #include
+ #include
+ #include "libpaps.h"
+diff -ur paps-0.8.0.orig/paps-0.6.8/src/libpaps.c paps-0.8.0/paps-0.6.8/src/libpaps.c
+--- paps-0.8.0.orig/paps-0.6.8/src/libpaps.c 2023-04-13 11:56:29.581277739 +0200
++++ paps-0.8.0/paps-0.6.8/src/libpaps.c 2023-04-13 12:07:17.504779917 +0200
+@@ -23,6 +23,7 @@
+
+ #include "libpaps.h"
+
++#include
+ #include
+ #include
+ #include
diff --git a/paps-correct-fsf-address.patch b/paps-correct-fsf-address.patch
new file mode 100644
index 0000000..5313f85
--- /dev/null
+++ b/paps-correct-fsf-address.patch
@@ -0,0 +1,77 @@
+diff -pruN paps-0.6.8.orig/COPYING.LIB paps-0.6.8/COPYING.LIB
+--- paps-0.6.8.orig/COPYING.LIB 2005-12-21 04:35:27.000000000 +0900
++++ paps-0.6.8/COPYING.LIB 2012-11-23 14:30:46.297512335 +0900
+@@ -1,16 +1,15 @@
+- GNU LIBRARY GENERAL PUBLIC LICENSE
+- Version 2, June 1991
++ GNU LIBRARY GENERAL PUBLIC LICENSE
++ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+- 59 Temple Place - Suite 330
+- Boston, MA 02111-1307, USA.
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ [This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+- Preamble
++ Preamble
+
+ The licenses for most software are designed to take away your
+ freedom to share and change it. By contrast, the GNU General Public
+@@ -100,7 +99,7 @@ works together with the library.
+ Note that it is possible for a library to be covered by the ordinary
+ General Public License rather than by this special one.
+
+- GNU LIBRARY GENERAL PUBLIC LICENSE
++ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+@@ -412,7 +411,7 @@ decision will be guided by the two goals
+ of all derivatives of our free software and of promoting the sharing
+ and reuse of software generally.
+
+- NO WARRANTY
++ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+ WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+@@ -435,8 +434,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH A
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
+- END OF TERMS AND CONDITIONS
+- How to Apply These Terms to Your New Libraries
++ END OF TERMS AND CONDITIONS
++
++ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+ possible use to the public, we recommend making it free software that
+@@ -453,18 +453,18 @@ convey the exclusion of warranty; and ea
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public
++ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- Lesser General Public License for more details.
++ Library General Public License for more details.
+
+- You should have received a copy of the GNU Lesser General Public
++ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free Software
+- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Also add information on how to contact you by electronic and paper mail.
+
diff --git a/paps-cups.patch b/paps-cups.patch
index 286ced2..acedf48 100644
--- a/paps-cups.patch
+++ b/paps-cups.patch
@@ -40,15 +40,16 @@ diff -pruN paps-0.6.8.orig/src/Makefile.am paps-0.6.8/src/Makefile.am
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-11-07 08:21:05.000000000 +0900
+++ paps-0.6.8/src/paps.c 2008-11-07 08:26:28.000000000 +0900
-@@ -31,6 +31,7 @@
+@@ -31,6 +31,8 @@
#include
#include
#include
+#include
++#include
#define BUFSIZE 1024
#define DEFAULT_FONT_FAMILY "Monospace"
-@@ -86,9 +87,11 @@ typedef struct {
+@@ -86,9 +88,11 @@ typedef struct {
gboolean do_wordwrap;
gboolean do_use_markup;
gboolean do_stretch_chars;
@@ -60,7 +61,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
gint lpi;
gint cpi;
} page_layout_t;
-@@ -320,8 +323,8 @@ int main(int argc, char *argv[])
+@@ -320,8 +324,8 @@ int main(int argc, char *argv[])
int num_pages = 1;
int gutter_width = 40;
int total_gutter_width;
@@ -71,7 +72,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
int do_tumble = -1; /* -1 means not initialized */
int do_duplex = -1;
gchar *paps_header = NULL;
-@@ -331,6 +334,8 @@ int main(int argc, char *argv[])
+@@ -331,6 +335,8 @@ int main(int argc, char *argv[])
int max_width = 0, w;
GIConv cvh = NULL;
GOptionGroup *options;
@@ -80,7 +81,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,130 @@ int main(int argc, char *argv[])
+@@ -348,6 +354,130 @@ int main(int argc, char *argv[])
g_option_context_add_main_entries(ctxt, entries, NULL);
#endif
@@ -211,7 +212,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 +503,8 @@ int main(int argc, char *argv[])
+@@ -374,6 +504,8 @@ int main(int argc, char *argv[])
IN = stdin;
}
title = filename_in;
@@ -220,7 +221,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 +523,10 @@ int main(int argc, char *argv[])
+@@ -392,8 +524,10 @@ int main(int argc, char *argv[])
pango_context_set_font_description (pango_context, font_description);
/* Page layout */
@@ -233,7 +234,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 +589,8 @@ int main(int argc, char *argv[])
+@@ -456,6 +590,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;
@@ -242,7 +243,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 +891,12 @@ split_text_into_paragraphs (PangoContext
+@@ -756,6 +892,12 @@ split_text_into_paragraphs (PangoContext
if (wc == (gunichar)-1)
{
fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
@@ -255,7 +256,7 @@ 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,21 +1066,32 @@ void print_postscript_header(FILE *OUT,
+@@ -925,21 +1067,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;
@@ -290,7 +291,7 @@ 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"
-@@ -961,7 +1113,7 @@ void print_postscript_header(FILE *OUT,
+@@ -961,7 +1114,7 @@ void print_postscript_header(FILE *OUT,
" pagewidth\n"
" /pagewidth pageheight def\n"
" /pageheight exch def\n"
@@ -299,7 +300,7 @@ diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
" } if\n"
" 2 dict\n"
" dup /PageSize [pagewidth pageheight] put\n"
-@@ -986,11 +1138,21 @@ void print_postscript_header(FILE *OUT,
+@@ -986,11 +1139,21 @@ void print_postscript_header(FILE *OUT,
" 90 rotate\n"
" 0 pageheight neg translate\n"
"} def\n",
diff --git a/paps-fix-build.patch b/paps-fix-build.patch
new file mode 100644
index 0000000..e77f387
--- /dev/null
+++ b/paps-fix-build.patch
@@ -0,0 +1,85 @@
+From e2180b2e1493abc2a8d1165e10bf264d50fac0ae Mon Sep 17 00:00:00 2001
+From: Akira TAGOH
+Date: Wed, 1 Mar 2023 15:24:27 +0900
+Subject: [PATCH] Fix the build issue
+
+Some code ignores a return value of g_string_free() and that causes:
+
+ignoring return value of 'gchar* g_string_free_and_steal(GString*)' declared with attribute 'warn_unused_result' [-Wunused-result]
+
+This fixes it.
+---
+ src/paps.cc | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/src/paps.cc b/src/paps.cc
+index cb48ddc..429b764 100644
+--- a/src/paps.cc
++++ b/src/paps.cc
+@@ -368,6 +368,7 @@ copy_pango_parse_enum (GType type,
+ {
+ int i;
+ GString *s = g_string_new (nullptr);
++ gchar *gstr;
+
+ for (i = 0, v = g_enum_get_value (klass, i); v;
+ i++ , v = g_enum_get_value (klass, i))
+@@ -382,10 +383,10 @@ copy_pango_parse_enum (GType type,
+ G_ENUM_CLASS_TYPE_NAME(klass),
+ s->str);
+
+- if (possible_values)
+- *possible_values = s->str;
++ gstr = g_string_free (s, possible_values ? false : true);
+
+- g_string_free (s, possible_values ? false : true);
++ if (possible_values)
++ *possible_values = gstr;
+ }
+ }
+
+@@ -1001,7 +1002,7 @@ read_file (FILE *file,
+ if (ferror (file))
+ {
+ fprintf(stderr, _("%s: Error reading file.\n"), g_get_prgname ());
+- g_string_free (inbuf, true);
++ (void) g_string_free (inbuf, true);
+ exit(1);
+ }
+ else if (bp == nullptr)
+@@ -1043,8 +1044,7 @@ read_file (FILE *file,
+ if (inbuf->len && inbuf->str[inbuf->len-1] != '\n')
+ g_string_append(inbuf, "\n");
+
+- text = inbuf->str;
+- g_string_free (inbuf, false);
++ text = g_string_free (inbuf, false);
+
+ if (encoding != nullptr && cvh != nullptr)
+ g_iconv_close(cvh);
+@@ -1671,7 +1671,11 @@ get_date()
+ fprintf(stderr, _("%1$s: Error while converting date string from '%2$s' to UTF-8.\n"),
+ g_get_prgname(), get_encoding());
+ /* Return the unconverted string. */
+- g_string_free(inbuf, false);
++ /*
++ * inbuf isn't used here, but a few memory is
++ * allocated by default. so it should be freed anyway.
++ */
++ (void) g_string_free(inbuf, true);
+ g_iconv_close(cvh);
+ return date;
+ }
+@@ -1679,8 +1683,7 @@ get_date()
+ obuffer[BUFSIZE * 6 - 1 - oblen] = 0;
+ g_string_append(inbuf, bp);
+
+- date_utf8 = inbuf->str;
+- g_string_free(inbuf, false);
++ date_utf8 = g_string_free(inbuf, false);
+ g_iconv_close(cvh);
+ }
+
+--
+2.39.2
+
diff --git a/paps-fix-cpi.patch b/paps-fix-cpi.patch
new file mode 100644
index 0000000..7bc3f61
--- /dev/null
+++ b/paps-fix-cpi.patch
@@ -0,0 +1,342 @@
+diff --git a/src/libpaps.c b/src/libpaps.c
+index b6363a7..1b80257 100644
+--- a/src/libpaps.c
++++ b/src/libpaps.c
+@@ -55,6 +55,9 @@ typedef struct {
+ double last_pos_x;
+ double scale_x;
+ double scale_y;
++ double width;
++ double height;
++ double cpi;
+ } paps_private_t;
+
+
+@@ -88,6 +91,26 @@ paps_t *paps_new()
+ }
+
+ void
++paps_set_paper_size(paps_t *paps_,
++ gdouble width,
++ gdouble height)
++{
++ paps_private_t *paps = (paps_private_t *)paps_;
++
++ paps->width = width;
++ paps->height = height;
++}
++
++void
++paps_set_cpi(paps_t *paps_,
++ gdouble cpi)
++{
++ paps_private_t *paps = (paps_private_t *)paps_;
++
++ paps->cpi = cpi;
++}
++
++void
+ paps_set_scale(paps_t *paps_,
+ gdouble scale_x,
+ gdouble scale_y)
+@@ -401,7 +424,7 @@ static void draw_contour(paps_private_t *paps,
+ FT_Face ft_face = pango_ft2_font_get_face(font);
+ int num_glyphs = glyphs->num_glyphs;
+ int glyph_idx;
+-
++
+ for (glyph_idx=0; glyph_idxglyphs[glyph_idx].geometry;
+@@ -410,7 +433,11 @@ static void draw_contour(paps_private_t *paps,
+ 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 * paps->scale_x;
++ if (paps->cpi > 0.0L) {
++ x_pos += (1 / paps->cpi * 72.0);
++ } else {
++ x_pos += geometry.width * scale * paps->scale_x;
++ }
+
+ if (glyphs->glyphs[glyph_idx].glyph == PANGO_GLYPH_EMPTY)
+ continue;
+diff --git a/src/libpaps.h b/src/libpaps.h
+index 0b74321..cbb4042 100644
+--- a/src/libpaps.h
++++ b/src/libpaps.h
+@@ -53,10 +53,16 @@ void paps_free(paps_t *paps);
+ * @param scale_y y-coordinate scale
+ *
+ */
+-void
+-paps_set_scale(paps_t *paps,
+- gdouble scale_x,
+- gdouble scale_y);
++void paps_set_scale(paps_t *paps,
++ gdouble scale_x,
++ gdouble scale_y);
++
++void paps_set_paper_size(paps_t *paps_,
++ gdouble width,
++ gdouble height);
++
++void paps_set_cpi(paps_t *paps_,
++ gdouble cpi);
+
+ /**
+ * libpaps may currently be used only with a PangoContext that it
+diff --git a/src/paps.c b/src/paps.c
+index 334d547..72dbaad 100644
+--- a/src/paps.c
++++ b/src/paps.c
+@@ -33,6 +33,8 @@
+ #include
+ #include
+ #include
++#include
++#include
+
+ #define BUFSIZE 1024
+ #define DEFAULT_FONT_FAMILY "Monospace"
+@@ -594,6 +596,8 @@ int main(int argc, char *argv[])
+ page_layout.owner = page_owner;
+ page_layout.cups_mode = cups_mode;
+
++ paps_set_paper_size(paps, page_width, page_height);
++
+ /* calculate x-coordinate scale */
+ if (page_layout.cpi > 0.0L)
+ {
+@@ -606,7 +610,7 @@ int main(int argc, char *argv[])
+ w = pango_font_metrics_get_approximate_digit_width (metrics);
+ if (w > max_width)
+ max_width = w;
+- page_layout.scale_x = 1 / page_layout.cpi * 72.0 * PANGO_SCALE / max_width;
++ page_layout.scale_x = 1 / page_layout.cpi * 72.0 * (gdouble)PANGO_SCALE / (gdouble)max_width;
+ pango_font_metrics_unref (metrics);
+ g_object_unref (G_OBJECT (fontmap));
+
+@@ -614,6 +618,8 @@ int main(int argc, char *argv[])
+ // update the font size to that width
+ pango_font_description_set_size (font_description, font_size * page_layout.scale_x);
+ pango_context_set_font_description (pango_context, font_description);
++
++ paps_set_cpi(paps, page_layout.cpi);
+ }
+
+ page_layout.scale_x = page_layout.scale_y = 1.0;
+@@ -727,119 +733,6 @@ read_file (FILE *file,
+ return text;
+ }
+
+-#if 0
+-/* Take a UTF8 string and break it into paragraphs on \n characters.
+- *
+- * Sorry. I couldn't figure out what this version was supposed to do
+- *
+- */
+-static GList *
+-split_text_into_paragraphs (PangoContext *pango_context,
+- page_layout_t *page_layout,
+- int paint_width, /* In pixels */
+- char *text)
+-{
+- char *p = text;
+- char *next;
+- gunichar wc;
+- GList *result = NULL;
+- char *last_para = text;
+-
+- while (p != NULL && *p)
+- {
+- wc = g_utf8_get_char (p);
+- next = g_utf8_next_char (p);
+- if (wc == (gunichar)-1)
+- {
+- fprintf (stderr, "%s: Invalid character in input\n", g_get_prgname ());
+- wc = 0;
+- }
+- if (!*p || !wc || wc == '\n' || wc == '\f')
+- {
+- Paragraph *para = g_new (Paragraph, 1);
+- 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 = 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");
+- exit(1);
+- }
+-
+- len = g_utf8_strlen (para->text, para->length);
+- /* 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);
+- exit(1);
+- }
+- 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");
+- exit(1);
+- }
+-
+- 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,
+- 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);
+- para->height = 0;
+-
+- if (wc == '\f')
+- para->formfeed = 1;
+- else
+- para->formfeed = 0;
+-
+- last_para = next;
+-
+- result = g_list_prepend (result, para);
+- }
+- if (!wc) /* incomplete character at end */
+- break;
+- p = next;
+- }
+-
+- return g_list_reverse (result);
+-}
+-#endif
+-
+ /* Take a UTF8 string and break it into paragraphs on \n characters
+ */
+ static GList *
+@@ -905,18 +798,85 @@ split_text_into_paragraphs (PangoContext *pango_context,
+ para->text = last_para;
+ para->length = p - last_para;
+ para->layout = pango_layout_new (pango_context);
+- // pango_layout_set_font_description (para->layout, font_description);
+- pango_layout_set_text (para->layout, para->text, para->length);
++
++ if (page_layout->cpi > 0.0L && page_layout->do_wordwrap) {
++ /* figuring out the correct width from the pango_font_metrics_get_approximate_width()
++ * is really hard and pango_layout_set_wrap() doesn't work properly then.
++ * Those are not reliable to render the characters exactly according to the given CPI.
++ * So Re-calculate the width to wrap up to be comfortable with CPI.
++ */
++ wchar_t *wtext = NULL, *wnewtext = NULL;
++ gchar *newtext = NULL;
++ gsize len, col, i, wwidth = 0;
++ PangoRectangle ink_rect, logical_rect;
++
++ wtext = (wchar_t *)g_utf8_to_ucs4(para->text, para->length, NULL, NULL, NULL);
++ if (wtext == NULL) {
++ fprintf(stderr, "%s: Unable to convert UTF-8 to UCS-4.\n", g_get_prgname());
++ fail:
++ g_free(wtext);
++ g_free(wnewtext);
++ g_free(newtext);
++ if (page_layout->cups_mode) {
++ /* try to continue parsing text */
++ p = next;
++ continue;
++ } else {
++ exit(1);
++ }
++ }
++ len = g_utf8_strlen(para->text, para->length);
++ /* the amount of characters that can be put on the line against CPI */
++ col = page_layout->column_width / 72.0 * page_layout->cpi;
++ if (len > col) {
++ /* need to wrap up them */
++ wnewtext = g_new(wchar_t, wcslen(wtext) + 1);
++ if (wnewtext == NULL) {
++ fprintf(stderr, "%s: Unable to allocate the memory.\n", g_get_prgname());
++ goto fail;
++ }
++ for (i = 0; i < len; i++) {
++ wwidth += wcwidth(wtext[i]);
++ if (wwidth > col)
++ 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, "%s: Unable to convert UCS-4 to UTF-8.\n", g_get_prgname());
++ goto fail;
++ }
++ pango_layout_set_text(para->layout, newtext, -1);
++ pango_layout_get_extents(para->layout, &ink_rect, &logical_rect);
++ paint_width = logical_rect.width / PANGO_SCALE;
++ g_free(wnewtext);
++ g_free(newtext);
++
++ para->length = i;
++ next = g_utf8_offset_to_pointer(para->text, para->length);
++ wc = g_utf8_get_char(g_utf8_prev_char(next));
++ } else {
++ pango_layout_set_text(para->layout, para->text, para->length);
++ }
++ g_free(wtext);
++
++ pango_layout_set_width(para->layout, -1);
++ } else {
++ pango_layout_set_text (para->layout, para->text, para->length);
++ 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_justify (para->layout, page_layout->do_justify);
+ pango_layout_set_alignment (para->layout,
+ page_layout->pango_dir == PANGO_DIRECTION_LTR
+ ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT);
+- 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;
+
diff --git a/paps-fix-loop-in-split.patch b/paps-fix-loop-in-split.patch
new file mode 100644
index 0000000..89bc1fc
--- /dev/null
+++ b/paps-fix-loop-in-split.patch
@@ -0,0 +1,31 @@
+From 6c3fa9959dd454938378ade2fec8e84cee7d6916 Mon Sep 17 00:00:00 2001
+From: Akira TAGOH
+Date: Tue, 27 Jul 2010 12:19:30 +0900
+Subject: [PATCH 1/2] Fix rhbz#618483: texttopaps becoms runaway memory hog
+
+ * src/paps.c (split_text_into_paragraphs): fix a infinite loop
+ when non-printable characters are in the text.
+---
+ src/paps.c | 5 ++++-
+ 1 files changed, 4 insertions(+), 1 deletions(-)
+
+ * paps.c: Erased --justify option since it is not implemented in
+diff --git a/src/paps.c b/src/paps.c
+index 72dbaad..dcef349 100644
+--- a/src/paps.c
++++ b/src/paps.c
+@@ -835,7 +835,10 @@ split_text_into_paragraphs (PangoContext *pango_context,
+ goto fail;
+ }
+ for (i = 0; i < len; i++) {
+- wwidth += wcwidth(wtext[i]);
++ gssize w = wcwidth(wtext[i]);
++
++ if (w >= 0)
++ wwidth += w;
+ if (wwidth > col)
+ break;
+ wnewtext[i] = wtext[i];
+--
+1.7.1.1
+
diff --git a/paps-fix-non-weak-symbol.patch b/paps-fix-non-weak-symbol.patch
new file mode 100644
index 0000000..8edf596
--- /dev/null
+++ b/paps-fix-non-weak-symbol.patch
@@ -0,0 +1,26 @@
+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 2012-11-23 14:22:51.506176037 +0900
++++ paps-0.6.8/src/Makefile.am 2012-11-23 14:25:41.828410416 +0900
+@@ -8,13 +8,14 @@ bin_PROGRAMS = paps
+ paps_CFLAGS = -Wall $(CUPS_CFLAGS)
+ paps_SOURCES = paps.c
+ paps_LDADD = $(lib_LTLIBRARIES) $(all_libraries)
+-paps_LDFLAGS = `pkg-config --libs pangoft2` $(CUPS_LIBS)
++paps_LDFLAGS = $(CUPS_LIBS)
+ paps_DEPENDENCIES = $(lib_LTLIBRARIES)
+
+ EXTRA_DIST = test_libpaps.c paps.1
+
+ # set the include path found by configure
+ INCLUDES= $(all_includes) `pkg-config --cflags pangoft2`
++LIBS = `pkg-config --libs pangoft2`
+
+ # Test program
+ noinst_PROGRAMS = test_libpaps
+@@ -22,6 +23,5 @@ noinst_PROGRAMS = test_libpaps
+
+ test_libpaps_SOURCES = test_libpaps.c
+ test_libpaps_LDADD = $(lib_LTLIBRARIES) $(all_libraries)
+-test_libpaps_LDFLAGS = `pkg-config --libs pangoft2`
+ test_libpaps_DEPENDENCIES = $(lib_LTLIBRARIES)
+
diff --git a/paps-fix-paper-size-truncate.patch b/paps-fix-paper-size-truncate.patch
new file mode 100644
index 0000000..90e9fcb
--- /dev/null
+++ b/paps-fix-paper-size-truncate.patch
@@ -0,0 +1,15 @@
+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 2015-04-24 11:49:53.220718394 +0900
++++ paps-0.6.8/src/paps.c 2015-04-24 11:51:30.847718394 +0900
+@@ -532,9 +532,9 @@ int main(int argc, char *argv[])
+
+ /* Page layout */
+ if (page_width < 0)
+- page_width = paper_sizes[(int)paper_type].width;
++ page_width = (paper_sizes[(int)paper_type].width + 0.5);
+ if (page_height < 0)
+- page_height = paper_sizes[(int)paper_type].height;
++ page_height = (paper_sizes[(int)paper_type].height + 0.5);
+
+ if (num_columns == 1)
+ total_gutter_width = 0;
diff --git a/paps-fix-src-to-paps.patch b/paps-fix-src-to-paps.patch
new file mode 100644
index 0000000..d18f8af
--- /dev/null
+++ b/paps-fix-src-to-paps.patch
@@ -0,0 +1,18 @@
+diff -pruN paps-0.8.0.orig/scripts/src-to-paps paps-0.8.0/scripts/src-to-paps
+--- paps-0.8.0.orig/scripts/src-to-paps 2023-02-09 16:27:38.000000000 +0900
++++ paps-0.8.0/scripts/src-to-paps 2023-03-01 15:00:27.801416563 +0900
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+
+ ######################################################################
+ # Use GNU source-hightlight to turn source code into pango markup
+@@ -49,7 +49,7 @@ def arg_if_not_none(param_name, val):
+ # Defaults
+
+ # TBD - Make this a configuration variable
+-pango_outlang_path = '/usr/local/share/paps/pango_markup.outlang'
++pango_outlang_path = '/usr/share/paps/pango_markup.outlang'
+
+ parser = argparse.ArgumentParser(description='Process a file')
+ parser.add_argument('-o', '--output',
diff --git a/paps-fix-tab-width.patch b/paps-fix-tab-width.patch
new file mode 100644
index 0000000..a1011ee
--- /dev/null
+++ b/paps-fix-tab-width.patch
@@ -0,0 +1,77 @@
+@@ -, +, @@
+---
+ src/libpaps.c | 40 +++++++++++++++++++++++++++++-----------
+ 1 file changed, 29 insertions(+), 11 deletions(-)
+--- a/src/libpaps.c
++++ a/src/libpaps.c
+@@ -251,7 +251,6 @@ gchar *paps_layout_line_to_postscript_strdup(paps_t *paps_,
+ {
+ paps_private_t *paps = (paps_private_t*)paps_;
+ GString *layout_str = g_string_new("");
+- gchar *ret_str;
+
+ add_line_to_postscript(paps,
+ layout_str,
+@@ -259,10 +258,7 @@ gchar *paps_layout_line_to_postscript_strdup(paps_t *paps_,
+ pos_y,
+ layout_line);
+
+- ret_str = layout_str->str;
+- g_string_free(layout_str, FALSE);
+-
+- return ret_str;
++ return g_string_free(layout_str, FALSE);
+ }
+
+ static void
+@@ -408,9 +404,26 @@ static void draw_contour(paps_private_t *paps,
+ {
+ GSList *runs_list;
+ double scale = 72.0 / PANGO_SCALE / PAPS_DPI;
++ PangoGlyphUnit avg_width = 1;
+
+ g_string_append(layout_str, "(");
+-
++
++ if (paps->cpi > 0.0L)
++ {
++ /* calculate approximate width per a character */
++ for (runs_list = pango_line->runs; runs_list != NULL; runs_list = g_slist_next(runs_list))
++ {
++ PangoLayoutRun *run = runs_list->data;
++ PangoGlyphString *glyphs = run->glyphs;
++ int i;
++
++ for (i = 0; i < glyphs->num_glyphs; i++)
++ {
++ if (glyphs->glyphs[i].glyph != PANGO_GLYPH_EMPTY)
++ avg_width = MAX (avg_width, glyphs->glyphs[i].geometry.width);
++ }
++ }
++ }
+ /* Loop over the runs and output font info */
+ runs_list = pango_line->runs;
+ double x_pos = line_start_pos_x;
+@@ -433,11 +446,16 @@ static void draw_contour(paps_private_t *paps,
+ glyph_pos_x = x_pos + 1.0*geometry.x_offset * scale;
+ glyph_pos_y = line_start_pos_y - 1.0*geometry.y_offset * scale;
+
+- if (paps->cpi > 0.0L) {
+- x_pos += (1 / paps->cpi * 72.0);
+- } else {
+- x_pos += geometry.width * scale * paps->scale_x;
+- }
++ if (paps->cpi > 0.0L)
++ {
++ double n = ((double)geometry.width) / avg_width;
++
++ x_pos += n * (1 / paps->cpi * 72.0);
++ }
++ else
++ {
++ x_pos += geometry.width * scale * paps->scale_x;
++ }
+
+ if (glyphs->glyphs[glyph_idx].glyph == PANGO_GLYPH_EMPTY)
+ continue;
+--
diff --git a/paps-ft-header.patch b/paps-ft-header.patch
new file mode 100644
index 0000000..f2d8a2e
--- /dev/null
+++ b/paps-ft-header.patch
@@ -0,0 +1,15 @@
+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 2014-03-20 12:10:50.000000000 +0900
++++ paps-0.6.8/src/libpaps.c 2014-03-20 12:11:54.000000000 +0900
+@@ -25,8 +25,9 @@
+
+ #include
+ #include
+-#include
+-#include
++#include
++#include FT_GLYPH_H
++#include FT_OUTLINE_H
+ #include
+ #include
+ #include
diff --git a/paps-glib282.patch b/paps-glib282.patch
new file mode 100644
index 0000000..23bd2b4
--- /dev/null
+++ b/paps-glib282.patch
@@ -0,0 +1,34 @@
+g_utf8_next_char no longer includes a cast to char* as of 2.81.0:
+
+https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4016
+
+diff -up a/src/paps.cc b/src/paps.cc
+--- a/src/paps.cc 2024-09-12 19:21:02.858439427 -0400
++++ b/src/paps.cc 2024-09-12 21:15:46.905955152 -0400
+@@ -1115,7 +1115,7 @@ split_text_into_paragraphs (PangoContext
+ while (p != nullptr && *p)
+ {
+ wc = g_utf8_get_char (p);
+- next = g_utf8_next_char (p);
++ next = (char *) g_utf8_next_char (p);
+ if (wc == (gunichar)-1)
+ {
+ fprintf (stderr, _("%s: Invalid character in input\n"), g_get_prgname ());
+@@ -1130,7 +1130,7 @@ split_text_into_paragraphs (PangoContext
+ para->length = p - last_para;
+ /* handle dos line breaks */
+ if (wc == '\r' && *next == '\n')
+- next = g_utf8_next_char(next);
++ next = (char *) g_utf8_next_char(next);
+ para->layout = pango_layout_new (pango_context);
+
+ if (page_layout->cpi > 0.0L)
+@@ -1201,7 +1201,7 @@ split_text_into_paragraphs (PangoContext
+ g_free (newtext);
+
+ para->length = i;
+- next = g_utf8_offset_to_pointer (para->text, para->length);
++ next = (char *) g_utf8_offset_to_pointer (para->text, para->length);
+ wc = g_utf8_get_char (g_utf8_prev_char (next));
+ }
+ else
diff --git a/paps.convs b/paps.convs
new file mode 100644
index 0000000..03d406a
--- /dev/null
+++ b/paps.convs
@@ -0,0 +1,8 @@
+# Use the texttopaps filter (from the paps package) in preference to
+# the texttops filter shipped as part of CUPS. This is so that we
+# have full UTF-8 support.
+#
+# To use the default CUPS texttops filter instead, remove this file
+# (or the package it belongs to).
+
+text/plain application/postscript 30 texttopaps
diff --git a/paps.spec b/paps.spec
index 9532aa5..2177152 100644
--- a/paps.spec
+++ b/paps.spec
@@ -1,104 +1,354 @@
-Name: paps
-Version: 0.6.8
-Release: 8%{?dist}
+Name: paps
+Version: 0.8.0
+Release: 14%{?dist}
-License: LGPLv2+
-URL: http://paps.sourceforge.net/
-Source0: http://prdownloads.sourceforge.net/paps/paps-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: pango-devel automake autoconf libtool doxygen cups-devel
+License: LGPL-2.0-or-later
+URL: https://github.com/dov/paps
+Source0: https://github.com/dov/paps/archive/v%{name}/%{name}-%{version}.tar.gz
+Source1: paps.convs
+Source2: 29-paps.conf
+Source3: http://downloads.sourceforge.net/%{name}/%{name}-0.6.8.tar.gz
+BuildRequires: make
+BuildRequires: pango-devel automake autoconf libtool doxygen cups-devel intltool
+BuildRequires: fmt-devel gcc-c++
## https://sourceforge.net/tracker/index.php?func=detail&aid=1832897&group_id=153049&atid=786241
-Patch0: paps-0.6.8-shared.patch
+Patch0: paps-0.6.8-shared.patch
## https://sourceforge.net/tracker/index.php?func=detail&aid=1832924&group_id=153049&atid=786241
-Patch1: paps-0.6.8-wordwrap.patch
+Patch1: paps-0.6.8-wordwrap.patch
## https://sourceforge.net/tracker/index.php?func=detail&aid=1832926&group_id=153049&atid=786241
-Patch2: paps-langinfo.patch
+Patch2: paps-langinfo.patch
## https://sourceforge.net/tracker/index.php?func=detail&aid=1832929&group_id=153049&atid=786241
-Patch3: paps-0.6.6-lcnumeric.patch
+Patch3: paps-0.6.6-lcnumeric.patch
## https://sourceforge.net/tracker/index.php?func=detail&aid=1832935&group_id=153049&atid=786241
-Patch4: paps-exitcode.patch
-Patch50: paps-cups.patch
-Patch51: paps-cpilpi.patch
-Patch52: paps-dsc-compliant.patch
-Patch53: paps-autoconf262.patch
+Patch4: paps-exitcode.patch
+## rhbz#854897
+Patch5: paps-854897-manpage.patch
+## Fedora specific patch to integrate with CUPS
+Patch50: paps-cups.patch
+Patch51: paps-cpilpi.patch
+## rhbz#424951
+Patch52: paps-dsc-compliant.patch
+Patch53: paps-autoconf262.patch
+## rhbz#524883
+Patch54: paps-fix-cpi.patch
+## rhbz#618483
+Patch55: paps-fix-loop-in-split.patch
+## rhbz#857592
+Patch56: paps-fix-tab-width.patch
+Patch57: paps-fix-non-weak-symbol.patch
+Patch58: paps-correct-fsf-address.patch
+## rhbz#1078519
+Patch59: %{name}-ft-header.patch
+## rhbz#1196997
+Patch60: %{name}-a3.patch
+## rhbz#1214939
+Patch61: %{name}-fix-paper-size-truncate.patch
+Patch62: paps-c99.patch
+Patch63: paps-0.6.8-glib282.patch
+Patch64: paps-0.6.8-ftbfs.patch
+### For paps
+Patch100: %{name}-fix-src-to-paps.patch
+Patch101: %{name}-fix-build.patch
+Patch102: %{name}-glib282.patch
-Summary: Plain Text to PostScript converter
-Group: Applications/Publishing
+Summary: Plain Text to PostScript converter
%description
paps is a PostScript converter from plain text file using Pango.
-%package libs
-Summary: Libraries for paps
-Group: Development/Libraries
-%description libs
+%package -n texttopaps
+Summary: CUPS filter based on paps
+Obsoletes: %{name}-libs < %{version}
+Obsoletes: %{name}-devel < %{version}
+Requires: cups-filesystem fontpackages-filesystem
+%description -n texttopaps
+
paps is a PostScript converter from plain text file using Pango.
-This package contains the library for paps.
+This package contains a CUPS filter based on 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
-%setup -q
-%patch0 -p1 -b .shared
-%patch1 -p1 -b .wordwrap
-%patch2 -p1 -b .langinfo
-%patch3 -p1 -b .lcnumeric
-%patch4 -p1 -b .exitcode
-%patch50 -p1 -b .cups
-%patch51 -p1 -b .cpilpi
-%patch52 -p1 -b .dsc
-%patch53 -p1 -b .autoconf262
+%setup -q -a 3
+%patch 100 -p1 -b .src-to-paps
+%patch 101 -p1 -b .build
+%patch 102 -p1 -b .glib282
+pushd %{name}-0.6.8
+%patch 0 -p1 -b .shared
+%patch 1 -p1 -b .wordwrap
+%patch 2 -p1 -b .langinfo
+%patch 3 -p1 -b .lcnumeric
+%patch 4 -p1 -b .exitcode
+%patch 5 -p1 -b .manpage
+%patch 50 -p1 -b .cups
+%patch 51 -p1 -b .cpilpi
+%patch 52 -p1 -b .dsc
+%patch 53 -p1 -b .autoconf262
+%patch 54 -p1 -b .fixcpi
+%patch 55 -p1 -b .loop
+%patch 56 -p1 -b .tab
+%patch 57 -p1 -b .weak-symbol
+%patch 58 -p1 -b .fsf
+%patch 59 -p1 -b .ft-header
+%patch 60 -p1 -b .a3
+%patch 61 -p1 -b .paper-size
+%patch 62 -p2 -b .configure-c99
+%patch 63 -p1 -b .glib282
+%patch 64 -p1 -b .ftbfs
libtoolize -f -c
-autoreconf
+autoreconf -f -i
+popd
%build
+./autogen.sh
+%set_build_flags
+%if 0%{?rhel}
+CXXFLAGS="$CXXFLAGS -DFMT_HEADER_ONLY"
+%endif
%configure --disable-static
make %{?_smp_mflags}
+pushd %{name}-0.6.8
+%configure --disable-static
+make %{?_smp_mflags}
+popd
%install
-rm -rf $RPM_BUILD_ROOT
-
-make install DESTDIR=$RPM_BUILD_ROOT
+pushd %{name}-0.6.8
+make install DESTDIR=$RPM_BUILD_ROOT INSTALL="/usr/bin/install -p"
# remove unnecessary files
rm $RPM_BUILD_ROOT%{_libdir}/libpaps.la
# make a symlink for CUPS filter
-%{__mkdir_p} $RPM_BUILD_ROOT/usr/lib/cups/filter # Not libdir
-ln -s %{_bindir}/paps $RPM_BUILD_ROOT/usr/lib/cups/filter/texttopaps
+install -d $RPM_BUILD_ROOT%{_cups_serverbin}/filter # Not libdir
+mv $RPM_BUILD_ROOT%{_bindir}/paps $RPM_BUILD_ROOT%{_cups_serverbin}/filter/texttopaps
+mv $RPM_BUILD_ROOT%{_mandir}/man1/paps.1 $RPM_BUILD_ROOT%{_mandir}/man1/texttopaps.1
-%clean
-rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_datadir}/cups/mime
+install -p -m0644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/cups/mime/
+
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/fonts/conf.d
+install -p -m0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/fonts/conf.d/
+
+rm -rf $RPM_BUILD_ROOT%{_includedir}
+rm $RPM_BUILD_ROOT%{_libdir}/libpaps.so
+popd
+
+make install DESTDIR=$RPM_BUILD_ROOT INSTALL="/usr/bin/install -p"
+
+%ldconfig_scriptlets libs
%files
-%defattr(-, root, root, -)
-%doc AUTHORS COPYING.LIB README TODO
+%doc AUTHORS COPYING.LIB README
+%dir %{_datadir}/paps
%{_bindir}/paps
+%{_bindir}/src-to-paps
+%{_datadir}/paps/pango_markup.outlang
%{_mandir}/man1/paps.1*
-/usr/lib/cups/filter/texttopaps
-%files libs
-%defattr(-, root, root, -)
-%doc COPYING.LIB
+%files -n texttopaps
+%doc %{name}-0.6.8/COPYING.LIB %{name}-0.6.8/AUTHORS %{name}-0.6.8/README
+%{_mandir}/man1/texttopaps.1*
%{_libdir}/libpaps.so.*
+%{_cups_serverbin}/filter/texttopaps
+%{_datadir}/cups/mime/paps.convs
+%{_sysconfdir}/fonts/conf.d/29-paps.conf
-%files devel
-%defattr(-, root, root, -)
-%doc COPYING.LIB
-%{_includedir}/libpaps.h
-%{_libdir}/libpaps.so
%changelog
+* Thu Jul 24 2025 Fedora Release Engineering - 0.8.0-14
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
+
+* Mon Jan 27 2025 Akira TAGOH - 0.8.0-13
+- Fix FTBFS
+ Resolves: rhbz#2341001
+
+* Fri Jan 17 2025 Fedora Release Engineering - 0.8.0-12
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
+
+* Fri Sep 13 2024 Akira TAGOH - 0.8.0-11
+- Fix build with glib 2.82
+ Patch from Yaakov Selkowitz
+
+* Thu Jul 18 2024 Fedora Release Engineering - 0.8.0-10
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
+
+* Fri Jun 7 2024 Akira TAGOH - 0.8.0-9
+- Own /usr/share/paps
+ Resolves: rhbz#2283284
+
+* Thu Jan 25 2024 Fedora Release Engineering - 0.8.0-8
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
+
+* Sun Jan 21 2024 Fedora Release Engineering - 0.8.0-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
+
+* Wed Jan 17 2024 Akira TAGOH - 0.8.0-6
+- Fix C type error in paps 0.6.8.
+ Resolves: rhbz#2256906
+
+* Mon Aug 14 2023 Yaakov Selkowitz - 0.8.0-5
+- Use fmt in header-only mode in RHEL builds
+
+* Thu Jul 20 2023 Fedora Release Engineering - 0.8.0-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
+
+* Wed Jun 28 2023 Vitaly Zaitsev - 0.8.0-3
+- Rebuilt due to fmt 10 update.
+
+* Thu Apr 13 2023 Florian Weimer - 0.8.0-2
+- C99 compatibility fixes for paps 0.6.8
+
+* Wed Mar 1 2023 Akira TAGOH - 0.8.0-1
+- New upstream release.
+ Resolves: rhbz#2168726
+
+* Tue Feb 7 2023 Akira TAGOH - 0.7.9-1
+- New upstream release.
+ Resolves: rhbz#2164212
+
+* Thu Jan 19 2023 Fedora Release Engineering - 0.7.1-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
+
+* Mon Dec 5 2022 Akira TAGOH - 0.7.1-6
+- Convert License tag to SPDX.
+
+* Fri Jul 22 2022 Fedora Release Engineering - 0.7.1-5
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
+
+* Thu Jan 20 2022 Fedora Release Engineering - 0.7.1-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
+
+* Thu Jul 22 2021 Fedora Release Engineering - 0.7.1-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
+
+* Tue Jan 26 2021 Fedora Release Engineering - 0.7.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
+
+* Thu Oct 8 2020 Akira TAGOH - 0.7.1-1
+- New upstream release.
+ Resolves: rhbz#1254352
+- Sub-package texttopaps with old code.
+
+* Tue Jul 28 2020 Fedora Release Engineering - 0.6.8-46
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
+
+* Wed Jan 29 2020 Fedora Release Engineering - 0.6.8-45
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
+
+* Fri Jul 26 2019 Fedora Release Engineering - 0.6.8-44
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
+
+* Fri Feb 01 2019 Fedora Release Engineering - 0.6.8-43
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
+
+* Fri Jul 13 2018 Fedora Release Engineering - 0.6.8-42
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
+
+* Thu Feb 08 2018 Fedora Release Engineering - 0.6.8-41
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
+
+* Sat Jan 20 2018 Björn Esser - 0.6.8-40
+- Rebuilt for switch to libxcrypt
+
+* Thu Aug 03 2017 Fedora Release Engineering - 0.6.8-39
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
+
+* Thu Jul 27 2017 Fedora Release Engineering - 0.6.8-38
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Sat Feb 11 2017 Fedora Release Engineering - 0.6.8-37
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+
+* Thu Feb 04 2016 Fedora Release Engineering - 0.6.8-36
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Thu Jun 18 2015 Fedora Release Engineering - 0.6.8-35
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
+
+* Fri Apr 24 2015 Akira TAGOH - 0.6.8-34
+- Fix wrong paper size due to the integer cast.
+
+* Mon Mar 2 2015 Akira TAGOH - 0.6.8-33
+- Support A3 paper size.
+
+* Sat Feb 21 2015 Till Maas - 0.6.8-32
+- Rebuilt for Fedora 23 Change
+ https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
+
+* Fri Oct 31 2014 Akira TAGOH - 0.6.8-31
+- Add a fontconfig config to force the scalable font.
+
+* Sun Aug 17 2014 Fedora Release Engineering - 0.6.8-30
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
+
+* Fri Jun 06 2014 Fedora Release Engineering - 0.6.8-29
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+
+* Thu Mar 20 2014 Akira TAGOH - 0.6.8-28
+- Fix FTBFS against freetype's header files location change. (#1078519)
+
+* Mon Dec 16 2013 Akira TAGOH - 0.6.8-27
+- Move the place of paps.convs to %%{_datadir}/cups/mime. (#1042984)
+
+* Wed Jul 31 2013 Akira TAGOH - 0.6.8-26
+- Fix the width calculation with CPI enabled. (#990228)
+
+* Thu Apr 18 2013 Akira TAGOH - 0.6.8-25
+- Rebuilt for aarch64 support. (#926309)
+
+* Thu Feb 14 2013 Fedora Release Engineering - 0.6.8-24
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
+
+* Fri Nov 23 2012 Akira TAGOH - 0.6.8-23
+- the spec file cleanup
+- Fix the undefined symbol issue in libpaps.so.0
+- Correct FSF address in the COPYING.LIB
+
+* Mon Sep 24 2012 Akira TAGOH - 0.6.8-22
+- Ensure the latest version of paps-libs are installed.
+
+* Fri Sep 21 2012 Akira TAGOH - 0.6.8-21
+- Fix wrong width for whitespaces when enabling CPI feature. (#857592)
+
+* Thu Sep 6 2012 Akira TAGOH - 0.6.8-20
+- Add a missing description of --encoding in manpage. (#854897)
+
+* Fri Jul 20 2012 Fedora Release Engineering - 0.6.8-19
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Wed Jan 11 2012 Akira TAGOH - 0.6.8-18
+- Use %%{_cups_serverbin} instead of the hardcoded path. (#772240)
+
+* Mon Dec 5 2011 Akira TAGOH - 0.6.8-17
+- Add ldconfig in %%post/%%postun for paps-libs (#759880)
+
+* Fri Jun 24 2011 Akira TAGOH - 0.6.8-16
+- Fix FTBFS issue. (#716211)
+
+* Tue Feb 08 2011 Fedora Release Engineering - 0.6.8-15
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+
+* Tue Jul 27 2010 Akira TAGOH - 0.6.8-14
+- Fix the infinite loop in splitting paragraphs (#618483)
+
+* Fri Mar 12 2010 Akira TAGOH - 0.6.8-13
+- Fix the directory's group ownership. (#572733)
+
+* Tue Dec 8 2009 Akira TAGOH - 0.6.8-12
+- Add paps.convs to behaves the cups filter without the hardcoded thing
+ in cups. (#545031)
+
+* Wed Oct 14 2009 Akira TAGOH - 0.6.8-11
+- Fix code that deal with CPI parameter to be accurate. (#524883)
+
+* Sat Jul 25 2009 Fedora Release Engineering - 0.6.8-10
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Thu Feb 26 2009 Fedora Release Engineering - 0.6.8-9
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
* Mon Nov 17 2008 Akira TAGOH - 0.6.8-8
- Courier font to be a default font for texttopaps. (#469325)
@@ -155,7 +405,7 @@ rm -rf $RPM_BUILD_ROOT
- Fix PostScript breakage following the non-monetary numeric format from
current locale. (#231916)
-* Thu Mar 7 2007 Akira TAGOH - 0.6.6-18
+* Wed Mar 7 2007 Akira TAGOH - 0.6.6-18
- default to lpi=6 and cpi=10 if paps is bringing up as cups filter. (#223862)
* Tue Jan 23 2007 Akira TAGOH
diff --git a/plans/basic.fmf b/plans/basic.fmf
new file mode 100644
index 0000000..c1627f9
--- /dev/null
+++ b/plans/basic.fmf
@@ -0,0 +1,5 @@
+summary: Basic smoke test
+discover:
+ how: fmf
+execute:
+ how: tmt
diff --git a/sources b/sources
index a9fd861..fcb89c4 100644
--- a/sources
+++ b/sources
@@ -1 +1,2 @@
-e9508132bf27609bf2fded2bfd9cb3f1 paps-0.6.8.tar.gz
+SHA512 (paps-0.6.8.tar.gz) = db657d90179e11fe42bbcdbebe09a84f1927c99d0b539c9e29b66b3cb8ffcf33ff500c9d81835ae5a0880382bf8f24801f04742517b76b8e005b125a139d8bba
+SHA512 (paps-0.8.0.tar.gz) = 33afad0e3dae9cef0fb3afb9994650bf1a7326e72782346e05ab91f7c84f092145247658cdf57868105df47a1bd08e1a961c1ef4c07a2a8fd01eaf8ecd9d948a
diff --git a/tests/basic/main.fmf b/tests/basic/main.fmf
new file mode 100644
index 0000000..d9d7de5
--- /dev/null
+++ b/tests/basic/main.fmf
@@ -0,0 +1,5 @@
+summary: Basic test
+require:
+ - paps
+test: ./test.sh
+framework: beakerlib
diff --git a/tests/basic/test.sh b/tests/basic/test.sh
new file mode 100755
index 0000000..e07c777
--- /dev/null
+++ b/tests/basic/test.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+rlJournalStart
+ rlPhaseStartSetup
+ rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+ rlRun "pushd $tmp"
+ rlRun "set -o pipefail"
+ rlPhaseEnd
+
+ rlPhaseStartTest
+ rlRun "paps --help | tee output" 0 "Check help message"
+ rlAssertGrep "paps" "output"
+ rlPhaseEnd
+
+ rlPhaseStartCleanup
+ rlRun "popd"
+ rlRun "rm -r $tmp" 0 "Remove tmp directory"
+ rlPhaseEnd
+rlJournalEnd