comparison lisp/ps-print.el @ 75702:78d94b04f6aa

Fix background color printing
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Wed, 07 Feb 2007 13:40:10 +0000
parents 7064e151eb7e
children 6f45466672db
comparison
equal deleted inserted replaced
75701:744efaecbd36 75702:78d94b04f6aa
8 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> 8 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br>
9 ;; Kenichi Handa <handa@m17n.org> (multi-byte characters) 9 ;; Kenichi Handa <handa@m17n.org> (multi-byte characters)
10 ;; Maintainer: Kenichi Handa <handa@m17n.org> (multi-byte characters) 10 ;; Maintainer: Kenichi Handa <handa@m17n.org> (multi-byte characters)
11 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> 11 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br>
12 ;; Keywords: wp, print, PostScript 12 ;; Keywords: wp, print, PostScript
13 ;; Version: 6.7.2 13 ;; Version: 6.7.3
14 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre 14 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
15 15
16 (defconst ps-print-version "6.7.2" 16 (defconst ps-print-version "6.7.3"
17 "ps-print.el, v 6.7.2 <2007/01/26 vinicius> 17 "ps-print.el, v 6.7.3 <2007/02/06 vinicius>
18 18
19 Vinicius's last change version -- this file may have been edited as part of 19 Vinicius's last change version -- this file may have been edited as part of
20 Emacs without changes to the version number. When reporting bugs, please also 20 Emacs without changes to the version number. When reporting bugs, please also
21 report the version of Emacs, if any, that ps-print was distributed with. 21 report the version of Emacs, if any, that ps-print was distributed with.
22 22
5836 ((stringp color) (ps-color-scale color)) 5836 ((stringp color) (ps-color-scale color))
5837 (t (list default default default)) 5837 (t (list default default default))
5838 )) 5838 ))
5839 5839
5840 5840
5841 (defun ps-begin-job () 5841 (defun ps-begin-job (genfunc)
5842 ;; prologue files 5842 ;; prologue files
5843 (or (equal ps-mark-code-directory ps-postscript-code-directory) 5843 (or (equal ps-mark-code-directory ps-postscript-code-directory)
5844 (setq ps-print-prologue-0 (ps-prologue-file 0) 5844 (setq ps-print-prologue-0 (ps-prologue-file 0)
5845 ps-print-prologue-1 (ps-prologue-file 1) 5845 ps-print-prologue-1 (ps-prologue-file 1)
5846 ps-mark-code-directory ps-postscript-code-directory)) 5846 ps-mark-code-directory ps-postscript-code-directory))
5907 ((eq ps-print-control-characters 'control) 5907 ((eq ps-print-control-characters 'control)
5908 "[\000-\037\177]") 5908 "[\000-\037\177]")
5909 (t "[\t\n\f]")) 5909 (t "[\t\n\f]"))
5910 ps-default-background (ps-rgb-color 5910 ps-default-background (ps-rgb-color
5911 (cond 5911 (cond
5912 ((eq genfunc 'ps-generate-postscript)
5913 nil)
5912 ((eq ps-default-bg 'frame-parameter) 5914 ((eq ps-default-bg 'frame-parameter)
5913 (ps-frame-parameter 'background-color)) 5915 (ps-frame-parameter 'background-color))
5914 ((eq ps-default-bg t) 5916 ((eq ps-default-bg t)
5915 (ps-face-background-name 'default)) 5917 (ps-face-background-name 'default))
5916 (t 5918 (t
5917 ps-default-bg)) 5919 ps-default-bg))
5918 1.0) 5920 1.0)
5919 ps-default-foreground (ps-rgb-color 5921 ps-default-foreground (ps-rgb-color
5920 (cond 5922 (cond
5923 ((eq genfunc 'ps-generate-postscript)
5924 nil)
5921 ((eq ps-default-fg 'frame-parameter) 5925 ((eq ps-default-fg 'frame-parameter)
5922 (ps-frame-parameter 'foreground-color)) 5926 (ps-frame-parameter 'foreground-color))
5923 ((eq ps-default-fg t) 5927 ((eq ps-default-fg t)
5924 (ps-face-foreground-name 'default)) 5928 (ps-face-foreground-name 'default))
5925 (t 5929 (t
6319 6323
6320 If FACE is not in `ps-print-face-extension-alist' or in 6324 If FACE is not in `ps-print-face-extension-alist' or in
6321 `ps-print-face-alist', insert it on `ps-print-face-alist' and 6325 `ps-print-face-alist', insert it on `ps-print-face-alist' and
6322 return the attribute vector. 6326 return the attribute vector.
6323 6327
6324 If FACE is not a valid face name, it is used default face." 6328 If FACE is not a valid face name, use default face."
6325 (cond 6329 (cond
6326 (ps-black-white-faces-alist 6330 (ps-black-white-faces-alist
6327 (or (and (symbolp face) 6331 (or (and (symbolp face)
6328 (cdr (assq face ps-black-white-faces-alist))) 6332 (cdr (assq face ps-black-white-faces-alist)))
6329 (vector 0 nil nil))) 6333 (vector 0 nil nil)))
6344 (t 6348 (t
6345 (vector 0 nil nil)))) 6349 (vector 0 nil nil))))
6346 6350
6347 6351
6348 (defun ps-face-background (face background) 6352 (defun ps-face-background (face background)
6349 (and (or (eq ps-use-face-background t) 6353 (and (cond ((eq ps-use-face-background t)) ; always
6350 (cond ((symbolp face) 6354 ((null ps-use-face-background) nil) ; never
6351 (memq face ps-use-face-background)) 6355 ;; ps-user-face-background is a symbol face list
6352 ((listp face) 6356 ((symbolp face)
6353 (or (memq (car face) '(foreground-color background-color)) 6357 (memq face ps-use-face-background))
6354 (let (ok) 6358 ((listp face)
6355 (while face 6359 (or (memq (car face) '(foreground-color background-color))
6356 (if (or (memq (car face) ps-use-face-background) 6360 (let (ok)
6357 (memq (car face) 6361 (while face
6358 '(foreground-color background-color))) 6362 (if (or (memq (car face) ps-use-face-background)
6359 (setq face nil 6363 (memq (car face)
6360 ok t) 6364 '(foreground-color background-color)))
6361 (setq face (cdr face)))) 6365 (setq face nil
6362 ok))) 6366 ok t)
6363 (t 6367 (setq face (cdr face))))
6364 nil) 6368 ok)))
6365 )) 6369 (t
6370 nil)
6371 )
6366 background)) 6372 background))
6367 6373
6368 6374
6369 (defun ps-face-attribute-list (face-or-list) 6375 (defun ps-face-attribute-list (face-or-list)
6370 (cond 6376 (cond
6627 (ps-plot-string after-string)) 6633 (ps-plot-string after-string))
6628 (setq from position))))) 6634 (setq from position)))))
6629 (ps-plot-with-face from to face)))) 6635 (ps-plot-with-face from to face))))
6630 6636
6631 (defun ps-generate-postscript (from to) 6637 (defun ps-generate-postscript (from to)
6632 (ps-plot-region from to 0 nil)) 6638 (ps-plot-region from to 0))
6633 6639
6634 (defun ps-generate (buffer from to genfunc) 6640 (defun ps-generate (buffer from to genfunc)
6635 (save-excursion 6641 (save-excursion
6636 (let ((from (min to from)) 6642 (let ((from (min to from))
6637 (to (max to from)) 6643 (to (max to from))
6663 6669
6664 (set-buffer ps-source-buffer) 6670 (set-buffer ps-source-buffer)
6665 (save-excursion 6671 (save-excursion
6666 (let ((ps-print-page-p t) 6672 (let ((ps-print-page-p t)
6667 ps-even-or-odd-pages) 6673 ps-even-or-odd-pages)
6668 (ps-begin-job) 6674 (ps-begin-job genfunc)
6669 (when needs-begin-file 6675 (when needs-begin-file
6670 (ps-begin-file) 6676 (ps-begin-file)
6671 (ps-mule-initialize)) 6677 (ps-mule-initialize))
6672 (ps-mule-begin-job from to) 6678 (ps-mule-begin-job from to)
6673 (ps-selected-pages))) 6679 (ps-selected-pages)))