summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2014-03-04 09:25:18 +0000
committerChris Liddell <chris.liddell@artifex.com>2014-03-04 10:53:23 +0000
commit2621110f37eb0c94a732578acd24634caec1c25b (patch)
tree9e037db17140de188dc731b58022f33b0ebfd792
parent0214c1b9c70cd41026e5cda707e582b32489a64c (diff)
downloadghostpdl-2621110f37eb0c94a732578acd24634caec1c25b.tar.gz
Bug 694832: add an explicit flag for TTF notdef
The previous solution for this issue "overloaded" an existing workaround for pdfwrite. Unfortunately, a clash between pdfwrite's needs and FAPI's meant it did not work all the time. So, when loading a TTF for use in a PDF, add a new flag to the font dictionary to tell the FAPI code whether to render a Truetype notdef. Several differences show up on the cluster - the following are progressions compared to Acrobat: Bug689757.pdf Bug691031.pdf Bug691221.pdf Bug693538.pdf Bug693646.ps Bug693711.pdf keyboard.pdf CATX1490.pdf IA3Z0815.pdf These are different from before, but since Acrobat can't even open these, I don't much care: 207ee6f24411fc4591d2b5a337c46de8-full.pdf 2123_-_MacExpertEncoding_badly_handled.pdf 764_-_heading_garbage.pdf
-rw-r--r--gs/Resource/Init/gs_ttf.ps20
-rw-r--r--gs/psi/zfapi.c16
2 files changed, 22 insertions, 14 deletions
diff --git a/gs/Resource/Init/gs_ttf.ps b/gs/Resource/Init/gs_ttf.ps
index 36fc4168c..b3328a4f7 100644
--- a/gs/Resource/Init/gs_ttf.ps
+++ b/gs/Resource/Init/gs_ttf.ps
@@ -1473,7 +1473,7 @@ mark
} ifelse
} for exch pop
% If there is no .notdef entry, map it to glyph 0.
- dup /.notdef~GS known not { dup /.notdef~GS 0 put } if
+ dup /.notdef known not { dup /.notdef 0 put } if
TTFDEBUG {
(CharStrings:)= dup { exch =string cvs print ( ) print //== exec } forall
} if
@@ -1829,12 +1829,13 @@ currentdict /postalias undef
pop
} forall
- dup /.notdef~GS 0 put
+ dup /.notdef 0 put
} bind def
% <subtable> .pdfmapsymbolic /Encoding [] /CharStrings <<>>
/.pdfmapsymbolic {
+ //true /.render_notdef gput
cmaparray
dup length 1 add dict begin
[ 64 { /.notdef /.notdef /.notdef /.notdef } repeat ]
@@ -1893,7 +1894,7 @@ currentdict /postalias undef
<00030001> .findcmap {
prebuilt_encoding //null ne {
TTFDEBUG { (Using cmap 3.1 with prebuilt_encoding for non-symbolic.) = } if
-
+ //true /.render_notdef gput
% The character code in /prebuilt_encoding[] is not guaranteed to be
% compatible with the Microsoft UCS2 TrueType cmap subtable.
% If the glyphname is known by AdobeGlyphList, the charcode for the glyph
@@ -1936,14 +1937,6 @@ currentdict /postalias undef
/Encoding
prebuilt_encoding //null ne {
prebuilt_encoding
- % Replace /.notdef with something we can recognise internally and elide the hollow rectangle notdef
- [ exch
- {
- dup /.notdef eq {
- pop /.notdef~GS
- } if
- } forall
- ]
} {
/MacRomanEncodingForTrueType .findencoding
} ifelse
@@ -1967,6 +1960,8 @@ currentdict /postalias undef
TTFDEBUG { (.loadpdfttfont Encoding=) print dup //== exec } if
/prebuilt_encoding gput % for .pdfcharkeys
/is_symbolic gput
+ % init key for whether to display the TTF notdef
+ //false /.render_notdef gput
//false 0 .loadttfonttables
.makesfnts
tabdict /cmap known not {
@@ -2006,11 +2001,12 @@ currentdict /postalias undef
.ttkeys
/FontType 42
/PaintType 0
+ /.render_notdef .render_notdef
TTFDEBUG {
(numloca=) print numloca =
} if
.dicttomark
dup /FontName font_name put % replace any definition of /FontName
end end
- .completefont
+ .completefont
} bind def
diff --git a/gs/psi/zfapi.c b/gs/psi/zfapi.c
index d46cbf5cf..7ae292b0d 100644
--- a/gs/psi/zfapi.c
+++ b/gs/psi/zfapi.c
@@ -1152,11 +1152,23 @@ FAPI_FF_get_glyph(gs_fapi_font *ff, int char_code, byte *buf,
else { /* type 42 */
const byte *data_ptr;
int l = ff->get_glyphdirectory_data(ff, char_code, &data_ptr);
+ ref *render_notdef_ref;
+ bool render_notdef = true;
+
+ if (dict_find_string(pdr, ".render_notdef", &render_notdef_ref) > 0
+ && r_has_type(render_notdef_ref, t_boolean)) {
+ render_notdef = render_notdef_ref->value.boolval;
+ }
+ else {
+ render_notdef = i_ctx_p->RenderTTNotdef;
+ }
/* We should only render the TT notdef if we've been told to - logic lifted from zchar42.c */
- if (!i_ctx_p->RenderTTNotdef
+ if (!render_notdef
&&
- ((ff->char_data_len > 9
+ ((ff->char_data_len == 7
+ && strncmp((const char *)ff->char_data, ".notdef", 7) == 0)
+ || (ff->char_data_len > 9
&& strncmp((const char *)ff->char_data, ".notdef~GS",
10) == 0))) {
glyph_length = 0;