may fix problems with our kyocera printer
authorMatthias Förste <foerste@schlittermann.de>
Tue, 09 Jul 2013 14:35:01 +0200
changeset 26 979f6bd117bc
parent 25 1e6203fa0dde
child 27 da8f9dd55194
may fix problems with our kyocera printer
ghostscript/020120720~01dc18e.patch
ghostscript/README
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ghostscript/020120720~01dc18e.patch	Tue Jul 09 14:35:01 2013 +0200
@@ -0,0 +1,97 @@
+From 01dc18e8418fc44a993840f0aeaf741929c1921a Mon Sep 17 00:00:00 2001
+From: Ken Sharp <ken.sharp@artifex.com>
+Date: Fri, 20 Jul 2012 10:27:32 +0100
+Subject: [PATCH] ps2write - Always ascii hex encode the eexec portion of type
+ 1 fonts
+
+Bug #693197 "ps2write outputs Type 1 fonts in pfb format"
+
+Technically it is possible for the eexec portion of a type 1 font to be in
+binary or ascii hex. Because we always ascii85 encode binary data if the
+device does not support it, we left eexec portion as binary.
+
+However it seems that at least some printers (Kyocera, possibly others) are
+unable to deal with this.
+
+This patch means that we alays use ascii hex data for the eexec encrypted
+portion of a type 1 font. We did consider making this a command line option
+but were unable to find any other tools which emitted binary here so opted
+simply to conform.
+
+All the investigation and the original patch (see bug report) by Chris Liddell
+
+
+No differences expected
+---
+ base/gdevpdtb.c |   26 +++++++++++++++++++-------
+ base/gdevpsf1.c |    5 ++++-
+ 2 files changed, 23 insertions(+), 8 deletions(-)
+
+Index: ghostscript-9.05~dfsg/base/gdevpdtb.c
+===================================================================
+--- ghostscript-9.05~dfsg.orig/base/gdevpdtb.c	2013-07-09 13:05:30.000000000 +0200
++++ ghostscript-9.05~dfsg/base/gdevpdtb.c	2013-07-09 14:19:38.000000000 +0200
+@@ -549,17 +549,29 @@
+     pdf_data_writer_t writer;
+     byte digest[6] = {0,0,0,0,0,0};
+     int code;
++    int options=0;
+ 
+     if (pbfont->written)
+         return 0;		/* already written */
+     code = copied_order_font((gs_font *)out_font);
+     if (code < 0)
+         return code;
+-    code = pdf_begin_data_stream(pdev, &writer, DATA_STREAM_BINARY |
+-                            /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
+-                               See comment in pdf_begin_encrypt. */
+-                                 (pdev->CompressFonts ?
+-                                  DATA_STREAM_COMPRESS : 0), 0);
++    /* Since we now always ASCIIHex encode the eexec encrypted portion of a
++     * Type 1 font, such a font cannot contain any binary data, if its not being
++     * compressed then there is no reason to ASCII encode it (which will happen
++     * we set DATA_STREAM_BINARY and the device does not permit binary output)
++     * NB if HaveCFF is true then we convert type 1 to CFF which is a binary
++     * format, so we still need to set DATA_STREAM_BINARY.
++     */
++    if (pdev->CompressFonts)
++        options = DATA_STREAM_BINARY | DATA_STREAM_COMPRESS;
++    else
++         if (FontType != ft_encrypted || pdev->HaveCFF)
++            options = DATA_STREAM_BINARY;
++    /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
++     * See comment in pdf_begin_encrypt.
++     */
++    code = pdf_begin_data_stream(pdev, &writer, options, 0);
+     if (code < 0)
+         return code;
+     if (pdev->PDFA) {
+@@ -610,8 +622,8 @@
+ 
+             code = psf_write_type1_font(writer.binary.strm,
+                                 (gs_font_type1 *)out_font,
+-                                WRITE_TYPE1_WITH_LENIV |
+-                                    WRITE_TYPE1_EEXEC | WRITE_TYPE1_EEXEC_PAD,
++                                WRITE_TYPE1_WITH_LENIV | WRITE_TYPE1_EEXEC |
++                                WRITE_TYPE1_EEXEC_PAD | WRITE_TYPE1_ASCIIHEX,
+                                 NULL, 0, &fnstr, lengths);
+             if (lengths[0] > 0) {
+                 if (code < 0)
+Index: ghostscript-9.05~dfsg/base/gdevpsf1.c
+===================================================================
+--- ghostscript-9.05~dfsg.orig/base/gdevpsf1.c	2013-07-09 13:05:30.000000000 +0200
++++ ghostscript-9.05~dfsg/base/gdevpsf1.c	2013-07-09 14:19:38.000000000 +0200
+@@ -857,9 +857,12 @@
+         if (options & WRITE_TYPE1_ASCIIHEX) {
+             s_init(&AXE_stream, s->memory);
+             s_init_state((stream_state *)&AXE_state, &s_AXE_template, NULL);
+-            AXE_state.EndOfData = false;
+             s_init_filter(&AXE_stream, (stream_state *)&AXE_state,
+                           AXE_buf, sizeof(AXE_buf), es);
++            /* We have to set this after s_init_filter() as that function
++             * sets it to true.
++             */
++            AXE_state.EndOfData = false;
+             es = &AXE_stream;
+         }
+         s_init(&exE_stream, s->memory);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ghostscript/README	Tue Jul 09 14:35:01 2013 +0200
@@ -0,0 +1,3 @@
+ghostscript-<version>$ quilt import ~/src/hg/ius-diffs/ghostscript/020120720~01dc18e.patch
+ghostscript-<version>$ dch
+ghostscript-<version>$ $FAVOURITE-PACKAGE-BUILDER