comparison lisp/ps-print.el @ 78214:9df605969950

Fix foreground/background color
author Vinicius Jose Latorre <viniciusjl@ig.com.br>
date Wed, 25 Jul 2007 00:06:45 +0000
parents 0cffe736a92e
children 9355f9b7bbff
comparison
equal deleted inserted replaced
78213:563fe59a129d 78214:9df605969950
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.4 13 ;; Version: 6.7.5
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.4" 16 (defconst ps-print-version "6.7.5"
17 "ps-print.el, v 6.7.4 <2007/05/13 vinicius> 17 "ps-print.el, v 6.7.5 <2007/07/20 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
2985 (const :tag "Print Always Color" t) 2985 (const :tag "Print Always Color" t)
2986 (const :tag "Print Black/White Color" black-white)) 2986 (const :tag "Print Black/White Color" black-white))
2987 :version "20" 2987 :version "20"
2988 :group 'ps-print-color) 2988 :group 'ps-print-color)
2989 2989
2990 (defcustom ps-default-fg 'frame-parameter 2990 (defcustom ps-default-fg nil
2991 "*RGB values of the default foreground color. 2991 "*RGB values of the default foreground color.
2992 2992
2993 The `ps-default-fg' variable contains the default foreground color used by 2993 The `ps-default-fg' variable contains the default foreground color used by
2994 ps-print, that is, if there is a face in a text that doesn't have a foreground 2994 ps-print, that is, if there is a face in a text that doesn't have a foreground
2995 color, the `ps-default-fg' color should be used. 2995 color, the `ps-default-fg' color should be used.
3028 (number :tag "Green") 3028 (number :tag "Green")
3029 (number :tag "Blue"))) 3029 (number :tag "Blue")))
3030 :version "20" 3030 :version "20"
3031 :group 'ps-print-color) 3031 :group 'ps-print-color)
3032 3032
3033 (defcustom ps-default-bg "white" 3033 (defcustom ps-default-bg nil
3034 "*RGB values of the default background color. 3034 "*RGB values of the default background color.
3035 3035
3036 The `ps-default-bg' variable contains the default background color used by 3036 The `ps-default-bg' variable contains the default background color used by
3037 ps-print, that is, if there is a face in a text that doesn't have a background 3037 ps-print, that is, if there is a face in a text that doesn't have a background
3038 color, the `ps-default-bg' color should be used. 3038 color, the `ps-default-bg' color should be used.
3700 " )\n 3700 " )\n
3701 ;; The following customized variables have long lists and are seldom modified: 3701 ;; The following customized variables have long lists and are seldom modified:
3702 ;; ps-page-dimensions-database 3702 ;; ps-page-dimensions-database
3703 ;; ps-font-info-database 3703 ;; ps-font-info-database
3704 3704
3705 ;;; ps-print - end of settings\n") 3705 \;;; ps-print - end of settings\n")
3706 "\n"))) 3706 "\n")))
3707 3707
3708 3708
3709 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3709 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3710 ;; Utility functions and variables: 3710 ;; Utility functions and variables:
5620 (ps-format-color ps-line-number-color 0.0) 5620 (ps-format-color ps-line-number-color 0.0)
5621 (format "def\n/ZebraHeight %d def\n" 5621 (format "def\n/ZebraHeight %d def\n"
5622 ps-zebra-stripe-height) 5622 ps-zebra-stripe-height)
5623 "/ZebraColor " 5623 "/ZebraColor "
5624 (ps-format-color ps-zebra-color 0.95) 5624 (ps-format-color ps-zebra-color 0.95)
5625 "def\n/BackgroundColor " 5625 "def\n")
5626 (ps-output "/BackgroundColor "
5626 (ps-format-color ps-default-background 1.0) 5627 (ps-format-color ps-default-background 1.0)
5627 "def\n/UseSetpagedevice " 5628 "def\n")
5629 (ps-output "/UseSetpagedevice "
5628 (if (eq ps-spool-config 'setpagedevice) 5630 (if (eq ps-spool-config 'setpagedevice)
5629 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse" 5631 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse"
5630 "false") 5632 "false")
5631 " def\n\n/PageWidth " 5633 " def\n\n/PageWidth "
5632 "PrintPageWidth LeftMargin add RightMargin add def\n\n" 5634 "PrintPageWidth LeftMargin add RightMargin add def\n\n"
5907 ((eq ps-print-control-characters 'control-8-bit) 5909 ((eq ps-print-control-characters 'control-8-bit)
5908 (string-as-unibyte "[\000-\037\177-\237]")) 5910 (string-as-unibyte "[\000-\037\177-\237]"))
5909 ((eq ps-print-control-characters 'control) 5911 ((eq ps-print-control-characters 'control)
5910 "[\000-\037\177]") 5912 "[\000-\037\177]")
5911 (t "[\t\n\f]")) 5913 (t "[\t\n\f]"))
5914 ;; Set the color scale. We do it here instead of in the defvar so
5915 ;; that ps-print can be dumped into emacs. This expression can't be
5916 ;; evaluated at dump-time because X isn't initialized.
5917 ps-color-p (and ps-print-color-p (ps-color-device))
5918 ps-print-color-scale (if ps-color-p
5919 (float (car (ps-color-values "white")))
5920 1.0)
5912 ps-default-background (ps-rgb-color 5921 ps-default-background (ps-rgb-color
5913 (cond 5922 (cond
5914 ((eq genfunc 'ps-generate-postscript) 5923 ((or (not (eq ps-print-color-p t))
5924 (eq genfunc 'ps-generate-postscript))
5915 nil) 5925 nil)
5916 ((eq ps-default-bg 'frame-parameter) 5926 ((eq ps-default-bg 'frame-parameter)
5917 (ps-frame-parameter nil 'background-color)) 5927 (ps-frame-parameter nil 'background-color))
5918 ((eq ps-default-bg t) 5928 ((eq ps-default-bg t)
5919 (ps-face-background-name 'default)) 5929 (ps-face-background-name 'default))
5921 ps-default-bg)) 5931 ps-default-bg))
5922 "unspecified-bg" 5932 "unspecified-bg"
5923 1.0) 5933 1.0)
5924 ps-default-foreground (ps-rgb-color 5934 ps-default-foreground (ps-rgb-color
5925 (cond 5935 (cond
5926 ((eq genfunc 'ps-generate-postscript) 5936 ((or (not (eq ps-print-color-p t))
5937 (eq genfunc 'ps-generate-postscript))
5927 nil) 5938 nil)
5928 ((eq ps-default-fg 'frame-parameter) 5939 ((eq ps-default-fg 'frame-parameter)
5929 (ps-frame-parameter nil 'foreground-color)) 5940 (ps-frame-parameter nil 'foreground-color))
5930 ((eq ps-default-fg t) 5941 ((eq ps-default-fg t)
5931 (ps-face-foreground-name 'default)) 5942 (ps-face-foreground-name 'default))
5932 (t 5943 (t
5933 ps-default-fg)) 5944 ps-default-fg))
5934 "unspecified-fg" 5945 "unspecified-fg"
5935 0.0) 5946 0.0)
5936 ps-default-color (and (eq ps-print-color-p t) ps-default-foreground) 5947 ps-default-color (and (eq ps-print-color-p t)
5937 ps-current-color ps-default-color 5948 ps-default-foreground)
5938 ;; Set the color scale. We do it here instead of in the defvar so 5949 ps-current-color ps-default-color)
5939 ;; that ps-print can be dumped into emacs. This expression can't be
5940 ;; evaluated at dump-time because X isn't initialized.
5941 ps-color-p (and ps-print-color-p (ps-color-device))
5942 ps-print-color-scale (if ps-color-p
5943 (float (car (ps-color-values "white")))
5944 1.0))
5945 ;; initialize page dimensions 5950 ;; initialize page dimensions
5946 (ps-get-page-dimensions) 5951 (ps-get-page-dimensions)
5947 ;; final check 5952 ;; final check
5948 (and ps-color-p 5953 (and ps-color-p
5949 (equal ps-default-background ps-default-foreground) 5954 (equal ps-default-background ps-default-foreground)
7071 7076
7072 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7077 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7073 7078
7074 (provide 'ps-print) 7079 (provide 'ps-print)
7075 7080
7076 ;;; arch-tag: fb06a585-1112-4206-885d-a57d95d50579 7081 ;; arch-tag: fb06a585-1112-4206-885d-a57d95d50579
7077 ;;; ps-print.el ends here 7082 ;;; ps-print.el ends here