5 |
|
|
6 |
;; Author: Jim Thompson (was <thompson@wg2.waii.com>) |
;; Author: Jim Thompson (was <thompson@wg2.waii.com>) |
7 |
;; Jacques Duthen (was <duthen@cegelec-red.fr>) |
;; Jacques Duthen (was <duthen@cegelec-red.fr>) |
8 |
;; Vinicius Jose Latorre <vinicius@cpqd.com.br> |
;; Vinicius Jose Latorre <viniciusjl@ig.com.br> |
9 |
;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
;; Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
10 |
;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
11 |
;; Vinicius Jose Latorre <vinicius@cpqd.com.br> |
;; Vinicius Jose Latorre <viniciusjl@ig.com.br> |
12 |
;; Keywords: wp, print, PostScript |
;; Keywords: wp, print, PostScript |
13 |
;; Time-stamp: <2003/02/12 14:05:44 vinicius> |
;; Time-stamp: <2003/03/05 21:54:55 vinicius> |
14 |
;; Version: 6.5.9 |
;; Version: 6.6 |
15 |
;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
16 |
|
|
17 |
(defconst ps-print-version "6.5.9" |
(defconst ps-print-version "6.6" |
18 |
"ps-print.el, v 6.5.9 <2003/02/12 vinicius> |
"ps-print.el, v 6.6 <2003/03/05 vinicius> |
19 |
|
|
20 |
Vinicius's last change version -- this file may have been edited as part of |
Vinicius's last change version -- this file may have been edited as part of |
21 |
Emacs without changes to the version number. When reporting bugs, please also |
Emacs without changes to the version number. When reporting bugs, please also |
22 |
report the version of Emacs, if any, that ps-print was distributed with. |
report the version of Emacs, if any, that ps-print was distributed with. |
23 |
|
|
24 |
Please send all bug fixes and enhancements to |
Please send all bug fixes and enhancements to |
25 |
Vinicius Jose Latorre <vinicius@cpqd.com.br>.") |
Vinicius Jose Latorre <viniciusjl@ig.com.br>.") |
26 |
|
|
27 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
28 |
|
|
1075 |
;; (face...) list of faces whose background color will be used. |
;; (face...) list of faces whose background color will be used. |
1076 |
;; |
;; |
1077 |
;; Any other value will be treated as t. |
;; Any other value will be treated as t. |
1078 |
;; The default value is t. |
;; The default value is nil. |
1079 |
;; |
;; |
1080 |
;; |
;; |
1081 |
;; How Ps-Print Deals With Color |
;; How Ps-Print Deals With Color |
1211 |
;; New since version 2.8 |
;; New since version 2.8 |
1212 |
;; --------------------- |
;; --------------------- |
1213 |
;; |
;; |
1214 |
;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> |
;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> |
1215 |
;; |
;; |
1216 |
;; 20010619 |
;; 20010619 |
1217 |
;; `ps-time-stamp-locale-default' |
;; `ps-time-stamp-locale-default' |
1263 |
;; |
;; |
1264 |
;; `ps-print-region-function' |
;; `ps-print-region-function' |
1265 |
;; |
;; |
1266 |
;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> |
;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> |
1267 |
;; |
;; |
1268 |
;; 19990301 |
;; 19990301 |
1269 |
;; PostScript tumble and setpagedevice. |
;; PostScript tumble and setpagedevice. |
1276 |
;; |
;; |
1277 |
;; Multi-byte buffer handling. |
;; Multi-byte buffer handling. |
1278 |
;; |
;; |
1279 |
;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> |
;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br> |
1280 |
;; |
;; |
1281 |
;; 19980306 |
;; 19980306 |
1282 |
;; Skip invisible text. |
;; Skip invisible text. |
1708 |
requirements and set %%LanguageLevel: to 2, do: |
requirements and set %%LanguageLevel: to 2, do: |
1709 |
|
|
1710 |
(setq ps-print-prologue-header |
(setq ps-print-prologue-header |
1711 |
\"%%+ numcopies(3) jog\\n%%LanguageLevel: 2\\n\") |
\"%%+ numcopies(3) jog\\n%%LanguageLevel: 2\\n\") |
1712 |
|
|
1713 |
The duplex requirement is inserted by ps-print (see `ps-spool-duplex'). |
The duplex requirement is inserted by ps-print (see `ps-spool-duplex'). |
1714 |
|
|
1906 |
|
|
1907 |
If a list, the lists element may be an integer or a cons cell (FROM . TO) |
If a list, the lists element may be an integer or a cons cell (FROM . TO) |
1908 |
designating FROM page to TO page; any invalid element is ignored, that is, an |
designating FROM page to TO page; any invalid element is ignored, that is, an |
1909 |
integer less than one or if FROM is greater than TO. |
integer lesser than one or if FROM is greater than TO. |
1910 |
|
|
1911 |
Otherwise, it's treated as nil. |
Otherwise, it's treated as nil. |
1912 |
|
|
2918 |
:group 'ps-print-color) |
:group 'ps-print-color) |
2919 |
|
|
2920 |
(defcustom ps-default-fg '(0.0 0.0 0.0) ; black |
(defcustom ps-default-fg '(0.0 0.0 0.0) ; black |
2921 |
"*RGB values of the default foreground color. Defaults to black." |
"*RGB values of the default foreground color. Defaults to black. |
2922 |
|
|
2923 |
|
The `ps-default-fg' variable contains the default foreground color used by |
2924 |
|
ps-print, that is, if there is a face in a text that doesn't have a foreground |
2925 |
|
color, the `ps-default-fg' color should be used. |
2926 |
|
|
2927 |
|
Valid 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 |
|
|
2945 |
|
Any other value is ignored and it's used the black color. |
2946 |
|
|
2947 |
|
It's used only when `ps-print-color-p' is non-nil." |
2948 |
:type '(choice :menu-tag "Default Foreground Gray/Color" |
:type '(choice :menu-tag "Default Foreground Gray/Color" |
2949 |
:tag "Default Foreground Gray/Color" |
:tag "Default Foreground Gray/Color" |
2950 |
(const :tag "Session Foreground" t) |
(const :tag "Session Foreground" t) |
2957 |
:group 'ps-print-color) |
:group 'ps-print-color) |
2958 |
|
|
2959 |
(defcustom ps-default-bg '(1.0 1.0 1.0) ; white |
(defcustom ps-default-bg '(1.0 1.0 1.0) ; white |
2960 |
"*RGB values of the default background color. Defaults to white." |
"*RGB values of the default background color. Defaults to white. |
2961 |
|
|
2962 |
|
The `ps-default-bg' variable contains the default background color used by |
2963 |
|
ps-print, that is, if there is a face in a text that doesn't have a background |
2964 |
|
color, the `ps-default-bg' color should be used. |
2965 |
|
|
2966 |
|
Valid 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 |
|
|
2984 |
|
Any other value is ignored and it's used the white color. |
2985 |
|
|
2986 |
|
It's used only when `ps-print-color-p' is non-nil. |
2987 |
|
|
2988 |
|
See also `ps-use-face-background'." |
2989 |
:type '(choice :menu-tag "Default Background Gray/Color" |
:type '(choice :menu-tag "Default Background Gray/Color" |
2990 |
:tag "Default Background Gray/Color" |
:tag "Default Background Gray/Color" |
2991 |
(const :tag "Session Background" t) |
(const :tag "Session Background" t) |
3871 |
|
|
3872 |
(defvar ps-current-font 0) |
(defvar ps-current-font 0) |
3873 |
(defvar ps-default-foreground nil) |
(defvar ps-default-foreground nil) |
3874 |
|
(defvar ps-default-background nil) |
3875 |
(defvar ps-default-color nil) |
(defvar ps-default-color nil) |
3876 |
(defvar ps-current-color nil) |
(defvar ps-current-color nil) |
3877 |
(defvar ps-current-bg nil) |
(defvar ps-current-bg nil) |
5440 |
"/ZebraColor " |
"/ZebraColor " |
5441 |
(ps-format-color ps-zebra-color 0.95) |
(ps-format-color ps-zebra-color 0.95) |
5442 |
"def\n/BackgroundColor " |
"def\n/BackgroundColor " |
5443 |
(ps-format-color |
(ps-format-color ps-default-background 1.0) |
|
(if (eq ps-default-bg t) |
|
|
(ps-face-background-name 'default) |
|
|
ps-default-bg) |
|
|
1.0) |
|
5444 |
"def\n/UseSetpagedevice " |
"def\n/UseSetpagedevice " |
5445 |
(if (eq ps-spool-config 'setpagedevice) |
(if (eq ps-spool-config 'setpagedevice) |
5446 |
"/setpagedevice where{pop languagelevel 2 eq}{false}ifelse" |
"/setpagedevice where{pop languagelevel 2 eq}{false}ifelse" |
5624 |
(ps-get-size (symbol-value font-sym) "font size" font-sym)) |
(ps-get-size (symbol-value font-sym) "font size" font-sym)) |
5625 |
|
|
5626 |
|
|
5627 |
(defsubst ps-rgb-color (color default) |
(defun ps-rgb-color (color default) |
5628 |
(cond ((and color (listp color)) color) |
(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)) |
5639 |
((stringp color) (ps-color-scale color)) |
((stringp color) (ps-color-scale color)) |
|
((numberp color) (list color color color)) |
|
5640 |
(t (list default default default)) |
(t (list default default default)) |
5641 |
)) |
)) |
5642 |
|
|
5710 |
((eq ps-print-control-characters 'control) |
((eq ps-print-control-characters 'control) |
5711 |
"[\000-\037\177]") |
"[\000-\037\177]") |
5712 |
(t "[\t\n\f]")) |
(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) |
5718 |
ps-default-foreground (ps-rgb-color |
ps-default-foreground (ps-rgb-color |
5719 |
(if (eq ps-default-fg t) |
(if (eq ps-default-fg t) |
5720 |
(ps-face-foreground-name 'default) |
(ps-face-foreground-name 'default) |
5730 |
(float (car (ps-color-values "white"))) |
(float (car (ps-color-values "white"))) |
5731 |
1.0)) |
1.0)) |
5732 |
;; initialize page dimensions |
;; initialize page dimensions |
5733 |
(ps-get-page-dimensions)) |
(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.")))) |
5741 |
|
|
5742 |
|
|
5743 |
(defun ps-page-number () |
(defun ps-page-number () |