From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 14 10:55:39 2019 Received: (at 34877) by debbugs.gnu.org; 14 Apr 2019 14:55:39 +0000 Received: from localhost ([127.0.0.1]:32929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFgXc-0004Im-DM for submit@debbugs.gnu.org; Sun, 14 Apr 2019 10:55:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35569) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFgXa-0004IZ-MF for 34877@debbugs.gnu.org; Sun, 14 Apr 2019 10:55:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFgXU-00072t-Mb; Sun, 14 Apr 2019 10:55:25 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=55448 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hFgXU-0006F7-A1; Sun, 14 Apr 2019 10:55:24 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Diego Nicola Barbato Subject: Re: bug#34877: Ghostscript: Missing text when converting PDF to PS References: <87wokzhhgp.fsf@GlaDOS.home> Date: Sun, 14 Apr 2019 16:55:22 +0200 In-Reply-To: <87wokzhhgp.fsf@GlaDOS.home> (Diego Nicola Barbato's message of "Fri, 15 Mar 2019 23:59:34 +0100") Message-ID: <878swcljqd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 34877 Cc: 34877@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Diego, Diego Nicola Barbato skribis: > When converting certain PDF files to PostScript pdf2ps (from the > Ghostscript package) will print the following error messages: > > **** Error reading a content stream. The page may be incomplete. > Output may be incorrect. > **** Error: File did not complete the page properly and may be damaged. > Output may be incorrect. > > The resulting file will be missing some (sometimes all) of the text. I have spent time investigating this issue, in vain so far. There=E2=80=99s already one conclusion that can be drawn: pdf2ps succeeds i= n my experience with PDFs that do *not* embed fonts (one of the 14 standard fonts.) It fails, as in this case, when fonts *are* embedded. Looking at the strace output, I initially thought our gs was missing its resource files: they were supposed to be compiled in (=E2=80=9CCOMPILE_INITS=3D1=E2=80=9D), but my understanding was that this w= as only the case for the statically-linked gs, which we disabled in commit eb354bdacbf4154ec66038dac07f19bf4ced1fad. So I started by passing --disable-compile-inits and then fixing up ENOENT issues that I could notice in the strace output (patch below), but that didn=E2=80=99t make any difference. I=E2=80=99m still not sure how to interpret this error, it=E2=80=99s really= not clear to me what it really means. Reports like suggest it has to do with fonts, but it=E2=80=99s not all that clear in this case. Anyway, it=E2=80=99s also clear that this is the same problem people experi= ence when printing. Ideas welcome! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm index 53a9b60fdb..9591dbdb1d 100644 --- a/gnu/packages/ghostscript.scm +++ b/gnu/packages/ghostscript.scm @@ -2,7 +2,7 @@ ;;; Copyright =C2=A9 2013 Andreas Enge ;;; Copyright =C2=A9 2014, 2015, 2016, 2017 Mark H Weaver ;;; Copyright =C2=A9 2015 Ricardo Wurmus -;;; Copyright =C2=A9 2013, 2015, 2016, 2017 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2013, 2015, 2016, 2017, 2019 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2017 Alex Vong ;;; Copyright =C2=A9 2017, 2018, 2019 Efraim Flashner ;;; Copyright =C2=A9 2017 Leo Famulari @@ -269,6 +269,59 @@ output file formats and printers.") (home-page "https://www.ghostscript.com/") (license license:agpl3+))) =20 +(define-public ghostscript/fixed + (package/inherit + ghostscript + (version (string-append (package-version ghostscript) "-1")) + (arguments + (substitute-keyword-arguments (package-arguments ghostscript) + ((#:configure-flags flags ''()) + `(append (list "--disable-compile-inits" + (string-append "--with-fontpath=3D" + (assoc-ref %build-inputs "gs-fonts") + "/share/fonts/type1/ghostscript")) + ,flags)) + ((#:phases phases '%standard-phases) + `(modify-phases ,phases + (add-after 'install 'create-cmap-symlink + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (init (car (find-files out "^Init$" + #:directories? #t))) + (fontdir (string-append out "/share/ghostscript/fonts= ")) + (fontdir1 (string-append out "/share/fonts/type1/ghos= tscript"))) + (symlink "../CMap" + (string-append init "/CMap")) + (symlink "../Init/Fontmap" + (string-append init "/../Font/Fontmap")) + + (mkdir-p fontdir) + (symlink (string-append init "/Fontmap") + (string-append fontdir "/Fontmap")) + (mkdir-p fontdir1) + (symlink (string-append init "/Fontmap") + (string-append fontdir1 "/Fontmap")) + #t))))))) + (inputs `(("gs-fonts" ,gs-fonts) + ,@(package-inputs ghostscript))))) + +(define-public ghostscript/static + ;; Like before commit eb354bdacbf4154ec66038dac07f19bf4ced1fad. + (package + (inherit ghostscript) + (name "ghostscript-static") + (arguments + (substitute-keyword-arguments (package-arguments ghostscript) + ((#:phases phases '%standard-phases) + `(modify-phases ,phases + (replace 'build + (lambda _ + (invoke "make" "-j5"))) + (replace 'install + (lambda _ + (invoke "make" "install"))) + (delete 'create-gs-symlink))))))) + (define-public ghostscript/x (package/inherit ghostscript (name (string-append (package-name ghostscript) "-with-x")) --=-=-=--