Upstream patch from bug #690692 to handle strange fonts (bug #969660).

Resolves: rhbz#969660
This commit is contained in:
Tim Waugh 2013-06-18 16:10:57 +01:00
parent 9c8808ccb1
commit 41ef5a5180
2 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,61 @@
diff -up ghostscript-9.07/Resource/Init/gs_ttf.ps.strange-fonts ghostscript-9.07/Resource/Init/gs_ttf.ps
--- ghostscript-9.07/Resource/Init/gs_ttf.ps.strange-fonts 2013-02-14 07:58:16.000000000 +0000
+++ ghostscript-9.07/Resource/Init/gs_ttf.ps 2013-06-18 16:09:49.904150294 +0100
@@ -41,21 +41,17 @@
% Closes the file in either case.
/.findnonttfontvalue /.findfontvalue load def
/.findfontvalue {
- 1 index read {
- 2 index 1 index unread
- % beginning with binary 0 or 't' (TrueType), or 'O' (OpenType)
- dup 0 eq 1 index (O) 0 get eq or exch (t) 0 get eq or {
+ 1 index .is_ttf_or_otf {
% If this is a font at all, it's a TrueType font.
dup /FontType eq {
pop closefile 42 //true
} {
dup /FontName eq { pop .findttfontname } { pop closefile //false } ifelse
} ifelse
- } {
+ } {
% Not a TrueType font.
.findnonttfontvalue
- } ifelse
- } { pop closefile //false } ifelse
+ } ifelse
} bind def
% <file> .findttfontname <fname> true
@@ -65,7 +61,9 @@
//true 0 .loadttfonttables
tabdict /name .knownget {
dup 8 getu32 f exch setfileposition
- 12 getu32 string f exch readstring pop
+ 12 getu32
+ dup 65535 gt { pop 65535 } if % protect against extremely large name
+ string f exch readstring pop
dup
6 findname not {
4 findname % Try FullName
@@ -82,6 +80,7 @@
% Load a font file that might be a TrueType font.
/tt_tag_dict << <00010000> 0 (true) 0 (typ1) 0 (ttcf) 0 >> readonly def
+/ttf_otf_tag_dict << <00010000> 0 (true) 0 (typ1) 0 (ttcf) 0 (OTTO) 0>> readonly def
% <file> .loadfontfile -
/.loadnonttfontfile /.loadfontfile load def
@@ -95,7 +94,13 @@
} ifelse
} bind def
+% <file> .istruetypefont <bool>
+/.is_ttf_or_otf {
+ dup 0 setfileposition (1234) .peekstring { //ttf_otf_tag_dict exch known } { //false } ifelse
+} bind def
+
currentdict /tt_tag_dict .undef
+currentdict /ttf_otf_tag_dict .undef
% ---------------- Automatic Type 42 generation ---------------- %

View File

@ -5,7 +5,7 @@ Summary: A PostScript interpreter and renderer
Name: ghostscript
Version: %{gs_ver}
Release: 5%{?dist}
Release: 6%{?dist}
# Included CMap data is Redistributable, no modification permitted,
# see http://bugzilla.redhat.com/487510
@ -27,6 +27,7 @@ Patch27: ghostscript-Fontmap.local.patch
Patch28: ghostscript-iccprofiles-initdir.patch
Patch29: ghostscript-gdevcups-debug-uninit.patch
Patch30: ghostscript-pdfwrite-segfault.patch
Patch31: ghostscript-strange-fonts.patch
Requires: urw-fonts >= 1.1, ghostscript-fonts
Requires: poppler-data
@ -143,6 +144,9 @@ rm -rf expat freetype icclib jasper jpeg lcms2 libpng openjpeg zlib cups/libs
# Upstream patch to fix pdfwrite segfault (bug #962120).
%patch30 -p1 -b .pdfwrite-segfault
# Upstream patch from bug #690692 to handle strange fonts (bug #969660).
%patch31 -p1 -b .strange-fonts
# Convert manual pages to UTF-8
from8859_1() {
iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_"
@ -339,6 +343,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/libgs.so
%changelog
* Tue Jun 18 2013 Tim Waugh <twaugh@redhat.com> 9.06-6
- Upstream patch from bug #690692 to handle strange fonts (bug #969660).
* Thu May 16 2013 Tim Waugh <twaugh@redhat.com> 9.06-5
- Upstream patch to fix pdfwrite segfault (bug #962120).