Fix Fontmap.GS lookup path for Helvetica-Narrow-Bold-Oblique

Related changes:
    * ghostscript-9.20-runlibfileifexists.patch removed (conflicted with
      new patch below)
    * ghostscript-9.22-fix-Fontmap.GS.patch added (accepted by upstream,
      will be part of ghostscript-9.23 release)
    * CIDFnmap & cidfmap deleted (conflicted with path above)
    * specfile updated as necessary

  Resolves: #1517518
This commit is contained in:
David Kaspar [Dee'Kej] 2017-12-04 13:07:08 +01:00
parent 9e34e70229
commit 870696a1b1
5 changed files with 69 additions and 135 deletions

View File

@ -1,9 +0,0 @@
%!
% following lines are for CJK fonts.
(CIDFnmap.ja) .runlibfileifexists
(CIDFnmap.ko) .runlibfileifexists
(CIDFnmap.zh_CN) .runlibfileifexists
(CIDFnmap.zh_TW) .runlibfileifexists
% must be at the bottom of line to allow people overriding everything.
(CIDFnmap.local) .runlibfileifexists

10
cidfmap
View File

@ -1,10 +0,0 @@
%!
% Don't change following line. We should ensure that the original one is surely loaded.
(cidfmap.GS) .runlibfile
% following lines are for CJK fonts.
(cidfmap.ja) .runlibfileifexists
(cidfmap.ko) .runlibfileifexists
(cidfmap.zh_CN) .runlibfileifexists
(cidfmap.zh_TW) .runlibfileifexists
% must be at the bottom of line to allow people overriding everything.
(cidfmap.local) .runlibfileifexists

View File

@ -1,93 +0,0 @@
From ea8addd686889af76d70031998680196913243ec Mon Sep 17 00:00:00 2001
From: "David Kaspar [Dee'Kej]" <dkaspar@redhat.com>
Date: Fri, 7 Oct 2016 12:20:29 +0200
Subject: [PATCH 1/2] Fix error when using ImageMagick's convert:
Error: /undefined in .runlibfileexists
---
Resource/Init/gs_fonts.ps | 15 ++++++++++++---
Resource/Init/gs_init.ps | 9 +++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/Resource/Init/gs_fonts.ps b/Resource/Init/gs_fonts.ps
index a3da615..77814b8 100644
--- a/Resource/Init/gs_fonts.ps
+++ b/Resource/Init/gs_fonts.ps
@@ -96,10 +96,19 @@ userdict /.nativeFontmap .FontDirectory maxlength dict put
% stack: dict file fontname filename|aliasname
1 index type /stringtype eq
1 index type /nametype eq and 1 index xcheck and
- 1 index /run eq 2 index /.runlibfile eq or and {
+ 1 index /run eq 2 index /.runlibfile eq 3 index /.runlibfileifexists eq or or and {
% This is an inclusion entry.
- pop findlibfile { exch pop } { file } ifelse
- 2 index exch .readFontmap pop
+ 0 index /.runlibfileifexists eq {
+ pop findlibfile {
+ exch pop
+ 2 index exch .readFontmap pop
+ } {
+ pop
+ } ifelse
+ } {
+ pop findlibfile { exch pop } { file } ifelse
+ 2 index exch .readFontmap pop
+ } ifelse
} {
% This is a real entry.
% Read and pop tokens until a semicolon.
diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps
index ab7cfed..f9e035b 100644
--- a/Resource/Init/gs_init.ps
+++ b/Resource/Init/gs_init.ps
@@ -689,6 +689,14 @@ systemdict /internaldict dup .makeinternaldict .makeoperator
{ /undefinedfilename signalerror }
ifelse
} bind def
+/runlibfileifexists
+ { % We don't want to bind 'run' into this procedure,
+ % since run may get redefined.
+ findlibfile
+ { exch pop /run .systemvar exec }
+ { pop }
+ ifelse
+ } bind def
/selectdevice
{ finddevice setdevice .setdefaultscreen } bind def
/signalerror % <object> <errorname> signalerror -
@@ -857,6 +865,7 @@ userdict /.currentresourcefile //null put
} bind def
% Temporarily substitute it for the real runlibfile.
/.runlibfile /runlibfile load def
+/.runlibfileifexists /runlibfileifexists load def
/runlibfile /runlibfile0 load def
% Create the error handling machinery.
--
2.7.4
From 9878f41a229c67aba2e62ee7ab22ff37c2e5a04f Mon Sep 17 00:00:00 2001
From: "David Kaspar [Dee'Kej]" <dkaspar@redhat.com>
Date: Fri, 7 Oct 2016 12:57:06 +0200
Subject: [PATCH 2/2] Make sure customizations to
/etc/ghostscript/Fontmap.local are used
For more info, see: https://bugzilla.redhat.com/show_bug.cgi?id=610301
---
Resource/Init/Fontmap | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Resource/Init/Fontmap b/Resource/Init/Fontmap
index ae5af96..72aeb1f 100644
--- a/Resource/Init/Fontmap
+++ b/Resource/Init/Fontmap
@@ -2,3 +2,5 @@
% See Fontmap.GS for the syntax of real Fontmap files.
%% Replace 1 (Fontmap.GS)
(Fontmap.GS) .runlibfile
+% must be at the bottom of line to allow people overriding everything.
+(Fontmap.local) .runlibfileifexists
--
2.7.4

View File

@ -0,0 +1,63 @@
From efc24229b0ba4b2f6a39fe89a4c9c576dbe7e124 Mon Sep 17 00:00:00 2001
From: "David Kaspar [Dee'Kej]" <dkaspar@redhat.com>
Date: Mon, 27 Nov 2017 10:30:52 +0100
Subject: [PATCH] Bug 698784: Fix the alias for Helvetica-Narrow-Bold-Oblique
Init/Fontmap.GS:
There was a misalignment between the filename of the
NimbusSansNarrow-BdOblique and its /Fontname in the T1 font itself.
Filename: NimbusSansNarrow-BdOblique
/Fontname: /NimbusSansNarrow-BoldOblique
This worked correctly if the fonts were located directly in
/usr/share/ghostcript/Resources/Font folder on the filesystem.
However, on Fedora we are using /usr/share/fonts/urw-base35/ folder,
which is part of Ghostscript's Search Path. In this case it was
causing the Ghostscript being unable to locate the correct font, thus
crashing while opening any document containing Helvetica Narrow Bold
Oblique font...
*In addition*, rename the font file so it matches.
---
...busSansNarrow-BdOblique => NimbusSansNarrow-BoldOblique} | Bin
Resource/Init/Fontmap.GS | 2 +-
psi/psromfs.mak | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
rename Resource/Font/{NimbusSansNarrow-BdOblique => NimbusSansNarrow-BoldOblique} (100%)
diff --git a/Resource/Font/NimbusSansNarrow-BdOblique b/Resource/Font/NimbusSansNarrow-BoldOblique
similarity index 100%
rename from Resource/Font/NimbusSansNarrow-BdOblique
rename to Resource/Font/NimbusSansNarrow-BoldOblique
diff --git a/Resource/Init/Fontmap.GS b/Resource/Init/Fontmap.GS
index 7770c67..cbda218 100644
--- a/Resource/Init/Fontmap.GS
+++ b/Resource/Init/Fontmap.GS
@@ -96,7 +96,7 @@
/Helvetica-Bold /NimbusSans-Bold ;
/Helvetica-BoldOblique /NimbusSans-BoldItalic ;
/Helvetica-Narrow-Bold /NimbusSansNarrow-Bold ;
-/Helvetica-Narrow-BoldOblique /NimbusSansNarrow-BdOblique ;
+/Helvetica-Narrow-BoldOblique /NimbusSansNarrow-BoldOblique ;
/Helvetica-Narrow /NimbusSansNarrow-Regular ;
/Helvetica-Narrow-Oblique /NimbusSansNarrow-Oblique ;
/Helvetica /NimbusSans-Regular ;
diff --git a/psi/psromfs.mak b/psi/psromfs.mak
index cbb1163..34e5b5f 100644
--- a/psi/psromfs.mak
+++ b/psi/psromfs.mak
@@ -333,7 +333,7 @@ PS_FONT_DEPS=\
$(PSRESDIR)$(D)Font$(D)NimbusRoman-Regular \
$(PSRESDIR)$(D)Font$(D)NimbusSans-Bold \
$(PSRESDIR)$(D)Font$(D)NimbusSans-BoldItalic \
- $(PSRESDIR)$(D)Font$(D)NimbusSansNarrow-BdOblique \
+ $(PSRESDIR)$(D)Font$(D)NimbusSansNarrow-BoldOblique \
$(PSRESDIR)$(D)Font$(D)NimbusSansNarrow-Bold \
$(PSRESDIR)$(D)Font$(D)NimbusSansNarrow-Oblique \
$(PSRESDIR)$(D)Font$(D)NimbusSansNarrow-Regular \
--
2.9.5

