aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-05-18 21:50:51 +0000
committerGerd Moellmann2000-05-18 21:50:51 +0000
commit98f2fbe725e2402267927b04d950edee928df2a0 (patch)
treed7a1d798b381d5ae45338b469d6d214cd7b93c5d
parent25bb0401ab464bc0c2e68268f50d365aa3187aec (diff)
downloademacs-98f2fbe725e2402267927b04d950edee928df2a0.tar.gz
emacs-98f2fbe725e2402267927b04d950edee928df2a0.zip
* ps-print.el: Compatibility, customization and doc fix.
(ps-printer-name-option): Replace defconst by defvar. (ps-postscript-code-directory): XEmacs compatibility. (ps-header-sheet, ps-setup, ps-begin-file, ps-begin-job): Code fix. (ps-user-defined-prologue, ps-print-prologue-header) (ps-xemacs-face-kind-p, ps-face-bold-p, ps-face-italic-p): XEmacs compatibility and code fix. (ps-print-background-image, ps-print-background-text): Customization fix. (ps-line-number-start, ps-n-up-on): New vars.
-rw-r--r--lisp/ps-print.el180
1 files changed, 129 insertions, 51 deletions
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 771f91d33f6..82c45055058 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -9,11 +9,11 @@
9;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) 9;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
10;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 10;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
11;; Keywords: wp, print, PostScript 11;; Keywords: wp, print, PostScript
12;; Time-stamp: <2000/04/24 12:23:14 vinicius> 12;; Time-stamp: <2000/05/12 19:56:11 vinicius>
13;; Version: 5.2 13;; Version: 5.2.1
14 14
15(defconst ps-print-version "5.2" 15(defconst ps-print-version "5.2.1"
16 "ps-print.el, v 5.2 <2000/04/24 vinicius> 16 "ps-print.el, v 5.2.1 <2000/05/12 vinicius>
17 17
18Vinicius's last change version -- this file may have been edited as part of 18Vinicius's last change version -- this file may have been edited as part of
19Emacs without changes to the version number. When reporting bugs, please also 19Emacs without changes to the version number. When reporting bugs, please also
@@ -195,10 +195,10 @@ Please send all bug fixes and enhancements to
195;; See definition of `call-process-region' for calling conventions. The fourth 195;; See definition of `call-process-region' for calling conventions. The fourth
196;; and the sixth arguments are both nil. 196;; and the sixth arguments are both nil.
197;; 197;;
198;; If you're using NTEmacs, don't forget to customize the following variables: 198;; If you're using Emacs for Windows 95/98/NT or MS-DOS, don't forget to
199;; `ps-printer-name', `ps-lpr-command', `ps-lpr-switches' and 199;; customize the following variables: `ps-printer-name', `ps-lpr-command',
200;; `ps-spool-config'. See these variables documentation in the code or by 200;; `ps-lpr-switches' and `ps-spool-config'. See these variables documentation
201;; typing, for example, C-h v ps-printer-name RET. 201;; in the code or by typing, for example, C-h v ps-printer-name RET.
202;; 202;;
203;; 203;;
204;; The Page Layout 204;; The Page Layout
@@ -603,7 +603,7 @@ Please send all bug fixes and enhancements to
603;; one line 603;; one line
604;; 3 one line 604;; 3 one line
605;; one line 605;; one line
606;; 4 one line 606;; 5 one line
607;; one line 607;; one line
608;; ... 608;; ...
609;; 609;;
@@ -619,6 +619,34 @@ Please send all bug fixes and enhancements to
619;; Any other value is treated as `zebra'. 619;; Any other value is treated as `zebra'.
620;; The default value is 1, so each line number is printed. 620;; The default value is 1, so each line number is printed.
621;; 621;;
622;; The variable `ps-line-number-start' specifies the starting point in the
623;; interval given by `ps-line-number-step'. For example, if
624;; `ps-line-number-step' is set to 3 and `ps-line-number-start' is set to 3, the
625;; printing will look like:
626;;
627;; one line
628;; one line
629;; 3 one line
630;; one line
631;; one line
632;; 6 one line
633;; one line
634;; one line
635;; 9 one line
636;; one line
637;; ...
638;;
639;; The values for `ps-line-number-start':
640;;
641;; * If `ps-line-number-step' is an integer, must be between 1 and the value
642;; of `ps-line-number-step' inclusive.
643;;
644;; * If `ps-line-number-step' is set to `zebra', must be between 1 and the
645;; value of `ps-zebra-strip-height' inclusive.
646;;
647;; The default value is 1, so the line number of the first line of each interval
648;; is printed.
649;;
622;; 650;;
623;; Zebra Stripes 651;; Zebra Stripes
624;; ------------- 652;; -------------
@@ -1100,6 +1128,9 @@ Please send all bug fixes and enhancements to
1100;; Acknowledgements 1128;; Acknowledgements
1101;; ---------------- 1129;; ----------------
1102;; 1130;;
1131;; Thanks to Paul Furnanz <pfurnanz@synopsys.com> for XEmacs compatibility
1132;; suggestion for `ps-postscript-code-directory' variable.
1133;;
1103;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript 1134;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript
1104;; level 1 compatibility. 1135;; level 1 compatibility.
1105;; 1136;;
@@ -1341,7 +1372,7 @@ For more information about PostScript, see:
1341 PostScript Language Reference Manual (2nd edition) 1372 PostScript Language Reference Manual (2nd edition)
1342 Adobe Systems Incorporated" 1373 Adobe Systems Incorporated"
1343 :type '(choice :tag "User Defined Prologue" 1374 :type '(choice :tag "User Defined Prologue"
1344 string symbol (const :tag "none" nil)) 1375 (const :tag "none" nil) string symbol)
1345 :group 'ps-print-miscellany) 1376 :group 'ps-print-miscellany)
1346 1377
1347(defcustom ps-print-prologue-header nil 1378(defcustom ps-print-prologue-header nil
@@ -1369,7 +1400,7 @@ For more information about PostScript document comments, see:
1369 Adobe Systems Incorporated 1400 Adobe Systems Incorporated
1370 Appendix G: Document Structuring Conventions -- Version 3.0" 1401 Appendix G: Document Structuring Conventions -- Version 3.0"
1371 :type '(choice :tag "Prologue Header" 1402 :type '(choice :tag "Prologue Header"
1372 string symbol (const :tag "none" nil)) 1403 (const :tag "none" nil) string symbol)
1373 :group 'ps-print-miscellany) 1404 :group 'ps-print-miscellany)
1374 1405
1375(defcustom ps-printer-name (and (boundp 'printer-name) 1406(defcustom ps-printer-name (and (boundp 'printer-name)
@@ -1616,7 +1647,7 @@ For example, `ps-line-number-step' is set to 2, the printing will look like:
1616 one line 1647 one line
1617 3 one line 1648 3 one line
1618 one line 1649 one line
1619 4 one line 1650 5 one line
1620 one line 1651 one line
1621 ... 1652 ...
1622 1653
@@ -1635,6 +1666,35 @@ Any other value is treated as `zebra'."
1635 (const :tag "Synchronize Zebra" zebra)) 1666 (const :tag "Synchronize Zebra" zebra))
1636 :group 'ps-print-miscellany) 1667 :group 'ps-print-miscellany)
1637 1668
1669(defcustom ps-line-number-start 1
1670 "*Specify the starting point in the interval given by `ps-line-number-step'.
1671
1672For example, if `ps-line-number-step' is set to 3 and `ps-line-number-start' is set to 3, the
1673printing will look like:
1674
1675 one line
1676 one line
1677 3 one line
1678 one line
1679 one line
1680 6 one line
1681 one line
1682 one line
1683 9 one line
1684 one line
1685 ...
1686
1687The values for `ps-line-number-start':
1688
1689 * If `ps-line-number-step' is an integer, must be between 1 and the value
1690 of `ps-line-number-step' inclusive.
1691
1692 * If `ps-line-number-step' is set to `zebra', must be between 1 and the
1693 value of `ps-zebra-strip-height' inclusive. Use this combination if you
1694 wish that line number be relative to zebra stripes."
1695 :type '(integer :tag "Start Step Interval")
1696 :group 'ps-print-miscellany)
1697
1638(defcustom ps-print-background-image nil 1698(defcustom ps-print-background-image nil
1639 "*EPS image list to be printed on background. 1699 "*EPS image list to be printed on background.
1640 1700
@@ -1666,17 +1726,19 @@ PostScript programming that returns a float or integer value.
1666For example, if you wish to print an EPS image on all pages do: 1726For example, if you wish to print an EPS image on all pages do:
1667 1727
1668 '((\"~/images/EPS-image.ps\"))" 1728 '((\"~/images/EPS-image.ps\"))"
1669 :type '(repeat (list (file :tag "EPS File") 1729 :type '(repeat
1670 (choice :tag "X" (const :tag "default" nil) number string) 1730 (list
1671 (choice :tag "Y" (const :tag "default" nil) number string) 1731 (file :tag "EPS File")
1672 (choice :tag "X Scale" (const :tag "default" nil) number string) 1732 (choice :tag "X" (const :tag "default" nil) number string)
1673 (choice :tag "Y Scale" (const :tag "default" nil) number string) 1733 (choice :tag "Y" (const :tag "default" nil) number string)
1674 (choice :tag "Rotation" (const :tag "default" nil) number string) 1734 (choice :tag "X Scale" (const :tag "default" nil) number string)
1675 (repeat :tag "Pages" :inline t 1735 (choice :tag "Y Scale" (const :tag "default" nil) number string)
1676 (radio (integer :tag "Page") 1736 (choice :tag "Rotation" (const :tag "default" nil) number string)
1677 (cons :tag "Range" 1737 (repeat :tag "Pages" :inline t
1678 (integer :tag "From") 1738 (radio (integer :tag "Page")
1679 (integer :tag "To")))))) 1739 (cons :tag "Range"
1740 (integer :tag "From")
1741 (integer :tag "To"))))))
1680 :group 'ps-print-background) 1742 :group 'ps-print-background)
1681 1743
1682(defcustom ps-print-background-text nil 1744(defcustom ps-print-background-text nil
@@ -1714,18 +1776,20 @@ PostScript programming that returns a float or integer value.
1714For example, if you wish to print text \"Preliminary\" on all pages do: 1776For example, if you wish to print text \"Preliminary\" on all pages do:
1715 1777
1716 '((\"Preliminary\"))" 1778 '((\"Preliminary\"))"
1717 :type '(repeat (list (string :tag "Text") 1779 :type '(repeat
1718 (choice :tag "X" (const :tag "default" nil) number string) 1780 (list
1719 (choice :tag "Y" (const :tag "default" nil) number string) 1781 (string :tag "Text")
1720 (choice :tag "Font" (const :tag "default" nil) string) 1782 (choice :tag "X" (const :tag "default" nil) number string)
1721 (choice :tag "Fontsize" (const :tag "default" nil) number string) 1783 (choice :tag "Y" (const :tag "default" nil) number string)
1722 (choice :tag "Gray" (const :tag "default" nil) number string) 1784 (choice :tag "Font" (const :tag "default" nil) string)
1723 (choice :tag "Rotation" (const :tag "default" nil) number string) 1785 (choice :tag "Fontsize" (const :tag "default" nil) number string)
1724 (repeat :tag "Pages" :inline t 1786 (choice :tag "Gray" (const :tag "default" nil) number string)
1725 (radio (integer :tag "Page") 1787 (choice :tag "Rotation" (const :tag "default" nil) number string)
1726 (cons :tag "Range" 1788 (repeat :tag "Pages" :inline t
1727 (integer :tag "From") 1789 (radio (integer :tag "Page")
1728 (integer :tag "To")))))) 1790 (cons :tag "Range"
1791 (integer :tag "From")
1792 (integer :tag "To"))))))
1729 :group 'ps-print-background) 1793 :group 'ps-print-background)
1730 1794
1731;;; Horizontal layout 1795;;; Horizontal layout
@@ -2219,7 +2283,10 @@ It's like the very first character of buffer (or region) is ^L (\\014)."
2219 :type 'boolean 2283 :type 'boolean
2220 :group 'ps-print-headers) 2284 :group 'ps-print-headers)
2221 2285
2222(defcustom ps-postscript-code-directory data-directory 2286(defcustom ps-postscript-code-directory
2287 (or (and (fboundp 'locate-data-directory) ; xemacs
2288 (locate-data-directory "ps-print"))
2289 data-directory) ; emacs
2223 "*Directory where it's located the PostScript prologue file used by ps-print. 2290 "*Directory where it's located the PostScript prologue file used by ps-print.
2224By default, this directory is the same as in the variable `data-directory'." 2291By default, this directory is the same as in the variable `data-directory'."
2225 :type 'directory 2292 :type 'directory
@@ -2385,6 +2452,7 @@ The table depends on the current ps-print setup."
2385 ps-zebra-color %s 2452 ps-zebra-color %s
2386 ps-line-number %s 2453 ps-line-number %s
2387 ps-line-number-step %s 2454 ps-line-number-step %s
2455 ps-line-number-start %S
2388 2456
2389 ps-default-fg %s 2457 ps-default-fg %s
2390 ps-default-bg %s 2458 ps-default-bg %s
@@ -2444,6 +2512,7 @@ The table depends on the current ps-print setup."
2444 (ps-print-quote ps-zebra-color) 2512 (ps-print-quote ps-zebra-color)
2445 ps-line-number 2513 ps-line-number
2446 (ps-print-quote ps-line-number-step) 2514 (ps-print-quote ps-line-number-step)
2515 ps-line-number-start
2447 (ps-print-quote ps-default-fg) 2516 (ps-print-quote ps-default-fg)
2448 (ps-print-quote ps-default-bg) 2517 (ps-print-quote ps-default-bg)
2449 (ps-print-quote ps-use-face-background) 2518 (ps-print-quote ps-use-face-background)
@@ -2569,6 +2638,7 @@ The table depends on the current ps-print setup."
2569(defvar ps-showline-count 1) 2638(defvar ps-showline-count 1)
2570 2639
2571(defvar ps-control-or-escape-regexp nil) 2640(defvar ps-control-or-escape-regexp nil)
2641(defvar ps-n-up-on nil)
2572 2642
2573(defvar ps-background-pages nil) 2643(defvar ps-background-pages nil)
2574(defvar ps-background-all-pages nil) 2644(defvar ps-background-all-pages nil)
@@ -3855,7 +3925,7 @@ XSTART YSTART are the relative position for the first page in a sheet.")
3855 (tumble (if ps-landscape-mode (not ps-spool-tumble) ps-spool-tumble)) 3925 (tumble (if ps-landscape-mode (not ps-spool-tumble) ps-spool-tumble))
3856 (n-up (ps-n-up-printing)) 3926 (n-up (ps-n-up-printing))
3857 (n-up-filling (ps-n-up-filling))) 3927 (n-up-filling (ps-n-up-filling)))
3858 (and (> ps-n-up-printing 1) (setq tumble (not tumble))) 3928 (and ps-n-up-on (setq tumble (not tumble)))
3859 (ps-output 3929 (ps-output
3860 ps-adobe-tag 3930 ps-adobe-tag
3861 "%%Title: " (buffer-name) ; Take job name from name of 3931 "%%Title: " (buffer-name) ; Take job name from name of
@@ -3939,7 +4009,8 @@ XSTART YSTART are the relative position for the first page in a sheet.")
3939 (ps-output (format "/PrintLineStep %d def\n" 4009 (ps-output (format "/PrintLineStep %d def\n"
3940 (if (integerp ps-line-number-step) 4010 (if (integerp ps-line-number-step)
3941 ps-line-number-step 4011 ps-line-number-step
3942 1)) 4012 ps-zebra-stripe-height))
4013 (format "/PrintLineStart %d def\n" ps-line-number-start)
3943 (format "/ZebraHeight %d def\n" ps-zebra-stripe-height) 4014 (format "/ZebraHeight %d def\n" ps-zebra-stripe-height)
3944 "/ZebraColor " 4015 "/ZebraColor "
3945 (ps-format-color ps-zebra-color 0.95) 4016 (ps-format-color ps-zebra-color 0.95)
@@ -4020,7 +4091,7 @@ XSTART YSTART are the relative position for the first page in a sheet.")
4020 "\n%%EndFeature\n"))) 4091 "\n%%EndFeature\n")))
4021 (ps-output "\n/Lines 0 def\n/PageCount 0 def\n\nBeginDoc\n%%EndSetup\n") 4092 (ps-output "\n/Lines 0 def\n/PageCount 0 def\n\nBeginDoc\n%%EndSetup\n")
4022 (and ps-banner-page-when-duplexing 4093 (and ps-banner-page-when-duplexing
4023 (ps-output "\n%%Page: 0 0\nsave showpage restore\n"))) 4094 (ps-output "\n%%Page: banner 0\nsave showpage restore\n")))
4024 4095
4025 4096
4026(defun ps-format-color (color &optional default) 4097(defun ps-format-color (color &optional default)
@@ -4104,6 +4175,11 @@ XSTART YSTART are the relative position for the first page in a sheet.")
4104 (and (integerp ps-line-number-step) 4175 (and (integerp ps-line-number-step)
4105 (<= ps-line-number-step 0) 4176 (<= ps-line-number-step 0)
4106 (setq ps-line-number-step 1)) 4177 (setq ps-line-number-step 1))
4178 (setq ps-n-up-on (> ps-n-up-printing 1)
4179 ps-line-number-start (max 1 (min ps-line-number-start
4180 (if (integerp ps-line-number-step)
4181 ps-line-number-step
4182 ps-zebra-stripe-height))))
4107 (save-excursion 4183 (save-excursion
4108 (set-buffer ps-spool-buffer) 4184 (set-buffer ps-spool-buffer)
4109 (goto-char (point-max)) 4185 (goto-char (point-max))
@@ -4181,9 +4257,12 @@ XSTART YSTART are the relative position for the first page in a sheet.")
4181 ps-page-order (1+ ps-page-order)) 4257 ps-page-order (1+ ps-page-order))
4182 (and (> ps-page-order 1) 4258 (and (> ps-page-order 1)
4183 (ps-output "EndSheet\n")) 4259 (ps-output "EndSheet\n"))
4184 (ps-output (format "\n%%%%Page: %d %d\n" 4260 (ps-output (if ps-n-up-on
4185 ps-page-postscript ps-page-order)) 4261 (format "\n%%%%Page: (%d \\(%d\\)) %d\n"
4186 (ps-output (format "%d BeginSheet\nBeginDSCPage\n" ps-n-up-printing))) 4262 ps-page-order ps-page-postscript ps-page-order)
4263 (format "\n%%%%Page: %d %d\n"
4264 ps-page-postscript ps-page-order))
4265 (format "%d BeginSheet\nBeginDSCPage\n" ps-n-up-printing)))
4187 4266
4188 4267
4189(defsubst ps-header-page () 4268(defsubst ps-header-page ()
@@ -4567,7 +4646,7 @@ If FACE is not a valid face name, it is used default face."
4567 (goto-char to)) 4646 (goto-char to))
4568 4647
4569 4648
4570(defun ps-xemacs-face-kind-p (face kind kind-regex kind-list) 4649(defun ps-xemacs-face-kind-p (face kind kind-regex)
4571 (let* ((frame-font (or (face-font-instance face) 4650 (let* ((frame-font (or (face-font-instance face)
4572 (face-font-instance 'default))) 4651 (face-font-instance 'default)))
4573 (kind-cons (and frame-font 4652 (kind-cons (and frame-font
@@ -4575,9 +4654,7 @@ If FACE is not a valid face name, it is used default face."
4575 (font-instance-properties frame-font)))) 4654 (font-instance-properties frame-font))))
4576 (kind-spec (cdr-safe kind-cons)) 4655 (kind-spec (cdr-safe kind-cons))
4577 (case-fold-search t)) 4656 (case-fold-search t))
4578 (or (and kind-spec (string-match kind-regex kind-spec)) 4657 (and kind-spec (string-match kind-regex kind-spec))))
4579 ;; Kludge-compatible:
4580 (memq face kind-list))))
4581 4658
4582 4659
4583(cond ((eq ps-print-emacs-type 'emacs) ; emacs 4660(cond ((eq ps-print-emacs-type 'emacs) ; emacs
@@ -4594,12 +4671,13 @@ If FACE is not a valid face name, it is used default face."
4594 ; lucid 4671 ; lucid
4595 (t ; epoch 4672 (t ; epoch
4596 (defun ps-face-bold-p (face) 4673 (defun ps-face-bold-p (face)
4597 (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold" 4674 (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold")
4598 ps-bold-faces)) 4675 (memq face ps-bold-faces))) ; Kludge-compatible
4599 4676
4600 (defun ps-face-italic-p (face) 4677 (defun ps-face-italic-p (face)
4601 (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o" ps-italic-faces) 4678 (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o")
4602 (ps-xemacs-face-kind-p face 'SLANT "i\\|o" ps-italic-faces))) 4679 (ps-xemacs-face-kind-p face 'SLANT "i\\|o")
4680 (memq face ps-italic-faces))) ; Kludge-compatible
4603 )) 4681 ))
4604 4682
4605 4683
@@ -4879,7 +4957,7 @@ If FACE is not a valid face name, it is used default face."
4879 total-lines total-pages) t)))) 4957 total-lines total-pages) t))))
4880 4958
4881 4959
4882(defconst ps-printer-name-option 4960(defvar ps-printer-name-option
4883 (cond (ps-windows-system 4961 (cond (ps-windows-system
4884 "-P") 4962 "-P")
4885 (ps-lp-system 4963 (ps-lp-system