From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Does ps-print-buffer-with-faces give the correct colors? Date: Wed, 22 Nov 2006 19:25:47 +0100 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164220844 4557 80.91.229.2 (22 Nov 2006 18:40:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 22 Nov 2006 18:40:44 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 22 19:40:39 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gmx1L-0003DQ-6R for geh-help-gnu-emacs@m.gmane.org; Wed, 22 Nov 2006 19:40:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gmx1K-0000qB-NF for geh-help-gnu-emacs@m.gmane.org; Wed, 22 Nov 2006 13:40:30 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 73 Original-X-Trace: individual.net EbVnltUPfsPvsP+ztBU9dgShkIj8bsHJaStjXc0PVrRq0qTmVu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.90 (windows-nt) Cancel-Lock: sha1:KGe9cvAbzwI6w+KdlCvWDoe0k0w= Original-Xref: shelby.stanford.edu gnu.emacs.help:143285 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38902 Archived-At: I made a small hack today while playing wirh Ghostscript. It creates a PDF file of the current buffer in Emacs. The problem is that the colors of the faces become strange. Here is the code: ;;;; (defcustom ps2pdf-gs-program "C:/Program Files/GPLGS/gswin32c.exe" "Path to GhostView program." :type 'string :group 'ps2pdf) (defun ps2pdf-convert (file) (let* ((pdf-file (concat (file-name-sans-extension file) ".pdf")) (result (call-process ps2pdf-gs-program nil nil t "-q" "-dNOPAUSE" "-sDEVICE=pdfwrite" (concat "-sOutputFile=" pdf-file) file))) (if (eq 0 result) pdf-file (error "PDF creation failed")))) (defun ps2pdf (file) (interactive "fSelect Postscript file: ") (let ((pdf-file (ps2pdf-convert file))) (message "PDF file %s created successfully" pdf-file))) (defun ps2pdf-from-buffer () (let ((fname (make-temp-file "ps2pdf-buffer" nil ".ps")) (pdf-file)) (ps-print-buffer-with-faces fname) (message "Postscript file %s created" fname) (setq pdf-file (ps2pdf-convert fname)) (message "PDF file %s created successfully" pdf-file) pdf-file)) (defun w32-ps2pdf-from-buffer () (interactive) (w32-shell-execute "Open" (ps2pdf-from-buffer))) (provide 'ps2pdf) ;;;; How does `ps-print-buffer-with-faces' calculate the colors from the faces in the buffer? Something is clearly wrong. I took a screenshot of the Emacs buffer and used Gimp to check the color values of a specific text on the screen. The values were: Red: 63%, Green: 13%, Blue: 94%. In the ps file that Emas generates, I can see the following: ... 0.686 0.933 0.933 FG (lambda) S ... I don't know what kind of values those are but clearly two of the values are the same, which is not the case when I checked the color in Gimp. You can see the screenshots here: http://www.flickr.com/photos/klibb/303651087/ (Emacs buffer) http://www.flickr.com/photos/klibb/303651103/ (PDF in Acrobat) I tested this on Windows XP with a quite recent (November 2006) CVS Emacs and the newest GPL Ghostscript version. /Mathias