Bug 75763

Summary: Postscript print buffer in emacs prints using screen colors
Product: [Fedora] Fedora Reporter: Carlos Rodrigues <cefrodrigues>
Component: emacsAssignee: Jens Petersen <petersen>
Status: CLOSED UPSTREAM QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 2CC: mitr, srevivo
Target Milestone: ---Keywords: MoveUpstream
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-09-29 08:36:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Carlos Rodrigues 2002-10-11 23:21:51 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Description of problem:
Printing a buffer (c source for example) using postscript print buffer in emacs
prints using screen colors instead of using dark colors over light background as
it did in emacs 20.x. Because I use a dark background (blue) white text cannot
be seen on paper, forcing me to change the background to white so emacs uses
dark colors for text, just to be able to pretty print.

How reproducible:
Always

Steps to Reproduce:
1.Choose a dark color for emacs' background (eg. black)
2.Postscript print buffer
	

Actual Results:  The printed text, since it is white on screen can't be seen on
paper.

Expected Results:  It should have printed the white text as black as it did in
v20.x.

Comment 1 Jens Petersen 2002-10-27 15:45:03 UTC
Sorry, I don't seem able to reproduce this.

M-x set-background-color blue RET
M-x set-forground-color white RET
C-u Menu File <ps-print-buffer-faces> test.ps RET

% gv test.ps

shows white background in the postscript file.

Can you tell me exactly how to reproduce this?  Thanks.

Comment 2 Carlos Rodrigues 2002-10-27 17:11:55 UTC
I have the colors set from Xresources but I guess it's the same.
M-x set-background-color blue RET
M-x set-foreground-color white RET
M-x ps-print-buffer-with-faces RET

The background in the resulting printed output (don't know how to redirect it to
a file in emacs) is white (which is correct) but the text is of the exact same
colors as on screen... red is printed as red, green is printed as green and
white (normal text) is printed as white... In emacs 20 it used to print using
the same face colors that are used on screen when the background is set to white
which I think is the right thing as printers can't usually print white text...

Comment 3 Jens Petersen 2002-10-30 05:18:09 UTC
Ok, thanks, I can reproduce it now.

[Print to a file is with C-u prefix, like in my 3rd command line above.]

Comment 4 Jens Petersen 2003-02-18 12:57:03 UTC
The ps-print.el author commented:

Well, this is not a bug, since version 6.5.7 that ps-print get the default
foreground and background color of Emacs session and use them as default to
generate a PostScript.

If this is not what you want, you can:

1. Or, start Emacs with other foreground/background color;
   (this was mentioned in bugzilla report by Carlos)

2. Or, set ps-default-bg and ps-default-fg variables to a suitable color, like:

   (setq ps-default-bg "white") ; default background
   (setq ps-default-fg "black") ; default foreground

3. Or, set ps-default-bg and ps-default-fg variables to nil to have default
   colors:

   (setq ps-default-bg nil) ; use default background
   (setq ps-default-fg nil) ; use default foreground

Ideally, options 3 and 4 should be inserted in ~/.emacs file.


Comment 5 Carlos Rodrigues 2003-02-18 16:55:49 UTC
Ok, here are the results after playing with options 2 and 3:

With option 3 I still get white text (invisible) on paper when printing C code
as well as a plain text buffer. It appears to ignore the foreground color but if
I change the background color to something like blue it prints blue background
(with the white text showing).

With option 3 I still can't print C code (the same white text...) but plain text
prints in black foreground like it is supposed to.

Comment 6 Jens Petersen 2003-02-19 06:02:33 UTC
Reproduced in python-mode too for example.

XEmacs ps-print seems to be fine though.

The problem still seems to be present in 6.5.9, Vinicius, afaict.

To reproduce:
% emacs -q
 M-x set-foreground-color RET white RET
 M-x set-background-color RET black RET
 M-x global-font-lock-mode RET
 C-x C-f /usr/include/stdio.h
 C-u M-x ps-print-buffer-with-faces RET ~/tmp/psprint.ps RET y
 C-x C-c
% gv ~/tmp/psprint.ps

and observe that the default font with white foreground is rendered
white on white in the ps file.

Setting
(setq ps-default-fg "black" 
      ps-default-bg "white")
doesn't seem to help.

Comment 7 Jens Petersen 2004-01-14 08:17:43 UTC
Is this any better with 21.3?

Comment 8 Carlos Rodrigues 2004-01-14 20:48:22 UTC
No. 21.3 on Fedora Core 1 behaves exactly the same way. It uses
exactly the same colors to print as it does on screen (except for the
background).

Comment 9 Jens Petersen 2004-09-29 08:36:31 UTC
AFAICT this is fixed in cvs emacs. :)

Comment 10 Jens Petersen 2004-09-29 08:45:23 UTC
Err, sorry no change: reporting this on emacs-devel.