set the page size for A4 correctly in ESC/Page driver

Resolves: rhbz#2164613
This commit is contained in:
Richard Lescak 2023-02-02 18:18:43 +01:00
parent a89e0b7920
commit 8112764a41
2 changed files with 29 additions and 2 deletions

View File

@ -0,0 +1,22 @@
diff -x .git -Napur ghostscript-9.27.old/contrib/japanese/gdevespg.c ghostscript-9.27.new/contrib/japanese/gdevespg.c
--- ghostscript-9.27.old/contrib/japanese/gdevespg.c 2019-04-04 00:43:14.000000000 -0700
+++ ghostscript-9.27.new/contrib/japanese/gdevespg.c 2023-01-24 11:25:32.588189093 -0800
@@ -273,6 +273,9 @@
int width, height, w, h, wp, hp, bLandscape;
EpagPaperTable *pt;
+ /* Page size match tolerance in points */
+ #define TOL 5
+
width = (int)pdev->MediaSize[0];
height = (int)pdev->MediaSize[1];
@@ -291,7 +294,7 @@
}
for (pt = epagPaperTable; pt->escpage > 0; pt++)
- if (pt->width == w && pt->height == h)
+ if (abs(w - pt->width) <= TOL && abs(h - pt->height) <= TOL)
break;
gp_fprintf(fp, "%c%d", GS, pt->escpage);

View File

@ -42,7 +42,7 @@
Name: ghostscript
Summary: Interpreter for PostScript language & PDF
Version: 9.54.0
Release: 8%{?dist}
Release: 9%{?dist}
License: AGPLv3+
@ -107,6 +107,7 @@ Patch003: ghostscript-9.54.0-covscan-fixes.patch
#2049767 - CVE-2021-45949 heap-based buffer overflow in sampled_data_finish
Patch004: ghostscript-9.54.0-Fix-op-stack-management-in-sampled_data_c.patch
Patch005: ghostscript-9.54.0-Deal-with-different-VM-modes-during-CIDFont-loading.patch
Patch006: ghostscript-9.54.0-ESC-Page-driver-does-not-set-page-size-correctly.patch
# Downstream patches -- these should be always included when doing rebase:
# ------------------
@ -440,7 +441,11 @@ done
# =============================================================================
%changelog
* Fri Dec 9 2022 Richard Lescak <rlescak@redhat.com> - 9.54.0-8
* Thu Feb 02 2023 Richard Lescak <rlescak@redhat.com> - 9.54.0-9
- set the page size for A4 correctly in ESC/Page driver
- Resolves: rhbz#2164613
* Fri Dec 09 2022 Richard Lescak <rlescak@redhat.com> - 9.54.0-8
- fix loading of CIDFonts (#2138795)
* Thu Feb 24 2022 Richard Lescak <rlescak@redhat.com> - 9.54.0-7