summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps')
-rw-r--r--Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps22
1 files changed, 19 insertions, 3 deletions
diff --git a/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps b/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps
index 394cba28e26..95d50c6be60 100644
--- a/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps
+++ b/Master/tlpkg/tlgs/Resource/Init/gs_ttf.ps
@@ -1,4 +1,4 @@
-% Copyright (C) 2001-2020 Artifex Software, Inc.
+% Copyright (C) 2001-2021 Artifex Software, Inc.
% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
@@ -414,7 +414,16 @@
pop
/firstcode startc 0 getu16a 16#ff00 and dup 16#f000 ne { pop 0 } if def
/putglyph {
- glyphs code 3 -1 roll put /code code 1 add def
+ glyphs code known
+ {
+ glyphs /.cmap_warning_issued known not {
+ (**** Warning: Invalid TTF cmap mapping (overlapping/repeated map)\n) print flush
+ glyphs /.cmap_warning_issued //true put
+ } if
+ pop
+ }
+ {glyphs code 3 -1 roll put}ifelse
+ /code code 1 add def
} bind def
/glyphs 0 dict def
@@ -438,6 +447,10 @@
% Two choices are: drop later repeated/overlapping segments entirely,
% or only use codes from later, overlapping segments not already set
% by the earlier segment. (Inspired by Bug 700968).
+ % Revision: bug 703589 has an (invalid) cmap table with overlapping
+ % (actually repeating) ranges, and requires the *first* range definition
+ % to be used in order to render correctly. So /putglyph now refuses to
+ % overwrite existing keys in the "glyphs" dictionary
0 2 nseg2 dup 4 lt {pop 4}if 3 sub {
/i2 exch def
/scode startc i2 getu16a def
@@ -464,7 +477,10 @@
} for
} ifelse
} if
- } for glyphs /glyphs //null def % for GC
+ } for
+ % If we've encoutered an invalid table, remove the key before returning
+ glyphs /.cmap_warning_issued undef
+ glyphs /glyphs //null def % for GC
} .bind
6 { % Single interval lookup.
dup 6 getu16a /firstcode exch def