View File

@ -5,7 +5,7 @@ Summary: A PostScript interpreter and renderer
Name: ghostscript
Version: %{gs_ver}
Release: 2%{?dist}
Release: 3%{?dist}
# Included CMap data is Redistributable, no modification permitted,
# see http://bugzilla.redhat.com/487510
@ -13,10 +13,8 @@ License: AGPLv3+ and Redistributable, no modification permitted
URL: http://www.ghostscript.com/
Group: Applications/Publishing
Source0: ghostscript-9.22.tar.xz
Source1: CIDFnmap
Source2: cidfmap
Patch1: ghostscript-9.20-runlibfileifexists.patch
Patch1: ghostscript-9.22-fix-Fontmap.GS.patch
Patch2: ghostscript-9.20-run-dvipdf-securely.patch
# Restore flushpage (xdvi also needs it)
# http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=19ebb5f1f497b6f2d50fe13d17d3e627dfb6c868
@ -109,8 +107,7 @@ A GTK-enabled version of Ghostscript, called 'gsx'.
%setup -q -n %{name}-%{gs_ver}
rm -rf expat freetype icclib jasper jpeg jpegxr lcms lcms2 libpng openjpeg zlib cups/libs
# Fix error when using 'convert' from ImageMagick, and
# make sure the configuration in /etc/ghostscript/Fonts.local is used:
# Fix the Fontmap.GS having wrong /Fontname for Helvetica-Narrow-Bold-Oblique:
%patch1 -p1
# Fix some shell scripts
@ -150,8 +147,6 @@ for path in \
%{_datadir}/fonts/urw-base35/ \
%{_datadir}/fonts/ \
%{_datadir}/%{name}/conf.d \
%{_sysconfdir}/%{name} \
%{_sysconfdir}/%{name}/%{gs_dot_ver} \
%{_datadir}/poppler/cMap/*
do
FONTPATH="$FONTPATH${FONTPATH:+:}$path"
@ -213,13 +208,6 @@ cd ..
echo ".so man1/gs.1" > $RPM_BUILD_ROOT/%{_mandir}/man1/ghostscript.1
ln -sf gs $RPM_BUILD_ROOT%{_bindir}/ghostscript
# Rename an original cidfmap to cidfmap.GS
mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{gs_dot_ver}/Resource/Init/cidfmap{,.GS}
# Install our own cidfmap to allow the separated
# cidfmap which the font packages own.
install -m0644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/%{name}/%{gs_dot_ver}/Resource/Init/CIDFnmap
install -m0644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/%{name}/%{gs_dot_ver}/Resource/Init/cidfmap
# Documentation
install -m0644 doc/COPYING $RPM_BUILD_ROOT%{_docdir}/%{name}-%{gs_dot_ver}
@ -232,11 +220,6 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/ijs_{client,server}_example
# Don't ship URW fonts; we already have them.
rm -rf $RPM_BUILD_ROOT%{_datadir}/ghostscript/%{gs_dot_ver}/Resource/Font
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ghostscript/%{gs_dot_ver}
touch $RPM_BUILD_ROOT%{_sysconfdir}/ghostscript/%{gs_dot_ver}/Fontmap.local
touch $RPM_BUILD_ROOT%{_sysconfdir}/ghostscript/%{gs_dot_ver}/cidfmap.local
touch $RPM_BUILD_ROOT%{_sysconfdir}/ghostscript/%{gs_dot_ver}/CIDFnmap.local
# The man/de/man1 symlinks are broken (bug #66238).
find $RPM_BUILD_ROOT%{_mandir}/de/man1 -type l | xargs rm -f
@ -260,8 +243,6 @@ rm -rf $RPM_BUILD_ROOT
%files core -f rpm.sharelist
%defattr(-,root,root)
%dir %{_sysconfdir}/ghostscript
%dir %{_sysconfdir}/ghostscript/%{gs_dot_ver}
%dir %{_datadir}/ghostscript/%{gs_dot_ver}
%dir %{_datadir}/ghostscript/%{gs_dot_ver}/Resource
%dir %{_datadir}/ghostscript/%{gs_dot_ver}/Resource/Init
@ -283,7 +264,6 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libijs-*.so*
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{gs_dot_ver}
%config(noreplace) %{_sysconfdir}/ghostscript/%{gs_dot_ver}/*
%files
%defattr(-,root,root)
@ -312,6 +292,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libgs.so
%changelog
* Mon Dec 04 2017 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 9.22-2
- Fontmap.GS lookup path for Helvetica-Narrow-Bold-Oblique font fixed (bug #1517518)
* Wed Nov 29 2017 Tom Callaway <spot@fedoraproject.org> - 9.22-2
- apply post 9.22 upstream commit to restore flushpage operator (xdvi needs it)