Sync from SUSE:SLFO:Main paps revision a91e903d9e47f379657cadea0d19cb58

This commit is contained in:
Adrian Schröter 2025-02-07 18:33:41 +01:00
commit bd384bc43c
7 changed files with 384 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

43
71.patch Normal file
View File

@ -0,0 +1,43 @@
From e6ec698be127822661e31f7fca7d2e0107944b24 Mon Sep 17 00:00:00 2001
From: Yaakov Selkowitz <yselkowi@redhat.com>
Date: Tue, 17 Sep 2024 13:58:46 -0400
Subject: [PATCH] Fix build with glib 2.82
g_utf8_next_char no longer includes a cast to char* as of this change:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4016
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
src/paps.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/src/paps.cc
+++ b/src/paps.cc
@@ -1129,7 +1129,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 ());
@@ -1144,7 +1144,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)
@@ -1215,7 +1215,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

12
no-python2.patch Normal file
View File

@ -0,0 +1,12 @@
---
scripts/src-to-paps | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/scripts/src-to-paps
+++ b/scripts/src-to-paps
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
######################################################################
# Use GNU source-hightlight to turn source code into pango markup

BIN
paps-0.8.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

140
paps-header_features.patch Normal file
View File

@ -0,0 +1,140 @@
---
src/paps.1 | 12 ++++++++++++
src/paps.cc | 28 +++++++++++++++++++++-------
2 files changed, 33 insertions(+), 7 deletions(-)
--- a/src/paps.1
+++ b/src/paps.1
@@ -300,6 +300,18 @@ Sets the formatting for the center of th
Use \fItext\fR as the title string for page header. By default the input
filename or "stdin" is used.
.TP
+.B \-\-header\-font=desc
+Set the header font description. Default is Monospace Bold 12.
+.TP
+.B \-\-header\-date\-format=fmt
+Set the header date format. Default is %c (see
+.BR strftime (3)).
+.TP
+.B \-\-header\-rule\-thickness=val
+Set the thickness of the header separation rule. Default is 0 (i.e. as thin as possible).
+Note that this depends on
+.BR \-\-separation\-lines .
+.TP
.B \-\-markup
Interpret input as pango markup. Pango Text Attribute Markup Language allows
marking parts of the text with tags defining additional attributes such as font
--- a/src/paps.cc
+++ b/src/paps.cc
@@ -71,6 +71,8 @@ using namespace fmt;
#define DEFAULT_FONT_SIZE "12"
#define HEADER_FONT_FAMILY "Monospace Bold"
#define HEADER_FONT_SCALE "12"
+#define HEADER_DATE_FORMAT "%c"
+#define HEADER_RULE_THICKNESS 0.1
#define MAKE_FONT_NAME(f,s) f " " s
/*
@@ -155,6 +157,8 @@ struct PageLayout {
char* footer_center = nullptr;
char* footer_right = nullptr;
string header_font_desc;
+ string header_date_format;
+ gdouble header_rule_thickness;
gdouble lpi;
gdouble cpi;
dict_t document_info;
@@ -234,7 +238,7 @@ copy_pango_parse_enum (GType type,
char **possible_values);
static char* get_encoding(void);
-string get_date();
+string get_date(PageLayout *page_layout);
string fn_basename(const string& filename);
FILE *output_fh;
@@ -581,6 +585,9 @@ int main(int argc, char *argv[])
int gutter_width = 40;
gboolean do_fatal_warnings = false;
const gchar *font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE);
+ const gchar *header_font_desc = MAKE_FONT_NAME (HEADER_FONT_FAMILY, HEADER_FONT_SCALE);
+ const gchar *header_date_format = HEADER_DATE_FORMAT;
+ gdouble header_rule_thickness = HEADER_RULE_THICKNESS;
gchar *encoding = nullptr;
gchar *output = nullptr;
gchar *htitle = nullptr;
@@ -597,6 +604,12 @@ int main(int argc, char *argv[])
N_("Landscape output. (Default: portrait)"), nullptr},
{"columns", 0, 0, G_OPTION_ARG_INT, &num_columns,
N_("Number of columns output. (Default: 1)"), "NUM"},
+ {"header-font", 0, 0, G_OPTION_ARG_STRING, &header_font_desc,
+ N_("Set the header font description. (Default: Monospace Bold 12)"), "DESC"},
+ {"header-date-format", 0, 0, G_OPTION_ARG_STRING, &header_date_format,
+ N_("Set the header date format. (Default: %%c)"), "DESC"},
+ {"header-rule-thickness", 0, 0, G_OPTION_ARG_DOUBLE, &header_rule_thickness,
+ N_("Set the thickness of the header separation rule. (Default: 0 (i.e. as thin as possible))"), "DESC"},
{"font", 0, 0, G_OPTION_ARG_STRING, &font,
N_("Set font. (Default: Monospace 12)"), "DESC"},
{"output", 'o', 0, G_OPTION_ARG_STRING, &output,
@@ -686,7 +699,6 @@ int main(int argc, char *argv[])
double page_height = paper_sizes[0].height;
int do_tumble = -1; /* -1 means not initialized */
int do_duplex = -1;
- const gchar *header_font_desc = MAKE_FONT_NAME (HEADER_FONT_FAMILY, HEADER_FONT_SCALE);
const gchar *filename_in;
gchar *text;
/* int header_sep = 20; */
@@ -908,6 +920,8 @@ int main(int argc, char *argv[])
else
page_layout.title = fn_basename(filename_in);
page_layout.header_font_desc = header_font_desc;
+ page_layout.header_date_format = header_date_format;
+ page_layout.header_rule_thickness = header_rule_thickness;
/* calculate x-coordinate scale */
if (page_layout.cpi > 0.0L)
@@ -1641,7 +1655,7 @@ draw_line_to_page(cairo_t *cr,
* Provide date string from current locale converted to UTF-8.
*/
string
-get_date()
+get_date(PageLayout *page_layout)
{
time_t t = time(nullptr);
GIConv cvh = nullptr;
@@ -1653,7 +1667,7 @@ get_date()
if (date_utf8 == nullptr) {
char date[256];
t = time(nullptr);
- strftime(date, sizeof(date), "%c", localtime(&t));
+ strftime(date, sizeof(date), page_layout->header_date_format.c_str(), localtime(&t));
cvh = g_iconv_open("UTF-8", get_encoding());
if (cvh == (GIConv)-1) {
@@ -1715,7 +1729,7 @@ draw_page_header_line_to_page(cairo_t
"<span font_desc=\"{}\">{}</span>\n"
"<span font_desc=\"{}\">{}</span>",
page_layout->header_font_desc,
- get_date().c_str(),
+ get_date(page_layout).c_str(),
page_layout->header_font_desc,
page_layout->title.c_str(),
page_layout->header_font_desc,
@@ -1739,7 +1753,7 @@ draw_page_header_line_to_page(cairo_t
if (page_layout->header_left)
header_parts[0]=page_layout->header_left;
else
- header_parts[0]=get_date();
+ header_parts[0]=get_date(page_layout);
if (page_layout->header_center)
header_parts[1] = page_layout->header_center;
@@ -1824,7 +1838,7 @@ draw_page_header_line_to_page(cairo_t
line_pos += logical_rect.height/2.0/PANGO_SCALE;
cairo_move_to(cr, page_layout->left_margin, line_pos);
cairo_line_to(cr,page_layout->page_width - page_layout->right_margin, line_pos);
- cairo_set_line_width(cr,0.1); // TBD
+ cairo_set_line_width(cr, page_layout->header_rule_thickness); // TBD
cairo_stroke(cr);
}

93
paps.changes Normal file
View File

@ -0,0 +1,93 @@
-------------------------------------------------------------------
Thu Jan 23 18:28:21 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Add missing python-rpm-macros BR.
-------------------------------------------------------------------
Thu Jan 23 15:41:45 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Add no-python2.patch to remove Python 2 shebangs, so they dont
create false Requires (gh#dov/paps!75).
-------------------------------------------------------------------
Wed Jan 22 12:20:45 UTC 2025 - Dominique Leuenberger <dimstar@opensuse.org>
- Fix shebangs of binaries: src-to-paps referenced /usr/bin/python,
which is python2.
-------------------------------------------------------------------
Wed Sep 18 08:59:21 UTC 2024 - Dr. Werner Fink <werner@suse.de>
- Update to paps 0.8.0
* Fixed minor bugs from 0.7.9
* Fixed bug when using markup with char mapping and visible wrap marker.
* Added src-to-paps preprocessor scripts for conversion of source code
to paps through GNU Highlight.
* Switch to C++17
* The header and footers are now modifiable by a syntax borrowed from
python and the fmt library. E.g. the following command line shows
what is possible:
paps --header-left="{now:%Y-%m-%d %H:%M}" --header-center="{path}" \
--header-right="Page {page_idx:02d}/{num_pages:02d}" --header -o hello.pdf paps.cc
* Add separation line option
- Remove patches now upstream
* paps-cpi_scale_calculation.patch
* paps-glib.patch
* paps-gutter-width.patch
* paps-layout.patch
* paps-manpage_fixes.patch
* paps-manpage_units.patch
* paps-page_setup.patch
- Port patch paps-header_features.patch
- Add 71.patch to fix build with glib 2.82
-------------------------------------------------------------------
Thu Feb 29 14:54:23 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Use %patch -P N instead of deprecated %patchN.
-------------------------------------------------------------------
Mon Feb 7 10:22:43 UTC 2022 - Dr. Werner Fink <werner@suse.de>
- For iconv glibc-locale should be installed
-------------------------------------------------------------------
Fri Dec 4 13:37:59 UTC 2020 - Dr. Werner Fink <werner@suse.de>
- Add patch paps-header_features.patch which combines three
patches to be able to change header font, date, and rule
thickness
-------------------------------------------------------------------
Wed Oct 7 13:30:36 UTC 2020 - Dr. Werner Fink <werner@suse.de>
- Update to paps 0.7.1
* Added initial meson compilation support.
* Minor accumulated bug fixes since 0.7.0
- Drop patch paps-prog_cc_c_o.patch as now solved upstream
-------------------------------------------------------------------
Mon May 13 07:29:44 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Add patch paps-glib.patch to amke it build again ... seems to be
a problem with the actuial linker as it ignores dependencies of
the already specified libraries.
-------------------------------------------------------------------
Tue Dec 5 16:30:16 UTC 2017 - werner@suse.de
- Add patch paps-layout.patch as a try to get page layout to
something useful
-------------------------------------------------------------------
Tue Dec 5 15:00:23 UTC 2017 - werner@suse.de
- Initial version paps from https://github.com/dov/paps master (was 37e6ca1)
- Add patches
paps-prog_cc_c_o.patch to silent auto tools
paps-cpi_scale_calculation.patch avoid possible miscalculated scale
paps-manpage_units.patch make clear we are using points
paps-manpage_fixes.patch for better understanding
paps-gutter-width.patch enable to set gutter when printing multiple columns
paps-page_setup.patch help modern PS viewers with page setup

70
paps.spec Normal file
View File

@ -0,0 +1,70 @@
#
# spec file for package paps
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: paps
Version: 0.8.0
Release: 0
Summary: A text to postscript converter through pango
License: LGPL-2.0-only
Group: System/Base
URL: https://github.com/dov/paps
Source: https://github.com/dov/paps/releases/download/v%{version}/%{name}-%{version}.tar.gz
Patch0: paps-header_features.patch
Patch1: 71.patch
# PATCH-FIX-UPSTREAM no-python2.patch gh#dov/paps!75 mcepl@suse.com
# Remove dependency on python 2
Patch2: no-python2.patch
BuildRequires: gcc-c++
BuildRequires: intltool
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(fmt)
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(pangocairo)
BuildRequires: pkgconfig(pangoft2)
BuildRequires: rpm_macro(meson)
Requires: glibc-locale
%define add_optflags(a:f:t:p:w:W:d:g:O:A:C:D:E:H:i:M:n:P:U:u:l:s:X:B:I:L:b:V:m:x:c:S:E:o:v:) \
%global optflags %{optflags} %{**}
%description
paps is a command line program for converting Unicode text encoded in UTF-8 to postscript and pdf by using pango.
%prep
%setup -qT -b0 -n %{name}-%{version}
%autopatch -p1
%build
%add_optflags -D_XOPEN_SOURCE
%meson
%meson_build
%install
%meson_install
%python3_fix_shebang
%files
%defattr(-,root,root)
%license COPYING.LIB
%{_bindir}/*
%{_mandir}/*/*
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/pango_markup.outlang
%changelog