unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22611: 24.4; ps-print.el generates invalid files
@ 2016-02-09 21:03 Łukasz Stelmach
  2016-02-09 21:07 ` bug#22611: [PATCH] Call ps-encode-header-string-function for plain strings too Łukasz Stelmach
  2016-02-10  8:11 ` bug#22611: No dolist required Łukasz Stelmach
  0 siblings, 2 replies; 5+ messages in thread
From: Łukasz Stelmach @ 2016-02-09 21:03 UTC (permalink / raw)
  To: 22611


[-- Attachment #1.1: Type: text/plain, Size: 2808 bytes --]

ps-print.el generates invalid PostScript when called from Gnus to print
an article (gnus-summary-print-article). Some glyphs are missing from
the BitmapDict as well as from Exxxx dictionaries.

To reproduce the bug let there be a buffer named "ZAŻÓŁĆ" containing the
following string:

    Zażółć gęślą jaźń

In this buffer evaluate the following form:

    (let ((ps-left-header (list "fubar")))
      (ps-spool-buffer)
      (ps-despool "/tmp/fubar.ps"))

When viewing the file under gv (gv 1:3.7.4-1, ghostscript
9.06~dfsg-2+deb8u1, on Debian jessie). There is an empty grey header
box, and the following error message is displayed on the page.

--8<---------------cut here---------------start------------->8---
# ERROR: undefined
# OFFENDING COMMAND: get

# STACK:

/.notdef
-dictionary-
-dictionary-
[[/h0 {PageNumber 32 string cvs ShowNofN {(/)strcat PageCount 32 string
cvs strcat }if }][/h1 (09.02.2016)]]
true


# ERRORINFO:
--8<---------------cut here---------------end--------------->8---

Please find the faulty fubar-bad.ps and fubar-good.ps attached. The
latter has been generated after applying the patch that will follow this
message. The patch has been created on the master branch.

I've tested it only on Debian 8 with bdf fonts, so please make sure the
patch won't introduce any regressions.

In GNU Emacs 24.4.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on binet, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.3 (jessie)

Configured using:
 `configure --build i586-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build i586-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: pl_PL.UTF-8
  locale-coding-system: utf-8-unix

-- 
Było mi bardzo miło.                                  --- Rurku. --- ...
>Łukasz<                                --- To dobrze, że mnie słuchasz.

[-- Attachment #1.2: fubar-bad.ps --]
[-- Type: application/postscript, Size: 95831 bytes --]

[-- Attachment #1.3: fubar-good.ps --]
[-- Type: application/postscript, Size: 111857 bytes --]

[-- Attachment #2: Type: application/pgp-signature, Size: 602 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#22611: [PATCH] Call ps-encode-header-string-function for plain strings too
  2016-02-09 21:03 bug#22611: 24.4; ps-print.el generates invalid files Łukasz Stelmach
@ 2016-02-09 21:07 ` Łukasz Stelmach
  2016-02-23  3:55   ` Lars Ingebrigtsen
  2016-02-10  8:11 ` bug#22611: No dolist required Łukasz Stelmach
  1 sibling, 1 reply; 5+ messages in thread
From: Łukasz Stelmach @ 2016-02-09 21:07 UTC (permalink / raw)
  To: 22611; +Cc: Łukasz Stelmach

The function needs to be called for plain strings too to ensure
the BitmapDict contains required characters and Unicode characters
in the headers are printed properly.
---
 lisp/ps-print.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 7333709..999398e 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -4761,7 +4761,11 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
    ;; Literal strings should be output as is -- the string must contain its own
    ;; PS string delimiters, '(' and ')', if necessary.
    ((stringp content)
-    (ps-output content))
+    (if (functionp ps-encode-header-string-function)
+		(dolist (l (funcall ps-encode-header-string-function
+				    content fonttag))
+	  (ps-output l))
+    (ps-output content)))
 
    ;; Functions are called -- they should return strings; they will be inserted
    ;; as strings and the PS string delimiters added.
-- 
2.4.6






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#22611: No dolist required
  2016-02-09 21:03 bug#22611: 24.4; ps-print.el generates invalid files Łukasz Stelmach
  2016-02-09 21:07 ` bug#22611: [PATCH] Call ps-encode-header-string-function for plain strings too Łukasz Stelmach
@ 2016-02-10  8:11 ` Łukasz Stelmach
  2016-02-11  9:06   ` Łukasz Stelmach
  1 sibling, 1 reply; 5+ messages in thread
From: Łukasz Stelmach @ 2016-02-10  8:11 UTC (permalink / raw)
  To: 22611

Hi,

Since `content' is a string `dolist' is not required, is it?
-- 
Łukasz Stelmach z podróży





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#22611: No dolist required
  2016-02-10  8:11 ` bug#22611: No dolist required Łukasz Stelmach
@ 2016-02-11  9:06   ` Łukasz Stelmach
  0 siblings, 0 replies; 5+ messages in thread
From: Łukasz Stelmach @ 2016-02-11  9:06 UTC (permalink / raw)
  To: 22611

Łukasz Stelmach <stlman@poczta.fm> writes:

> Since `content' is a string `dolist' is not required, is it?

`dolist' is required because ps-encode-header-string-function
(ps-mule-encode-header-string actually) returns a list.
-- 
Było mi bardzo miło.                                  --- Rurku. --- ...
>Łukasz<                                --- To dobrze, że mnie słuchasz.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#22611: [PATCH] Call ps-encode-header-string-function for plain strings too
  2016-02-09 21:07 ` bug#22611: [PATCH] Call ps-encode-header-string-function for plain strings too Łukasz Stelmach
@ 2016-02-23  3:55   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23  3:55 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: 22611

Łukasz Stelmach <stlman@poczta.fm> writes:

> The function needs to be called for plain strings too to ensure
> the BitmapDict contains required characters and Unicode characters
> in the headers are printed properly.
> ---
>  lisp/ps-print.el | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/ps-print.el b/lisp/ps-print.el
> index 7333709..999398e 100644
> --- a/lisp/ps-print.el
> +++ b/lisp/ps-print.el
> @@ -4761,7 +4761,11 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th
>     ;; Literal strings should be output as is -- the string must contain its own
>     ;; PS string delimiters, '(' and ')', if necessary.
>     ((stringp content)
> -    (ps-output content))
> +    (if (functionp ps-encode-header-string-function)
> +		(dolist (l (funcall ps-encode-header-string-function
> +				    content fonttag))
> +	  (ps-output l))
> +    (ps-output content)))

I'm not very familiar with ps-print.el, but it looks good to me, so I've
applied it to emacs-25.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-23  3:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 21:03 bug#22611: 24.4; ps-print.el generates invalid files Łukasz Stelmach
2016-02-09 21:07 ` bug#22611: [PATCH] Call ps-encode-header-string-function for plain strings too Łukasz Stelmach
2016-02-23  3:55   ` Lars Ingebrigtsen
2016-02-10  8:11 ` bug#22611: No dolist required Łukasz Stelmach
2016-02-11  9:06   ` Łukasz Stelmach

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).