Mercurial > emacs
comparison lisp/ps-print.el @ 36215:f2ca7236963b
Timestamp package replacement. Some enhancements. Some
XEmacs compatibility. Doc Fix.
(ps-print-version): New version number (6.4).
(ps-printer-name): Initialization fix.
(ps-zebra-stripe-follow): Funcionality enhancement.
(ps-prologue-file): Code enhancement.
(ps-right-header): Timestamp package replacement.
(ps-setup, ps-face-bold-p, ps-face-italic-p, ps-get-page-dimensions)
(ps-generate-header, ps-begin-file, ps-begin-job)
(ps-generate-postscript-with-faces, ps-do-despool): Code fix.
(ps-time-stamp-mon-dd-yyyy, ps-time-stamp-hh:mm:ss): New funs.
(ps-zebra-stripe-full-p, ps-zebra-stripe-alist): New vars.
(coding-system-for-write): Var declaration (XEmacs compatibility).
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 20 Feb 2001 10:41:10 +0000 |
parents | 2357e03b072b |
children | 18c2d3c6096d |
comparison
equal
deleted
inserted
replaced
36214:11cbcb44751d | 36215:f2ca7236963b |
---|---|
1 ;;; ps-print.el --- Print text from the buffer as PostScript | 1 ;;; ps-print.el --- Print text from the buffer as PostScript |
2 | 2 |
3 ;; Copyright (C) 1993,94,95,96,97,98,99,2000 | 3 ;; Copyright (C) 1993,94,95,96,97,98,99,00,2001 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>) | 6 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>) |
7 ;; Author: Jacques Duthen (was <duthen@cegelec-red.fr>) | 7 ;; Author: Jacques Duthen (was <duthen@cegelec-red.fr>) |
8 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> | 8 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
9 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 9 ;; Author: 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 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> | 11 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
12 ;; Keywords: wp, print, PostScript | 12 ;; Keywords: wp, print, PostScript |
13 ;; Time-stamp: <2000/12/26 23:19:24 Vinicius> | 13 ;; Time-stamp: <2001/02/19 14:54:52 Vinicius> |
14 ;; Version: 6.3.3 | 14 ;; Version: 6.4 |
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.3.3" | 17 (defconst ps-print-version "6.4" |
18 "ps-print.el, v 6.3.3 <2000/12/26 vinicius> | 18 "ps-print.el, v 6.4 <2001/02/19 vinicius> |
19 | 19 |
20 Vinicius's last change version -- this file may have been edited as part of | 20 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 | 21 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. | 22 report the version of Emacs, if any, that ps-print was distributed with. |
23 | 23 |
755 ;; color. It should be a float number between 0.0 (black color) and 1.0 (white | 755 ;; color. It should be a float number between 0.0 (black color) and 1.0 (white |
756 ;; color), a string which is a color name, or a list of 3 numbers which | 756 ;; color), a string which is a color name, or a list of 3 numbers which |
757 ;; corresponds to the Red Green Blue color scale. | 757 ;; corresponds to the Red Green Blue color scale. |
758 ;; The default is 0.95 (or "gray95", or '(0.95 0.95 0.95)). | 758 ;; The default is 0.95 (or "gray95", or '(0.95 0.95 0.95)). |
759 ;; | 759 ;; |
760 ;; The variable `ps-zebra-stripe-follow' specifies if zebra stripe should | 760 ;; The variable `ps-zebra-stripe-follow' specifies how zebra stripes continue |
761 ;; continue on next page or restart on each page. If `ps-zebra-stripe-follow' | 761 ;; on next page. Visually, valid values are (the character `+' at right of |
762 ;; is nil, zebra stripe is restarted on each page. If `ps-zebra-stripe-follow' | 762 ;; each column indicates that a line is printed): |
763 ;; is non-nil, zebra stripe continues on next page. Visually, we have: | 763 ;; |
764 ;; | 764 ;; `nil' `follow' `full' `full-follow' |
765 ;; `ps-zebra-stripe-follow' `ps-zebra-stripe-follow' | 765 ;; Current Page -------- ----------- --------- ---------------- |
766 ;; is nil is non-nil | 766 ;; 1 XXXXX + 1 XXXXXXXX + 1 XXXXXX + 1 XXXXXXXXXXXXX + |
767 ;; Current Page ------------------------ ------------------------ | 767 ;; 2 XXXXX + 2 XXXXXXXX + 2 XXXXXX + 2 XXXXXXXXXXXXX + |
768 ;; 1 XXXXXXXXXXXXXXXXXXXXX 1 XXXXXXXXXXXXXXXXXXXXX | 768 ;; 3 XXXXX + 3 XXXXXXXX + 3 XXXXXX + 3 XXXXXXXXXXXXX + |
769 ;; 2 XXXXXXXXXXXXXXXXXXXXX 2 XXXXXXXXXXXXXXXXXXXXX | 769 ;; 4 + 4 + 4 + 4 + |
770 ;; 3 XXXXXXXXXXXXXXXXXXXXX 3 XXXXXXXXXXXXXXXXXXXXX | 770 ;; 5 + 5 + 5 + 5 + |
771 ;; 4 4 | 771 ;; 6 + 6 + 6 + 6 + |
772 ;; 5 5 | 772 ;; 7 XXXXX + 7 XXXXXXXX + 7 XXXXXX + 7 XXXXXXXXXXXXX + |
773 ;; 6 6 | 773 ;; 8 XXXXX + 8 XXXXXXXX + 8 XXXXXX + 8 XXXXXXXXXXXXX + |
774 ;; 7 XXXXXXXXXXXXXXXXXXXXX 7 XXXXXXXXXXXXXXXXXXXXX | 774 ;; 9 XXXXX + 9 XXXXXXXX + 9 XXXXXX + 9 XXXXXXXXXXXXX + |
775 ;; 8 XXXXXXXXXXXXXXXXXXXXX 8 XXXXXXXXXXXXXXXXXXXXX | 775 ;; 10 + 10 + |
776 ;; ------------------------ ------------------------ | 776 ;; 11 + 11 + |
777 ;; Next Page ------------------------ ------------------------ | 777 ;; -------- ----------- --------- ---------------- |
778 ;; 9 XXXXXXXXXXXXXXXXXXXXX 9 XXXXXXXXXXXXXXXXXXXXX | 778 ;; Next Page -------- ----------- --------- ---------------- |
779 ;; 10 XXXXXXXXXXXXXXXXXXXXX 10 | 779 ;; 12 XXXXX + 12 + 10 XXXXXX + 10 + |
780 ;; 11 XXXXXXXXXXXXXXXXXXXXX 11 | 780 ;; 13 XXXXX + 13 XXXXXXXX + 11 XXXXXX + 11 + |
781 ;; 12 12 | 781 ;; 14 XXXXX + 14 XXXXXXXX + 12 XXXXXX + 12 + |
782 ;; 13 13 XXXXXXXXXXXXXXXXXXXXX | 782 ;; 15 + 15 XXXXXXXX + 13 + 13 XXXXXXXXXXXXX + |
783 ;; 14 14 XXXXXXXXXXXXXXXXXXXXX | 783 ;; 16 + 16 + 14 + 14 XXXXXXXXXXXXX + |
784 ;; 15 XXXXXXXXXXXXXXXXXXXXX 15 XXXXXXXXXXXXXXXXXXXXX | 784 ;; 17 + 17 + 15 + 15 XXXXXXXXXXXXX + |
785 ;; 16 XXXXXXXXXXXXXXXXXXXXX 16 | 785 ;; 18 XXXXX + 18 + 16 XXXXXX + 16 + |
786 ;; ------------------------ ------------------------ | 786 ;; 19 XXXXX + 19 XXXXXXXX + 17 XXXXXX + 17 + |
787 ;; 20 XXXXX + 20 XXXXXXXX + 18 XXXXXX + 18 + | |
788 ;; 21 + 21 XXXXXXXX + | |
789 ;; 22 + 22 + | |
790 ;; -------- ----------- --------- ---------------- | |
791 ;; | |
792 ;; Any other value is treated as `nil'. | |
787 ;; | 793 ;; |
788 ;; See also section How Ps-Print Has A Text And/Or Image On Background. | 794 ;; See also section How Ps-Print Has A Text And/Or Image On Background. |
789 ;; | 795 ;; |
790 ;; | 796 ;; |
791 ;; Hooks | 797 ;; Hooks |
1261 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for upside-down, | 1267 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for upside-down, |
1262 ;; line number step, line number start and zebra stripe follow suggestions, and | 1268 ;; line number step, line number start and zebra stripe follow suggestions, and |
1263 ;; for XEmacs beta-tests. | 1269 ;; for XEmacs beta-tests. |
1264 ;; | 1270 ;; |
1265 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript | 1271 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript |
1266 ;; prologue code suggestion and for odd/even printing suggestion. | 1272 ;; prologue code suggestion, for odd/even printing suggestion and for |
1273 ;; `ps-prologue-file' enhancement. | |
1267 ;; | 1274 ;; |
1268 ;; Thanks to Kein'ichi Handa <handa@etl.go.jp> for multi-byte buffer handling. | 1275 ;; Thanks to Kein'ichi Handa <handa@etl.go.jp> for multi-byte buffer handling. |
1269 ;; | 1276 ;; |
1270 ;; Thanks to Matthew O Persico <Matthew.Persico@lazard.com> for line number on | 1277 ;; Thanks to Matthew O Persico <Matthew.Persico@lazard.com> for line number on |
1271 ;; empty columns. | 1278 ;; empty columns. |
1377 (defalias 'ps-x-font-instance-properties 'font-instance-properties) | 1384 (defalias 'ps-x-font-instance-properties 'font-instance-properties) |
1378 (defalias 'ps-x-make-color-instance 'make-color-instance) | 1385 (defalias 'ps-x-make-color-instance 'make-color-instance) |
1379 (defalias 'ps-x-map-extents 'map-extents) | 1386 (defalias 'ps-x-map-extents 'map-extents) |
1380 | 1387 |
1381 ;; GNU Emacs | 1388 ;; GNU Emacs |
1382 (defalias 'ps-e-x-color-values 'x-color-values) | 1389 (defalias 'ps-e-face-bold-p 'face-bold-p) |
1383 (defalias 'ps-e-color-values 'color-values) | 1390 (defalias 'ps-e-face-italic-p 'face-italic-p) |
1391 (defalias 'ps-e-next-overlay-change 'next-overlay-change) | |
1392 (defalias 'ps-e-overlays-at 'overlays-at) | |
1393 (defalias 'ps-e-overlay-get 'overlay-get) | |
1394 (defalias 'ps-e-x-color-values 'x-color-values) | |
1395 (defalias 'ps-e-color-values 'color-values) | |
1384 (if (fboundp 'find-composition) | 1396 (if (fboundp 'find-composition) |
1385 (defalias 'ps-e-find-composition 'find-composition) | 1397 (defalias 'ps-e-find-composition 'find-composition) |
1386 (defalias 'ps-e-find-composition 'ignore)) | 1398 (defalias 'ps-e-find-composition 'ignore)) |
1387 | 1399 |
1388 | 1400 |
1569 :tag "Prologue Header" | 1581 :tag "Prologue Header" |
1570 (const :tag "none" nil) string symbol) | 1582 (const :tag "none" nil) string symbol) |
1571 :group 'ps-print-miscellany) | 1583 :group 'ps-print-miscellany) |
1572 | 1584 |
1573 (defcustom ps-printer-name (and (boundp 'printer-name) | 1585 (defcustom ps-printer-name (and (boundp 'printer-name) |
1574 printer-name) | 1586 (symbol-value 'printer-name)) |
1575 "*The name of a local printer for printing PostScript files. | 1587 "*The name of a local printer for printing PostScript files. |
1576 | 1588 |
1577 On Unix-like systems, a string value should be a name understood by lpr's -P | 1589 On Unix-like systems, a string value should be a name understood by lpr's -P |
1578 option; a value of nil means use the value of `printer-name' instead. | 1590 option; a value of nil means use the value of `printer-name' instead. |
1579 | 1591 |
1941 (number :tag "Green") | 1953 (number :tag "Green") |
1942 (number :tag "Blue"))) | 1954 (number :tag "Blue"))) |
1943 :group 'ps-print-zebra) | 1955 :group 'ps-print-zebra) |
1944 | 1956 |
1945 (defcustom ps-zebra-stripe-follow nil | 1957 (defcustom ps-zebra-stripe-follow nil |
1946 "*Non-nil means zebra stripe continues on next page. | 1958 "*Specify how zebra stripes continue on next page. |
1947 | 1959 |
1948 If `ps-zebra-stripe-follow' is nil, zebra stripe is restarted on each page. | 1960 Visually, valid values are (the character `+' at right of each column indicates |
1949 If `ps-zebra-stripe-follow' is non-nil, zebra stripe continues on next page. | 1961 that a line is printed): |
1950 | 1962 |
1951 Visually, we have: | 1963 `nil' `follow' `full' `full-follow' |
1952 | 1964 Current Page -------- ----------- --------- ---------------- |
1953 `ps-zebra-stripe-follow' `ps-zebra-stripe-follow' | 1965 1 XXXXX + 1 XXXXXXXX + 1 XXXXXX + 1 XXXXXXXXXXXXX + |
1954 is nil is non-nil | 1966 2 XXXXX + 2 XXXXXXXX + 2 XXXXXX + 2 XXXXXXXXXXXXX + |
1955 Current Page ------------------------ ------------------------ | 1967 3 XXXXX + 3 XXXXXXXX + 3 XXXXXX + 3 XXXXXXXXXXXXX + |
1956 1 XXXXXXXXXXXXXXXXXXXXX 1 XXXXXXXXXXXXXXXXXXXXX | 1968 4 + 4 + 4 + 4 + |
1957 2 XXXXXXXXXXXXXXXXXXXXX 2 XXXXXXXXXXXXXXXXXXXXX | 1969 5 + 5 + 5 + 5 + |
1958 3 XXXXXXXXXXXXXXXXXXXXX 3 XXXXXXXXXXXXXXXXXXXXX | 1970 6 + 6 + 6 + 6 + |
1959 4 4 | 1971 7 XXXXX + 7 XXXXXXXX + 7 XXXXXX + 7 XXXXXXXXXXXXX + |
1960 5 5 | 1972 8 XXXXX + 8 XXXXXXXX + 8 XXXXXX + 8 XXXXXXXXXXXXX + |
1961 6 6 | 1973 9 XXXXX + 9 XXXXXXXX + 9 XXXXXX + 9 XXXXXXXXXXXXX + |
1962 7 XXXXXXXXXXXXXXXXXXXXX 7 XXXXXXXXXXXXXXXXXXXXX | 1974 10 + 10 + |
1963 8 XXXXXXXXXXXXXXXXXXXXX 8 XXXXXXXXXXXXXXXXXXXXX | 1975 11 + 11 + |
1964 ------------------------ ------------------------ | 1976 -------- ----------- --------- ---------------- |
1965 Next Page ------------------------ ------------------------ | 1977 Next Page -------- ----------- --------- ---------------- |
1966 9 XXXXXXXXXXXXXXXXXXXXX 9 XXXXXXXXXXXXXXXXXXXXX | 1978 12 XXXXX + 12 + 10 XXXXXX + 10 + |
1967 10 XXXXXXXXXXXXXXXXXXXXX 10 | 1979 13 XXXXX + 13 XXXXXXXX + 11 XXXXXX + 11 + |
1968 11 XXXXXXXXXXXXXXXXXXXXX 11 | 1980 14 XXXXX + 14 XXXXXXXX + 12 XXXXXX + 12 + |
1969 12 12 | 1981 15 + 15 XXXXXXXX + 13 + 13 XXXXXXXXXXXXX + |
1970 13 13 XXXXXXXXXXXXXXXXXXXXX | 1982 16 + 16 + 14 + 14 XXXXXXXXXXXXX + |
1971 14 14 XXXXXXXXXXXXXXXXXXXXX | 1983 17 + 17 + 15 + 15 XXXXXXXXXXXXX + |
1972 15 XXXXXXXXXXXXXXXXXXXXX 15 XXXXXXXXXXXXXXXXXXXXX | 1984 18 XXXXX + 18 + 16 XXXXXX + 16 + |
1973 16 XXXXXXXXXXXXXXXXXXXXX 16 | 1985 19 XXXXX + 19 XXXXXXXX + 17 XXXXXX + 17 + |
1974 ------------------------ ------------------------" | 1986 20 XXXXX + 20 XXXXXXXX + 18 XXXXXX + 18 + |
1975 :type 'boolean | 1987 21 + 21 XXXXXXXX + |
1988 22 + 22 + | |
1989 -------- ----------- --------- ---------------- | |
1990 | |
1991 Any other value is treated as `nil'." | |
1992 :type '(choice :menu-tag "Zebra Stripe Follow" | |
1993 :tag "Zebra Stripe Follow" | |
1994 (const :tag "Always Restart" nil) | |
1995 (const :tag "Continue on Next Page" follow) | |
1996 (const :tag "Print Only Full Stripe" full) | |
1997 (const :tag "Continue on Full Stripe" full-follow)) | |
1976 :group 'ps-print-zebra) | 1998 :group 'ps-print-zebra) |
1977 | 1999 |
1978 (defcustom ps-line-number nil | 2000 (defcustom ps-line-number nil |
1979 "*Non-nil means print line number." | 2001 "*Non-nil means print line number." |
1980 :type 'boolean | 2002 :type 'boolean |
2631 :tag "Left Header" | 2653 :tag "Left Header" |
2632 string symbol)) | 2654 string symbol)) |
2633 :group 'ps-print-headers) | 2655 :group 'ps-print-headers) |
2634 | 2656 |
2635 (defcustom ps-right-header | 2657 (defcustom ps-right-header |
2636 (list "/pagenumberstring load" 'time-stamp-mon-dd-yyyy 'time-stamp-hh:mm:ss) | 2658 (list "/pagenumberstring load" |
2659 'ps-time-stamp-mon-dd-yyyy 'ps-time-stamp-hh:mm:ss) | |
2637 "*The items to display (each on a line) on the right part of the page header. | 2660 "*The items to display (each on a line) on the right part of the page header. |
2638 This applies to generating PostScript. | 2661 This applies to generating PostScript. |
2639 | 2662 |
2640 See the variable `ps-left-header' for a description of the format of | 2663 See the variable `ps-left-header' for a description of the format of |
2641 this variable." | 2664 this variable." |
2962 ps-landscape-mode | 2985 ps-landscape-mode |
2963 ps-print-upside-down | 2986 ps-print-upside-down |
2964 ps-number-of-columns | 2987 ps-number-of-columns |
2965 ps-zebra-stripes | 2988 ps-zebra-stripes |
2966 ps-zebra-stripe-height | 2989 ps-zebra-stripe-height |
2967 ps-zebra-stripe-follow | 2990 (ps-print-quote ps-zebra-stripe-follow) |
2968 (ps-print-quote ps-zebra-color) | 2991 (ps-print-quote ps-zebra-color) |
2969 ps-line-number | 2992 ps-line-number |
2970 (ps-print-quote ps-line-number-step) | 2993 (ps-print-quote ps-line-number-step) |
2971 ps-line-number-start | 2994 ps-line-number-start |
2972 (ps-print-quote ps-default-fg) | 2995 (ps-print-quote ps-default-fg) |
3002 (ps-print-quote ps-right-header) | 3025 (ps-print-quote ps-right-header) |
3003 ps-n-up-printing | 3026 ps-n-up-printing |
3004 ps-n-up-margin | 3027 ps-n-up-margin |
3005 ps-n-up-border-p | 3028 ps-n-up-border-p |
3006 (ps-print-quote ps-n-up-filling) | 3029 (ps-print-quote ps-n-up-filling) |
3007 (ps-print-quote ps-multibyte-buffer) ; see `ps-mule.el' | 3030 (ps-print-quote (symbol-value 'ps-multibyte-buffer)) ; see `ps-mule.el' |
3008 (ps-print-quote ps-font-family) | 3031 (ps-print-quote ps-font-family) |
3009 (ps-print-quote ps-font-size) | 3032 (ps-print-quote ps-font-size) |
3010 (ps-print-quote ps-header-font-family) | 3033 (ps-print-quote ps-header-font-family) |
3011 (ps-print-quote ps-header-font-size) | 3034 (ps-print-quote ps-header-font-size) |
3012 (ps-print-quote ps-header-title-font-size) | 3035 (ps-print-quote ps-header-title-font-size) |
3025 | 3048 |
3026 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3049 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3027 ;; Utility functions and variables: | 3050 ;; Utility functions and variables: |
3028 | 3051 |
3029 | 3052 |
3053 (defun ps-time-stamp-mon-dd-yyyy () | |
3054 (format-time-string "%b %d %Y")) | |
3055 | |
3056 | |
3057 (defun ps-time-stamp-hh:mm:ss () | |
3058 (format-time-string "%T")) | |
3059 | |
3060 | |
3030 (defun ps-print-quote (sym) | 3061 (defun ps-print-quote (sym) |
3031 (cond ((null sym) | 3062 (cond ((null sym) |
3032 nil) | 3063 nil) |
3033 ((or (symbolp sym) (listp sym)) | 3064 ((or (symbolp sym) (listp sym)) |
3034 (format "'%S" sym)) | 3065 (format "'%S" sym)) |
3092 (ps-x-color-name color) | 3123 (ps-x-color-name color) |
3093 color)) | 3124 color)) |
3094 | 3125 |
3095 (cond ((eq ps-print-emacs-type 'emacs) ; emacs | 3126 (cond ((eq ps-print-emacs-type 'emacs) ; emacs |
3096 | 3127 |
3128 ;; to avoid XEmacs compilation gripes | |
3129 (defvar coding-system-for-write nil) | |
3130 | |
3097 (defun ps-color-values (x-color) | 3131 (defun ps-color-values (x-color) |
3098 (cond | 3132 (cond |
3099 ((fboundp 'color-values) | 3133 ((fboundp 'color-values) |
3100 (ps-e-color-values x-color)) | 3134 (ps-e-color-values x-color)) |
3101 ((fboundp 'x-color-values) | 3135 ((fboundp 'x-color-values) |
3105 | 3139 |
3106 (defalias 'ps-face-foreground-name 'face-foreground) | 3140 (defalias 'ps-face-foreground-name 'face-foreground) |
3107 (defalias 'ps-face-background-name 'face-background) | 3141 (defalias 'ps-face-background-name 'face-background) |
3108 | 3142 |
3109 (defun ps-face-bold-p (face) | 3143 (defun ps-face-bold-p (face) |
3110 (or (face-bold-p face) | 3144 (or (ps-e-face-bold-p face) |
3111 (memq face ps-bold-faces))) | 3145 (memq face ps-bold-faces))) |
3112 | 3146 |
3113 (defun ps-face-italic-p (face) | 3147 (defun ps-face-italic-p (face) |
3114 (or (face-italic-p face) | 3148 (or (ps-e-face-italic-p face) |
3115 (memq face ps-italic-faces))) | 3149 (memq face ps-italic-faces))) |
3116 ) | 3150 ) |
3117 ; xemacs | 3151 ; xemacs |
3118 ; lucid | 3152 ; lucid |
3119 (t ; epoch | 3153 (t ; epoch |
3164 (defun ps-face-underlined-p (face) | 3198 (defun ps-face-underlined-p (face) |
3165 (or (face-underline-p face) | 3199 (or (face-underline-p face) |
3166 (memq face ps-underlined-faces))) | 3200 (memq face ps-underlined-faces))) |
3167 | 3201 |
3168 | 3202 |
3169 (require 'time-stamp) | |
3170 | |
3171 | |
3172 (defun ps-prologue-file (filenumber) | 3203 (defun ps-prologue-file (filenumber) |
3173 (save-excursion | 3204 "If prologue FILENUMBER exists and is readable, returns contents as string. |
3174 (let* ((filename (convert-standard-filename | 3205 |
3175 (expand-file-name (format "ps-prin%d.ps" filenumber) | 3206 Note: No major/minor-mode is activated and no local variables are evaluated for |
3176 ps-postscript-code-directory))) | 3207 FILENUMBER, but proper EOL-conversion and character interpretation is |
3177 (buffer | 3208 done!" |
3178 (or (find-file-noselect filename 'no-warn 'rawfile) | 3209 (let ((filename (convert-standard-filename |
3179 (error "ps-print PostScript prologue `%s' file was not found." | 3210 (expand-file-name (format "ps-prin%d.ps" filenumber) |
3180 filename)))) | 3211 ps-postscript-code-directory)))) |
3181 (set-buffer buffer) | 3212 (if (and (file-exists-p filename) |
3182 (prog1 | 3213 (file-readable-p filename)) |
3183 (buffer-string) | 3214 (with-temp-buffer |
3184 (kill-buffer buffer))))) | 3215 (insert-file-contents filename) |
3216 (buffer-string)) | |
3217 (error "ps-print PostScript prologue `%s' file was not found." | |
3218 filename)))) | |
3185 | 3219 |
3186 | 3220 |
3187 (defvar ps-mark-code-directory nil) | 3221 (defvar ps-mark-code-directory nil) |
3188 | 3222 |
3189 (defvar ps-print-prologue-0 "" | 3223 (defvar ps-print-prologue-0 "" |
3228 (defvar ps-default-foreground nil) | 3262 (defvar ps-default-foreground nil) |
3229 (defvar ps-default-color nil) | 3263 (defvar ps-default-color nil) |
3230 (defvar ps-current-color nil) | 3264 (defvar ps-current-color nil) |
3231 (defvar ps-current-bg nil) | 3265 (defvar ps-current-bg nil) |
3232 | 3266 |
3267 (defvar ps-zebra-stripe-full-p nil) | |
3233 (defvar ps-razchunk 0) | 3268 (defvar ps-razchunk 0) |
3234 | 3269 |
3235 (defvar ps-color-p nil) | 3270 (defvar ps-color-p nil) |
3236 (defvar ps-color-format | 3271 (defvar ps-color-format |
3237 (if (eq ps-print-emacs-type 'emacs) | 3272 (if (eq ps-print-emacs-type 'emacs) |
3756 (+ ps-header-pad | 3791 (+ ps-header-pad |
3757 (ps-title-line-height 'ps-font-for-header) | 3792 (ps-title-line-height 'ps-font-for-header) |
3758 (* (ps-line-height 'ps-font-for-header) | 3793 (* (ps-line-height 'ps-font-for-header) |
3759 (1- ps-header-lines)) | 3794 (1- ps-header-lines)) |
3760 ps-header-pad) | 3795 ps-header-pad) |
3761 ps-print-height)))) | 3796 ps-print-height)) |
3797 ;; ps-zebra-stripe-follow is `full' or `full-follow' | |
3798 (if ps-zebra-stripe-full-p | |
3799 (let* ((line-height (ps-line-height 'ps-font-for-text)) | |
3800 (zebra (* line-height ps-zebra-stripe-height))) | |
3801 (setq ps-print-height (- (* (floor ps-print-height zebra) zebra) | |
3802 line-height)) | |
3803 (if (<= ps-print-height 0) | |
3804 (error "Bad vertical layout: | |
3805 ps-zebra-stripe-follow == %s | |
3806 ps-zebra-stripe-height == %s | |
3807 font-text-height == %s | |
3808 page-height == ((floor print-height (th * zh)) * (th * zh)) - th | |
3809 => print-height == %d !" | |
3810 ps-zebra-stripe-follow | |
3811 ps-zebra-stripe-height | |
3812 (ps-line-height 'ps-font-for-text) | |
3813 ps-print-height)))))) | |
3762 | 3814 |
3763 (defun ps-print-preprint (prefix-arg) | 3815 (defun ps-print-preprint (prefix-arg) |
3764 (and prefix-arg | 3816 (and prefix-arg |
3765 (or (numberp prefix-arg) | 3817 (or (numberp prefix-arg) |
3766 (listp prefix-arg)) | 3818 (listp prefix-arg)) |
3951 (let ((count 1)) | 4003 (let ((count 1)) |
3952 (ps-generate-header-line "/h0" (car contents)) | 4004 (ps-generate-header-line "/h0" (car contents)) |
3953 (while (and (< count ps-header-lines) | 4005 (while (and (< count ps-header-lines) |
3954 (setq contents (cdr contents))) | 4006 (setq contents (cdr contents))) |
3955 (ps-generate-header-line "/h1" (car contents)) | 4007 (ps-generate-header-line "/h1" (car contents)) |
3956 (setq count (1+ count))) | 4008 (setq count (1+ count))))) |
3957 (ps-output "] def\n")))) | 4009 (ps-output "] def\n")) |
3958 | 4010 |
3959 | 4011 |
3960 (defun ps-output-boolean (name bool) | 4012 (defun ps-output-boolean (name bool) |
3961 (ps-output (format "/%s %s def\n" name (if bool "true" "false")))) | 4013 (ps-output (format "/%s %s def\n" name (if bool "true" "false")))) |
3962 | 4014 |
4545 (defconst ps-error-handler-alist | 4597 (defconst ps-error-handler-alist |
4546 '((none . 0) | 4598 '((none . 0) |
4547 (paper . 1) | 4599 (paper . 1) |
4548 (system . 2) | 4600 (system . 2) |
4549 (paper-and-system . 3)) | 4601 (paper-and-system . 3)) |
4550 "Alist for error handler message") | 4602 "Alist for error handler message.") |
4603 | |
4604 | |
4605 (defconst ps-zebra-stripe-alist | |
4606 '((follow . 1) | |
4607 (full . 2) | |
4608 (full-follow . 3)) | |
4609 "Alist for zebra stripe continuation.") | |
4551 | 4610 |
4552 | 4611 |
4553 (defun ps-begin-file () | 4612 (defun ps-begin-file () |
4554 (ps-get-page-dimensions) | 4613 (ps-get-page-dimensions) |
4555 (setq ps-page-order 0 | 4614 (setq ps-page-order 0 |
4568 ps-adobe-tag | 4627 ps-adobe-tag |
4569 "%%Title: " (buffer-name) ; Take job name from name of | 4628 "%%Title: " (buffer-name) ; Take job name from name of |
4570 ; first buffer printed | 4629 ; first buffer printed |
4571 "\n%%Creator: " (user-full-name) | 4630 "\n%%Creator: " (user-full-name) |
4572 " (using ps-print v" ps-print-version | 4631 " (using ps-print v" ps-print-version |
4573 ")\n%%CreationDate: " | 4632 ")\n%%CreationDate: " (format-time-string "%T %b %d %Y") |
4574 (time-stamp-hh:mm:ss) " " (time-stamp-mon-dd-yyyy) | |
4575 "\n%%Orientation: " | 4633 "\n%%Orientation: " |
4576 (if ps-landscape-mode "Landscape" "Portrait") | 4634 (if ps-landscape-mode "Landscape" "Portrait") |
4577 "\n%%DocumentNeededResources: font Times-Roman Times-Italic\n%%+ font " | 4635 "\n%%DocumentNeededResources: font Times-Roman Times-Italic\n%%+ font " |
4578 (mapconcat 'identity | 4636 (mapconcat 'identity |
4579 (ps-remove-duplicates | 4637 (ps-remove-duplicates |
4636 ps-spool-duplex | 4694 ps-spool-duplex |
4637 ps-switch-header)) | 4695 ps-switch-header)) |
4638 (ps-output-boolean "ShowNofN " ps-show-n-of-n) | 4696 (ps-output-boolean "ShowNofN " ps-show-n-of-n) |
4639 | 4697 |
4640 (let ((line-height (ps-line-height 'ps-font-for-text))) | 4698 (let ((line-height (ps-line-height 'ps-font-for-text))) |
4641 (ps-output (format "/LineHeight %s def\n" line-height) | 4699 (ps-output (format "/LineHeight %s def\n" line-height) |
4642 (format "/LinesPerColumn %d def\n" | 4700 (format "/LinesPerColumn %d def\n" |
4643 (round (/ (+ ps-print-height | 4701 (round (/ (+ ps-print-height |
4644 (* line-height 0.45)) | 4702 (* line-height 0.45)) |
4645 line-height))))) | 4703 line-height))))) |
4646 | 4704 |
4647 (ps-output-boolean "WarnPaperSize " ps-warn-paper-type) | 4705 (ps-output-boolean "WarnPaperSize " ps-warn-paper-type) |
4648 (ps-output-boolean "Zebra " ps-zebra-stripes) | 4706 (ps-output-boolean "Zebra " ps-zebra-stripes) |
4649 (ps-output-boolean "ZebraFollow " ps-zebra-stripe-follow) | |
4650 (ps-output-boolean "PrintLineNumber " ps-line-number) | 4707 (ps-output-boolean "PrintLineNumber " ps-line-number) |
4651 (ps-output-boolean "SyncLineZebra " (not (integerp ps-line-number-step))) | 4708 (ps-output-boolean "SyncLineZebra " (not (integerp ps-line-number-step))) |
4652 (ps-output (format "/PrintLineStep %d def\n" | 4709 (ps-output (format "/ZebraFollow %d def\n" |
4710 (or (cdr (assq ps-zebra-stripe-follow | |
4711 ps-zebra-stripe-alist)) | |
4712 0)) | |
4713 (format "/PrintLineStep %d def\n" | |
4653 (if (integerp ps-line-number-step) | 4714 (if (integerp ps-line-number-step) |
4654 ps-line-number-step | 4715 ps-line-number-step |
4655 ps-zebra-stripe-height)) | 4716 ps-zebra-stripe-height)) |
4656 (format "/PrintLineStart %d def\n" ps-line-number-start) | 4717 (format "/PrintLineStart %d def\n" ps-line-number-start) |
4657 (format "/ZebraHeight %d def\n" ps-zebra-stripe-height) | 4718 (format "/ZebraHeight %d def\n" ps-zebra-stripe-height) |
4859 (set-buffer ps-spool-buffer) | 4920 (set-buffer ps-spool-buffer) |
4860 (goto-char (point-max)) | 4921 (goto-char (point-max)) |
4861 (and (re-search-backward "^%%Trailer$" nil t) | 4922 (and (re-search-backward "^%%Trailer$" nil t) |
4862 (delete-region (match-beginning 0) (point-max)))) | 4923 (delete-region (match-beginning 0) (point-max)))) |
4863 ;; miscellaneous | 4924 ;; miscellaneous |
4864 (setq ps-page-postscript 0 | 4925 (setq ps-zebra-stripe-full-p (memq ps-zebra-stripe-follow |
4926 '(full full-follow)) | |
4927 ps-page-postscript 0 | |
4865 ps-page-sheet 0 | 4928 ps-page-sheet 0 |
4866 ps-page-n-up 0 | 4929 ps-page-n-up 0 |
4867 ps-page-column 0 | 4930 ps-page-column 0 |
4868 ps-lines-printed 0 | 4931 ps-lines-printed 0 |
4869 ps-print-page-p t | 4932 ps-print-page-p t |
5441 (and (< property-change to) ; Don't search for property change | 5504 (and (< property-change to) ; Don't search for property change |
5442 ; unless previous search succeeded. | 5505 ; unless previous search succeeded. |
5443 (setq property-change (next-property-change from nil to))) | 5506 (setq property-change (next-property-change from nil to))) |
5444 (and (< overlay-change to) ; Don't search for overlay change | 5507 (and (< overlay-change to) ; Don't search for overlay change |
5445 ; unless previous search succeeded. | 5508 ; unless previous search succeeded. |
5446 (setq overlay-change (min (next-overlay-change from) to))) | 5509 (setq overlay-change (min (ps-e-next-overlay-change from) |
5510 to))) | |
5447 (setq position (min property-change overlay-change)) | 5511 (setq position (min property-change overlay-change)) |
5448 ;; The code below is not quite correct, | 5512 ;; The code below is not quite correct, |
5449 ;; because a non-nil overlay invisible property | 5513 ;; because a non-nil overlay invisible property |
5450 ;; which is inactive according to the current value | 5514 ;; which is inactive according to the current value |
5451 ;; of buffer-invisibility-spec nonetheless overrides | 5515 ;; of buffer-invisibility-spec nonetheless overrides |
5459 (or (memq prop save-buffer-invisibility-spec) | 5523 (or (memq prop save-buffer-invisibility-spec) |
5460 (assq prop save-buffer-invisibility-spec)))) | 5524 (assq prop save-buffer-invisibility-spec)))) |
5461 'emacs--invisible--face) | 5525 'emacs--invisible--face) |
5462 ((get-text-property from 'face)) | 5526 ((get-text-property from 'face)) |
5463 (t 'default))) | 5527 (t 'default))) |
5464 (let ((overlays (overlays-at from)) | 5528 (let ((overlays (ps-e-overlays-at from)) |
5465 (face-priority -1)) ; text-property | 5529 (face-priority -1)) ; text-property |
5466 (while (and overlays | 5530 (while (and overlays |
5467 (not (eq face 'emacs--invisible--face))) | 5531 (not (eq face 'emacs--invisible--face))) |
5468 (let* ((overlay (car overlays)) | 5532 (let* ((overlay (car overlays)) |
5469 (overlay-invisible (overlay-get overlay 'invisible)) | 5533 (overlay-invisible (ps-e-overlay-get overlay 'invisible)) |
5470 (overlay-priority (or (overlay-get overlay 'priority) | 5534 (overlay-priority (or (ps-e-overlay-get overlay 'priority) |
5471 0))) | 5535 0))) |
5472 (and (> overlay-priority face-priority) | 5536 (and (> overlay-priority face-priority) |
5473 (setq face | 5537 (setq face |
5474 (cond ((if (eq save-buffer-invisibility-spec t) | 5538 (cond ((if (eq save-buffer-invisibility-spec t) |
5475 (not (null overlay-invisible)) | 5539 (not (null overlay-invisible)) |
5476 (or (memq overlay-invisible | 5540 (or (memq overlay-invisible |
5477 save-buffer-invisibility-spec) | 5541 save-buffer-invisibility-spec) |
5478 (assq overlay-invisible | 5542 (assq overlay-invisible |
5479 save-buffer-invisibility-spec))) | 5543 save-buffer-invisibility-spec))) |
5480 'emacs--invisible--face) | 5544 'emacs--invisible--face) |
5481 ((overlay-get overlay 'face)) | 5545 ((ps-e-overlay-get overlay 'face)) |
5482 (t face)) | 5546 (t face)) |
5483 face-priority overlay-priority))) | 5547 face-priority overlay-priority))) |
5484 (setq overlays (cdr overlays)))) | 5548 (setq overlays (cdr overlays)))) |
5485 ;; Plot up to this record. | 5549 ;; Plot up to this record. |
5486 (ps-plot-with-face from position face) | 5550 (ps-plot-with-face from position face) |
5614 (save-excursion | 5678 (save-excursion |
5615 (set-buffer ps-spool-buffer) | 5679 (set-buffer ps-spool-buffer) |
5616 (let* ((coding-system-for-write 'raw-text-unix) | 5680 (let* ((coding-system-for-write 'raw-text-unix) |
5617 (ps-printer-name (or ps-printer-name | 5681 (ps-printer-name (or ps-printer-name |
5618 (and (boundp 'printer-name) | 5682 (and (boundp 'printer-name) |
5619 printer-name))) | 5683 (symbol-value 'printer-name)))) |
5620 (ps-lpr-switches | 5684 (ps-lpr-switches |
5621 (append ps-lpr-switches | 5685 (append ps-lpr-switches |
5622 (and (stringp ps-printer-name) | 5686 (and (stringp ps-printer-name) |
5623 (string< "" ps-printer-name) | 5687 (string< "" ps-printer-name) |
5624 (list (concat | 5688 (list (concat |