[gs-cvs] rev 8443 - in trunk/gs: doc lib src
alexcher at ghostscript.com
alexcher at ghostscript.com
Sat Dec 15 17:37:57 PST 2007
Author: alexcher
Date: 2007-12-15 17:37:56 -0800 (Sat, 15 Dec 2007)
New Revision: 8443
Modified:
trunk/gs/doc/Language.htm
trunk/gs/lib/pdf_font.ps
trunk/gs/src/seexec.c
trunk/gs/src/sfilter.h
trunk/gs/src/zmisc1.c
Log:
Don't skip space characters after eexec in embedded PDF fonts but
continue to do so in other cases. Bug 689615.
DIFFERENCES:
None
Modified: trunk/gs/doc/Language.htm
===================================================================
--- trunk/gs/doc/Language.htm 2007-12-14 19:51:01 UTC (rev 8442)
+++ trunk/gs/doc/Language.htm 2007-12-16 01:37:56 UTC (rev 8443)
@@ -1611,12 +1611,15 @@
<dt><b><tt><source> <dict> /eexecDecode filter <file></tt></b>
<dd>Creates a filter for decrypting data encrypted as described in the Adobe
Type 1 Font Format documentation. The <b><tt>seed_integer</tt></b> must be
-55665 or 4330 as described just above. Recognized dictionary keys are:
+55665 or 4330 as described just above. PDF interpreters don't skip space characters
+after operator <b><tt>eexec</tt></b>. Use <b><tt>keep_spaces = true</tt></b> for
+decoding embedded PDF fonts. Recognized dictionary keys are:
<blockquote>
<b><tt>seed <16-bit integer></tt></b> (required)<br>
<b><tt>lenIV <non-negative integer></tt></b> (default=4)<br>
-<b><tt>eexec <bool></tt></b> (default=<b><tt>false</b></tt>)
+<b><tt>eexec <bool></tt></b> (default=<b><tt>false</b></tt>)<br>
+<b><tt>keep_spaces <bool></tt></b> (default=<b><tt>false</b></tt>)
</blockquote>
</dl>
Modified: trunk/gs/lib/pdf_font.ps
===================================================================
--- trunk/gs/lib/pdf_font.ps 2007-12-14 19:51:01 UTC (rev 8442)
+++ trunk/gs/lib/pdf_font.ps 2007-12-16 01:37:56 UTC (rev 8443)
@@ -674,6 +674,12 @@
0 () /SubFileDecode filter
} bdef
+% Adobe Acrobat doesn't skip space characters after eexec
+/eexec_pdf_param_dict mark
+ .eexec_param_dict {} forall
+ /keep_spaces true
+.dicttomark readonly def
+
% When Type 1 font reading procedure is executing, a copy of this dictionary is current.
% We have to do something special about embedded fonts that execute definefont
% more than once -- that is the function of topFontDict.
@@ -706,7 +712,7 @@
/eexec {
% Assume the font dictionary is directly below the file on the stack
count 0 gt { /topFontDict 2 index cvlit store } if
- //.eexec_param_dict /eexecDecode filter
+ //eexec_pdf_param_dict /eexecDecode filter
//missing-type1-procs begin
/userdict .systemvar begin
@@ -723,6 +729,8 @@
end readonly def
+currentdict /eexec_pdf_param_dict .undef
+
/readtype1 { % <font-resource> <stream-dict> readtype1 <font>
1 index exch % res res stream
PDFfile fileposition 3 1 roll % res pos res stream
Modified: trunk/gs/src/seexec.c
===================================================================
--- trunk/gs/src/seexec.c 2007-12-14 19:51:01 UTC (rev 8442)
+++ trunk/gs/src/seexec.c 2007-12-16 01:37:56 UTC (rev 8443)
@@ -71,6 +71,7 @@
ss->hex_left = max_long;
/* Clear pointers for GC */
ss->pfb_state = 0;
+ ss->keep_spaces = false; /* PS mode */
}
/* Initialize the state for reading and decrypting. */
@@ -106,10 +107,11 @@
const byte *const decoder = scan_char_decoder;
int i;
- if (ss->pfb_state == 0) {
+ if (ss->pfb_state == 0 && !ss->keep_spaces) {
/*
* Skip '\t', '\r', '\n', ' ' at the beginning of the input stream,
- * because Adobe interpreters do this. Don't skip '\0' or '\f'.
+ * because Adobe PS interpreters do this. Don't skip '\0' or '\f'.
+ * Acrobat Reader doesn't skip spaces at all.
*/
for (; rcount; rcount--, p++) {
byte c = p[1];
Modified: trunk/gs/src/sfilter.h
===================================================================
--- trunk/gs/src/sfilter.h 2007-12-14 19:51:01 UTC (rev 8442)
+++ trunk/gs/src/sfilter.h 2007-12-16 01:37:56 UTC (rev 8443)
@@ -54,6 +54,7 @@
int lenIV; /* # of initial decoded bytes to skip */
stream_PFBD_state *pfb_state; /* state of underlying */
/* PFBDecode stream, if any */
+ bool keep_spaces; /* PS skips spaces after eexec, PDF doesn't */
/* The following change dynamically. */
int odd; /* odd digit */
long record_left; /* data left in binary record in .PFB file, */
Modified: trunk/gs/src/zmisc1.c
===================================================================
--- trunk/gs/src/zmisc1.c 2007-12-14 19:51:01 UTC (rev 8442)
+++ trunk/gs/src/zmisc1.c 2007-12-16 01:37:56 UTC (rev 8443)
@@ -114,7 +114,9 @@
(code = dict_int_param(op, "lenIV", 0, max_int, 4,
&state.lenIV)) < 0 ||
(code = dict_bool_param(op, "eexec", false,
- &is_eexec)) < 0
+ &is_eexec)) < 0 ||
+ (code = dict_bool_param(op, "keep_spaces", false,
+ &state.keep_spaces)) < 0
)
return code;
state.cstate = cstate;
More information about the gs-cvs
mailing list