recognize fractial numbers in PageSize (backport from upstream)

This commit is contained in:
Zdenek Dohnal 2020-05-26 13:44:53 +02:00
parent 17ea54f0c4
commit c2a5cfd462
2 changed files with 50 additions and 6 deletions

View File

@ -0,0 +1,41 @@
From 75de02d9065b6280482d7cd011e9462badb19f83 Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruenba@redhat.com>
Date: Thu, 30 Jan 2020 23:08:23 +0100
Subject: [PATCH] Recognize fractional numbers in PageSize
Right now, fractional numbers (fractional pt sizes) aren't allowed in
PageSize values even though they are perfectly fine in PPD files. In
contrast, the values foomatic puts into the *ImageableArea and
*PaperDimension definitions it generates are fractional. So allow
fractional numbers in PageSize values as well.
---
lib/Foomatic/DB.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/Foomatic/DB.pm b/lib/Foomatic/DB.pm
index 90389b3..39739aa 100644
--- a/lib/Foomatic/DB.pm
+++ b/lib/Foomatic/DB.pm
@@ -5533,7 +5533,7 @@ sub getppd ( $ $ $ ) {
# option.
my $size = $v->{'driverval'};
if ($size =~ /([\d\.]+)x([\d\.]+)([a-z]+)\b/) {
- # 2 positive integers separated by
+ # 2 positive numbers separated by
# an 'x' with a unit
my $w = $1;
my $h = $2;
@@ -5551,8 +5551,8 @@ sub getppd ( $ $ $ ) {
$w = sprintf("%.2f", $w) if $w =~ /\./;
$h = sprintf("%.2f", $h) if $h =~ /\./;
$size = "$w $h";
- } elsif (($size =~ /(\d+)[x\s]+(\d+)/) ||
- # 2 positive integers separated by
+ } elsif (($size =~ /([\d\.]+)[x\s]+([\d\.]+)/) ||
+ # 2 positive numbers separated by
# whitespace or an 'x'
($size =~ /\-dDEVICEWIDTHPOINTS\=(\d+)\s+\-dDEVICEHEIGHTPOINTS\=(\d+)/)) {
# "-dDEVICEWIDTHPOINTS=..."/"-dDEVICEHEIGHTPOINTS=..."
--
2.25.4

View File

@ -1,18 +1,16 @@
Summary: Tools for using the foomatic database of printers and printer drivers
Name: foomatic
Version: 4.0.13
Release: 10%{?dist}
Release: 11%{?dist}
License: GPLv2+
# printer-filters package has gone (bug #967316, bug #1035450).
Obsoletes: printer-filters < 1.1-8
Provides: printer-filters = 1.1-8
# The database engine.
Source0: http://www.openprinting.org/download/foomatic/foomatic-db-engine-%{version}.tar.gz
## PATCHES FOR FOOMATIC-DB-ENGINE (PATCHES 101 TO 200)
Patch101: foomatic-manpages.patch
Patch101: foomatic-manpages.patch
# backported from upstream https://github.com/OpenPrinting/foomatic-db-engine/commit/75de02d
Patch102: 0001-Recognize-fractional-numbers-in-PageSize.patch
## PATCHES FOR FOOMATIC-DB-HPIJS (PATCHES 201 TO 300)
@ -64,6 +62,8 @@ The site http://www.linuxprinting.org/ is based on this database.
# Ship more manpages.
%patch101 -p1 -b .manpages
# backported from upstream https://github.com/OpenPrinting/foomatic-db-engine/commit/75de02d
%patch102 -p1 -b .pagesize-fract
chmod a+x mkinstalldirs
@ -141,6 +141,9 @@ exit 0
%{_var}/cache/foomatic
%changelog
* Tue May 26 2020 Zdenek Dohnal <zdohnal@redhat.com> - 4.0.13-11
- recognize fractial numbers in PageSize (backport from upstream)
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.13-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild