aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Jose Latorre2003-03-06 01:54:17 +0000
committerVinicius Jose Latorre2003-03-06 01:54:17 +0000
commite59d29d6b77d482b05dbad88a4841475ac664fc7 (patch)
tree2a5f69b8f1da897abd7c27b51a33ba17fc20ea12
parent2f2f7e58d4f712e7728e90d9a30bf8d620af1d54 (diff)
downloademacs-e59d29d6b77d482b05dbad88a4841475ac664fc7.tar.gz
emacs-e59d29d6b77d482b05dbad88a4841475ac664fc7.zip
Check if background and foreground color are the same.
-rw-r--r--lisp/ps-print.el120
1 files changed, 96 insertions, 24 deletions
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index b6af2da0d1d..f26908746fd 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -5,24 +5,24 @@
5 5
6;; Author: Jim Thompson (was <thompson@wg2.waii.com>) 6;; Author: Jim Thompson (was <thompson@wg2.waii.com>)
7;; Jacques Duthen (was <duthen@cegelec-red.fr>) 7;; Jacques Duthen (was <duthen@cegelec-red.fr>)
8;; Vinicius Jose Latorre <vinicius@cpqd.com.br> 8;; Vinicius Jose Latorre <viniciusjl@ig.com.br>
9;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) 9;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
10;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) 10;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
11;; Vinicius Jose Latorre <vinicius@cpqd.com.br> 11;; Vinicius Jose Latorre <viniciusjl@ig.com.br>
12;; Keywords: wp, print, PostScript 12;; Keywords: wp, print, PostScript
13;; Time-stamp: <2003/02/12 14:05:44 vinicius> 13;; Time-stamp: <2003/03/05 21:54:55 vinicius>
14;; Version: 6.5.9 14;; Version: 6.6
15;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ 15;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
16 16
17(defconst ps-print-version "6.5.9" 17(defconst ps-print-version "6.6"
18 "ps-print.el, v 6.5.9 <2003/02/12 vinicius> 18 "ps-print.el, v 6.6 <2003/03/05 vinicius>
19 19
20Vinicius's last change version -- this file may have been edited as part of 20Vinicius's last change version -- this file may have been edited as part of
21Emacs without changes to the version number. When reporting bugs, please also 21Emacs without changes to the version number. When reporting bugs, please also
22report the version of Emacs, if any, that ps-print was distributed with. 22report the version of Emacs, if any, that ps-print was distributed with.
23 23
24Please send all bug fixes and enhancements to 24Please send all bug fixes and enhancements to
25 Vinicius Jose Latorre <vinicius@cpqd.com.br>.") 25 Vinicius Jose Latorre <viniciusjl@ig.com.br>.")
26 26
27;; This file is part of GNU Emacs. 27;; This file is part of GNU Emacs.
28 28
@@ -1075,7 +1075,7 @@ Please send all bug fixes and enhancements to
1075;; (face...) list of faces whose background color will be used. 1075;; (face...) list of faces whose background color will be used.
1076;; 1076;;
1077;; Any other value will be treated as t. 1077;; Any other value will be treated as t.
1078;; The default value is t. 1078;; The default value is nil.
1079;; 1079;;
1080;; 1080;;
1081;; How Ps-Print Deals With Color 1081;; How Ps-Print Deals With Color
@@ -1211,7 +1211,7 @@ Please send all bug fixes and enhancements to
1211;; New since version 2.8 1211;; New since version 2.8
1212;; --------------------- 1212;; ---------------------
1213;; 1213;;
1214;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> 1214;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br>
1215;; 1215;;
1216;; 20010619 1216;; 20010619
1217;; `ps-time-stamp-locale-default' 1217;; `ps-time-stamp-locale-default'
@@ -1263,7 +1263,7 @@ Please send all bug fixes and enhancements to
1263;; 1263;;
1264;; `ps-print-region-function' 1264;; `ps-print-region-function'
1265;; 1265;;
1266;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> 1266;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br>
1267;; 1267;;
1268;; 19990301 1268;; 19990301
1269;; PostScript tumble and setpagedevice. 1269;; PostScript tumble and setpagedevice.
@@ -1276,7 +1276,7 @@ Please send all bug fixes and enhancements to
1276;; 1276;;
1277;; Multi-byte buffer handling. 1277;; Multi-byte buffer handling.
1278;; 1278;;
1279;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> 1279;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br>
1280;; 1280;;
1281;; 19980306 1281;; 19980306
1282;; Skip invisible text. 1282;; Skip invisible text.
@@ -1708,7 +1708,7 @@ more requirements put them first in `ps-print-prologue-header' using the
1708requirements and set %%LanguageLevel: to 2, do: 1708requirements and set %%LanguageLevel: to 2, do:
1709 1709
1710 (setq ps-print-prologue-header 1710 (setq ps-print-prologue-header
1711 \"%%+ numcopies(3) jog\\n%%LanguageLevel: 2\\n\") 1711 \"%%+ numcopies(3) jog\\n%%LanguageLevel: 2\\n\")
1712 1712
1713The duplex requirement is inserted by ps-print (see `ps-spool-duplex'). 1713The duplex requirement is inserted by ps-print (see `ps-spool-duplex').
1714 1714
@@ -1906,7 +1906,7 @@ If nil, print all pages.
1906 1906
1907If a list, the lists element may be an integer or a cons cell (FROM . TO) 1907If a list, the lists element may be an integer or a cons cell (FROM . TO)
1908designating FROM page to TO page; any invalid element is ignored, that is, an 1908designating FROM page to TO page; any invalid element is ignored, that is, an
1909integer less than one or if FROM is greater than TO. 1909integer lesser than one or if FROM is greater than TO.
1910 1910
1911Otherwise, it's treated as nil. 1911Otherwise, it's treated as nil.
1912 1912
@@ -2918,7 +2918,33 @@ Any other value is treated as t."
2918 :group 'ps-print-color) 2918 :group 'ps-print-color)
2919 2919
2920(defcustom ps-default-fg '(0.0 0.0 0.0) ; black 2920(defcustom ps-default-fg '(0.0 0.0 0.0) ; black
2921 "*RGB values of the default foreground color. Defaults to black." 2921 "*RGB values of the default foreground color. Defaults to black.
2922
2923The `ps-default-fg' variable contains the default foreground color used by
2924ps-print, that is, if there is a face in a text that doesn't have a foreground
2925color, the `ps-default-fg' color should be used.
2926
2927Valid values are:
2928
2929 t The foreground color of Emacs session will be used.
2930
2931 NUMBER It's a real value between 0.0 (black) and 1.0 (white) that
2932 indicate the gray color.
2933
2934 COLOR-NAME It's a string wich contains the color name. For example:
2935 \"yellow\".
2936
2937 LIST It's a list of RGB values, that is a list of three real values
2938 of the form:
2939
2940 (RED, GREEN, BLUE)
2941
2942 Where RED, GREEN and BLUE are reals between 0.0 (no color) and
2943 1.0 (full color).
2944
2945Any other value is ignored and it's used the black color.
2946
2947It's used only when `ps-print-color-p' is non-nil."
2922 :type '(choice :menu-tag "Default Foreground Gray/Color" 2948 :type '(choice :menu-tag "Default Foreground Gray/Color"
2923 :tag "Default Foreground Gray/Color" 2949 :tag "Default Foreground Gray/Color"
2924 (const :tag "Session Foreground" t) 2950 (const :tag "Session Foreground" t)
@@ -2931,7 +2957,35 @@ Any other value is treated as t."
2931 :group 'ps-print-color) 2957 :group 'ps-print-color)
2932 2958
2933(defcustom ps-default-bg '(1.0 1.0 1.0) ; white 2959(defcustom ps-default-bg '(1.0 1.0 1.0) ; white
2934 "*RGB values of the default background color. Defaults to white." 2960 "*RGB values of the default background color. Defaults to white.
2961
2962The `ps-default-bg' variable contains the default background color used by
2963ps-print, that is, if there is a face in a text that doesn't have a background
2964color, the `ps-default-bg' color should be used.
2965
2966Valid values are:
2967
2968 t The background color of Emacs session will be used.
2969
2970 NUMBER It's a real value between 0.0 (black) and 1.0 (white) that
2971 indicate the gray color.
2972
2973 COLOR-NAME It's a string wich contains the color name. For example:
2974 \"yellow\".
2975
2976 LIST It's a list of RGB values, that is a list of three real values
2977 of the form:
2978
2979 (RED, GREEN, BLUE)
2980
2981 Where RED, GREEN and BLUE are reals between 0.0 (no color) and
2982 1.0 (full color).
2983
2984Any other value is ignored and it's used the white color.
2985
2986It's used only when `ps-print-color-p' is non-nil.
2987
2988See also `ps-use-face-background'."
2935 :type '(choice :menu-tag "Default Background Gray/Color" 2989 :type '(choice :menu-tag "Default Background Gray/Color"
2936 :tag "Default Background Gray/Color" 2990 :tag "Default Background Gray/Color"
2937 (const :tag "Session Background" t) 2991 (const :tag "Session Background" t)
@@ -3817,6 +3871,7 @@ Note: No major/minor-mode is activated and no local variables are evaluated for
3817 3871
3818(defvar ps-current-font 0) 3872(defvar ps-current-font 0)
3819(defvar ps-default-foreground nil) 3873(defvar ps-default-foreground nil)
3874(defvar ps-default-background nil)
3820(defvar ps-default-color nil) 3875(defvar ps-default-color nil)
3821(defvar ps-current-color nil) 3876(defvar ps-current-color nil)
3822(defvar ps-current-bg nil) 3877(defvar ps-current-bg nil)
@@ -5385,11 +5440,7 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5385 "/ZebraColor " 5440 "/ZebraColor "
5386 (ps-format-color ps-zebra-color 0.95) 5441 (ps-format-color ps-zebra-color 0.95)
5387 "def\n/BackgroundColor " 5442 "def\n/BackgroundColor "
5388 (ps-format-color 5443 (ps-format-color ps-default-background 1.0)
5389 (if (eq ps-default-bg t)
5390 (ps-face-background-name 'default)
5391 ps-default-bg)
5392 1.0)
5393 "def\n/UseSetpagedevice " 5444 "def\n/UseSetpagedevice "
5394 (if (eq ps-spool-config 'setpagedevice) 5445 (if (eq ps-spool-config 'setpagedevice)
5395 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse" 5446 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse"
@@ -5573,10 +5624,19 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5573 (ps-get-size (symbol-value font-sym) "font size" font-sym)) 5624 (ps-get-size (symbol-value font-sym) "font size" font-sym))
5574 5625
5575 5626
5576(defsubst ps-rgb-color (color default) 5627(defun ps-rgb-color (color default)
5577 (cond ((and color (listp color)) color) 5628 (cond ((and color (listp color) (= (length color) 3)
5629 (let ((cl color)
5630 (ok t) e)
5631 (while (and ok cl)
5632 (setq e (car cl)
5633 cl (cdr cl)
5634 ok (and (floatp e) (<= 0.0 e) (<= e 1.0))))
5635 ok))
5636 color)
5637 ((and (floatp color) (<= 0.0 color) (<= color 1.0))
5638 (list color color color))
5578 ((stringp color) (ps-color-scale color)) 5639 ((stringp color) (ps-color-scale color))
5579 ((numberp color) (list color color color))
5580 (t (list default default default)) 5640 (t (list default default default))
5581 )) 5641 ))
5582 5642
@@ -5650,6 +5710,11 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5650 ((eq ps-print-control-characters 'control) 5710 ((eq ps-print-control-characters 'control)
5651 "[\000-\037\177]") 5711 "[\000-\037\177]")
5652 (t "[\t\n\f]")) 5712 (t "[\t\n\f]"))
5713 ps-default-background (ps-rgb-color
5714 (if (eq ps-default-bg t)
5715 (ps-face-background-name 'default)
5716 ps-default-bg)
5717 1.0)
5653 ps-default-foreground (ps-rgb-color 5718 ps-default-foreground (ps-rgb-color
5654 (if (eq ps-default-fg t) 5719 (if (eq ps-default-fg t)
5655 (ps-face-foreground-name 'default) 5720 (ps-face-foreground-name 'default)
@@ -5665,7 +5730,14 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5665 (float (car (ps-color-values "white"))) 5730 (float (car (ps-color-values "white")))
5666 1.0)) 5731 1.0))
5667 ;; initialize page dimensions 5732 ;; initialize page dimensions
5668 (ps-get-page-dimensions)) 5733 (ps-get-page-dimensions)
5734 ;; final check
5735 (and ps-color-p
5736 (equal ps-default-background ps-default-foreground)
5737 (error
5738 (concat
5739 "`ps-default-fg' and `ps-default-bg' have the same color.\n"
5740 "Text won't appear on page. Please, check these variables."))))
5669 5741
5670 5742
5671(defun ps-page-number () 5743(defun ps-page-number ()