comparison lisp/ps-print.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents e19e88bc6e58
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
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, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
4 ;; 2003 Free Software Foundation, Inc. 4 ;; 2002, 2003, 2004, 2005 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 ;; 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: <2005/06/27 00:57:22 vinicius>
14 ;; Version: 6.5.9 14 ;; Version: 6.6.7
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.7"
18 "ps-print.el, v 6.5.9 <2003/02/12 vinicius> 18 "ps-print.el, v 6.6.7 <2005/06/27 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
24 Please send all bug fixes and enhancements to 24 Please 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
29 ;; GNU Emacs is free software; you can redistribute it and/or modify it under 29 ;; GNU Emacs is free software; you can redistribute it and/or modify it under
30 ;; the terms of the GNU General Public License as published by the Free 30 ;; the terms of the GNU General Public License as published by the Free
36 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 36 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
37 ;; details. 37 ;; details.
38 38
39 ;; You should have received a copy of the GNU General Public License along with 39 ;; You should have received a copy of the GNU General Public License along with
40 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software 40 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software
41 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 41 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
42 42
43 ;;; Commentary: 43 ;;; Commentary:
44 44
45 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 45 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 ;; 46 ;;
838 ;; 20 XXXXX + 20 XXXXXXXX + 18 XXXXXX + 18 + 838 ;; 20 XXXXX + 20 XXXXXXXX + 18 XXXXXX + 18 +
839 ;; 21 + 21 XXXXXXXX + 839 ;; 21 + 21 XXXXXXXX +
840 ;; 22 + 22 + 840 ;; 22 + 22 +
841 ;; -------- ----------- --------- ---------------- 841 ;; -------- ----------- --------- ----------------
842 ;; 842 ;;
843 ;; Any other value is treated as `nil'. 843 ;; Any other value is treated as nil.
844 ;; 844 ;;
845 ;; See also section How Ps-Print Has A Text And/Or Image On Background. 845 ;; See also section How Ps-Print Has A Text And/Or Image On Background.
846 ;; 846 ;;
847 ;; 847 ;;
848 ;; Hooks 848 ;; Hooks
984 ;; 984 ;;
985 ;; You can create new `mixed' font families like: 985 ;; You can create new `mixed' font families like:
986 ;; (my-mixed-family 986 ;; (my-mixed-family
987 ;; (fonts (normal . "Courier-Bold") 987 ;; (fonts (normal . "Courier-Bold")
988 ;; (bold . "Helvetica") 988 ;; (bold . "Helvetica")
989 ;; (italic . "Zapf-Chancery-MediumItalic") 989 ;; (italic . "ZapfChancery-MediumItalic")
990 ;; (bold-italic . "NewCenturySchlbk-BoldItalic") 990 ;; (bold-italic . "NewCenturySchlbk-BoldItalic")
991 ;; (w3-table-hack-x-face . "LineDrawNormal")) 991 ;; (w3-table-hack-x-face . "LineDrawNormal"))
992 ;; (size . 10.0) 992 ;; (size . 10.0)
993 ;; (line-height . 10.55) 993 ;; (line-height . 10.55)
994 ;; (space-width . 6.0) 994 ;; (space-width . 6.0)
1008 ;; (my-mixed-family 1008 ;; (my-mixed-family
1009 ;; (size . 10.0) 1009 ;; (size . 10.0)
1010 ;; (fonts (w3-table-hack-x-face . "LineDrawNormal") 1010 ;; (fonts (w3-table-hack-x-face . "LineDrawNormal")
1011 ;; (bold . "Helvetica") 1011 ;; (bold . "Helvetica")
1012 ;; (bold-italic . "NewCenturySchlbk-BoldItalic") 1012 ;; (bold-italic . "NewCenturySchlbk-BoldItalic")
1013 ;; (italic . "Zapf-Chancery-MediumItalic") 1013 ;; (italic . "ZapfChancery-MediumItalic")
1014 ;; (normal . "Courier-Bold")) 1014 ;; (normal . "Courier-Bold"))
1015 ;; (avg-char-width . 6.0) 1015 ;; (avg-char-width . 6.0)
1016 ;; (space-width . 6.0) 1016 ;; (space-width . 6.0)
1017 ;; (line-height . 10.55)) 1017 ;; (line-height . 10.55))
1018 ;; 1018 ;;
1073 ;; t always use face background color. 1073 ;; t always use face background color.
1074 ;; nil never use face background color. 1074 ;; nil never use face background color.
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
1082 ;; ----------------------------- 1082 ;; -----------------------------
1083 ;; 1083 ;;
1209 ;; 1209 ;;
1210 ;; 1210 ;;
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 ;;
1216 ;; 20040229
1217 ;; `ps-time-stamp-yyyy-mm-dd', `ps-time-stamp-iso8601'
1215 ;; 1218 ;;
1216 ;; 20010619 1219 ;; 20010619
1217 ;; `ps-time-stamp-locale-default' 1220 ;; `ps-time-stamp-locale-default'
1218 ;; 1221 ;;
1219 ;; 20010530 1222 ;; 20010530
1257 ;; 1260 ;;
1258 ;; 19990513 1261 ;; 19990513
1259 ;; N-up printing. 1262 ;; N-up printing.
1260 ;; Hook: `ps-print-begin-sheet-hook'. 1263 ;; Hook: `ps-print-begin-sheet-hook'.
1261 ;; 1264 ;;
1262 ;; [keinichi] 19990509 Kein'ichi Handa <handa@etl.go.jp> 1265 ;; [kenichi] 19990509 Ken'ichi Handa <handa@m17n.org>
1263 ;; 1266 ;;
1264 ;; `ps-print-region-function' 1267 ;; `ps-print-region-function'
1265 ;; 1268 ;;
1266 ;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> 1269 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br>
1267 ;; 1270 ;;
1268 ;; 19990301 1271 ;; 19990301
1269 ;; PostScript tumble and setpagedevice. 1272 ;; PostScript tumble and setpagedevice.
1270 ;; 1273 ;;
1271 ;; 19980922 1274 ;; 19980922
1272 ;; PostScript prologue header comment insertion. 1275 ;; PostScript prologue header comment insertion.
1273 ;; Skip invisible text better. 1276 ;; Skip invisible text better.
1274 ;; 1277 ;;
1275 ;; [keinichi] 19980819 Kein'ichi Handa <handa@etl.go.jp> 1278 ;; [kenichi] 19980819 Ken'ichi Handa <handa@m17n.org>
1276 ;; 1279 ;;
1277 ;; Multi-byte buffer handling. 1280 ;; Multi-byte buffer handling.
1278 ;; 1281 ;;
1279 ;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> 1282 ;; [vinicius] Vinicius Jose Latorre <viniciusjl@ig.com.br>
1280 ;; 1283 ;;
1281 ;; 19980306 1284 ;; 19980306
1282 ;; Skip invisible text. 1285 ;; Skip invisible text.
1283 ;; 1286 ;;
1284 ;; 19971130 1287 ;; 19971130
1348 ;; 1351 ;;
1349 ;; 1352 ;;
1350 ;; Acknowledgments 1353 ;; Acknowledgments
1351 ;; --------------- 1354 ;; ---------------
1352 ;; 1355 ;;
1356 ;; Thanks to Michael Piotrowski <mxp@dynalabs.de> for improving the DSC
1357 ;; compliance of the generated PostScript.
1358 ;;
1353 ;; Thanks to Adam Doppelt <adoppelt@avogadro.com> for face mapping suggestion 1359 ;; Thanks to Adam Doppelt <adoppelt@avogadro.com> for face mapping suggestion
1354 ;; for black/white PostScript printers. 1360 ;; for black/white PostScript printers.
1355 ;; 1361 ;;
1356 ;; Thanks to Toni Ronkko <tronkko@hytti.uku.fi> for line and paragraph spacing, 1362 ;; Thanks to Toni Ronkko <tronkko@hytti.uku.fi> for line and paragraph spacing,
1357 ;; region to cut out when printing and footer suggestions. 1363 ;; region to cut out when printing and footer suggestions.
1368 ;; suggestion for `ps-postscript-code-directory' variable. 1374 ;; suggestion for `ps-postscript-code-directory' variable.
1369 ;; 1375 ;;
1370 ;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript 1376 ;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript
1371 ;; level 1 compatibility. 1377 ;; level 1 compatibility.
1372 ;; 1378 ;;
1373 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for upside-down, 1379 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for:
1374 ;; line number step, line number start and zebra stripe follow suggestions, and 1380 ;; - upside-down, line number step, line number start and zebra stripe
1375 ;; for XEmacs beta-tests. 1381 ;; follow suggestions.
1382 ;; - `ps-time-stamp-yyyy-mm-dd' and `ps-time-stamp-iso8601' suggestion.
1383 ;; - and for XEmacs beta-tests.
1376 ;; 1384 ;;
1377 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript 1385 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript
1378 ;; prologue code suggestion, for odd/even printing suggestion and for 1386 ;; prologue code suggestion, for odd/even printing suggestion and for
1379 ;; `ps-prologue-file' enhancement. 1387 ;; `ps-prologue-file' enhancement.
1380 ;; 1388 ;;
1381 ;; Thanks to Kein'ichi Handa <handa@etl.go.jp> for multi-byte buffer handling. 1389 ;; Thanks to Ken'ichi Handa <handa@m17n.org> for multi-byte buffer handling.
1382 ;; 1390 ;;
1383 ;; Thanks to Matthew O Persico <Matthew.Persico@lazard.com> for line number on 1391 ;; Thanks to Matthew O Persico <Matthew.Persico@lazard.com> for line number on
1384 ;; empty columns. 1392 ;; empty columns.
1385 ;; 1393 ;;
1386 ;; Thanks to Theodore Jump <tjump@cais.com> for adjust PostScript code order on 1394 ;; Thanks to Theodore Jump <tjump@cais.com> for adjust PostScript code order on
1417 ;; 1425 ;;
1418 ;; Thanks to Avishai Yacobi, avishaiy@mcil.comm.mot.com, for writing the 1426 ;; Thanks to Avishai Yacobi, avishaiy@mcil.comm.mot.com, for writing the
1419 ;; initial port to Emacs 19. His code is no longer part of ps-print, but his 1427 ;; initial port to Emacs 19. His code is no longer part of ps-print, but his
1420 ;; work is still appreciated. 1428 ;; work is still appreciated.
1421 ;; 1429 ;;
1422 ;; Thanks to Remi Houdaille and Michel Train, michel@metasoft.fdn.org, for 1430 ;; Thanks to Remi Houdaille and Michel Train <michel@metasoft.fdn.org> for
1423 ;; adding underline support. Their code also is no longer part of ps-print, 1431 ;; adding underline support. Their code also is no longer part of ps-print,
1424 ;; but their efforts are not forgotten. 1432 ;; but their efforts are not forgotten.
1425 ;; 1433 ;;
1426 ;; Thanks also to all of you who mailed code to add features to ps-print; 1434 ;; Thanks also to all of you who mailed code to add features to ps-print;
1427 ;; although I didn't use your code, I still appreciate your sharing it with me. 1435 ;; although I didn't use your code, I still appreciate your sharing it with me.
1433 ;; Jim 1441 ;; Jim
1434 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1442 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1435 1443
1436 ;;; Code: 1444 ;;; Code:
1437 1445
1438 (eval-and-compile 1446
1439 (require 'lpr) 1447 (require 'lpr)
1440 1448
1441 (or (featurep 'lisp-float-type) 1449 (or (featurep 'lisp-float-type)
1442 (error "`ps-print' requires floating point support")) 1450 (error "`ps-print' requires floating point support"))
1443 1451
1444 1452
1445 (defvar ps-print-emacs-type 1453 (defvar ps-print-emacs-type
1446 (let ((case-fold-search t)) 1454 (let ((case-fold-search t))
1447 (cond ((string-match "XEmacs" emacs-version) 'xemacs) 1455 (cond ((string-match "XEmacs" emacs-version) 'xemacs)
1448 ((string-match "Lucid" emacs-version) 1456 ((string-match "Lucid" emacs-version)
1449 (error "`ps-print' doesn't support Lucid")) 1457 (error "`ps-print' doesn't support Lucid"))
1450 ((string-match "Epoch" emacs-version) 1458 ((string-match "Epoch" emacs-version)
1451 (error "`ps-print' doesn't support Epoch")) 1459 (error "`ps-print' doesn't support Epoch"))
1452 (t 1460 (t
1453 (unless (and (boundp 'emacs-major-version) 1461 (unless (and (boundp 'emacs-major-version)
1454 (> emacs-major-version 19)) 1462 (> emacs-major-version 19))
1455 (error "`ps-print' only supports Emacs 20 and higher")) 1463 (error "`ps-print' only supports Emacs 20 and higher"))
1456 'emacs)))) 1464 'emacs))))
1457 1465
1458 1466
1459 ;; For Emacs 20.2 and the earlier version. 1467 ;; For Emacs 20.2 and the earlier version.
1460 1468
1461 (or (fboundp 'set-buffer-multibyte) 1469 (or (fboundp 'set-buffer-multibyte)
1462 (defun set-buffer-multibyte (arg) 1470 (defun set-buffer-multibyte (arg)
1463 (setq enable-multibyte-characters arg))) 1471 (setq enable-multibyte-characters arg)))
1464 1472
1465 (or (fboundp 'string-as-unibyte) 1473 (or (fboundp 'string-as-unibyte)
1466 (defun string-as-unibyte (arg) arg)) 1474 (defun string-as-unibyte (arg) arg))
1467 1475
1468 (or (fboundp 'string-as-multibyte) 1476 (or (fboundp 'string-as-multibyte)
1469 (defun string-as-multibyte (arg) arg)) 1477 (defun string-as-multibyte (arg) arg))
1470 1478
1471 (or (fboundp 'char-charset) 1479 (or (fboundp 'char-charset)
1472 (defun char-charset (arg) 'ascii)) 1480 (defun char-charset (arg) 'ascii))
1473 1481
1474 (or (fboundp 'charset-after) 1482 (or (fboundp 'charset-after)
1475 (defun charset-after (&optional arg) 1483 (defun charset-after (&optional arg)
1476 (char-charset (char-after arg)))) 1484 (char-charset (char-after arg))))
1477 1485
1478 1486
1479 ;; GNU Emacs 1487 ;; GNU Emacs
1480 (or (fboundp 'line-beginning-position) 1488 (or (fboundp 'line-beginning-position)
1481 (defun line-beginning-position (&optional n) 1489 (defun line-beginning-position (&optional n)
1482 (save-excursion 1490 (save-excursion
1483 (and n (/= n 1) (forward-line (1- n))) 1491 (and n (/= n 1) (forward-line (1- n)))
1484 (beginning-of-line) 1492 (beginning-of-line)
1485 (point)))) 1493 (point))))
1486 1494
1487 1495
1488 ;; to avoid compilation gripes 1496 ;; to avoid compilation gripes
1489 1497
1490 ;; XEmacs 1498 ;; XEmacs
1491 (defalias 'ps-x-color-instance-p 'color-instance-p) 1499 (defalias 'ps-x-color-instance-p 'color-instance-p)
1492 (defalias 'ps-x-color-instance-rgb-components 'color-instance-rgb-components) 1500 (defalias 'ps-x-color-instance-rgb-components 'color-instance-rgb-components)
1493 (defalias 'ps-x-color-name 'color-name) 1501 (defalias 'ps-x-color-name 'color-name)
1494 (defalias 'ps-x-color-specifier-p 'color-specifier-p) 1502 (defalias 'ps-x-color-specifier-p 'color-specifier-p)
1495 (defalias 'ps-x-copy-coding-system 'copy-coding-system) 1503 (defalias 'ps-x-copy-coding-system 'copy-coding-system)
1496 (defalias 'ps-x-device-class 'device-class) 1504 (defalias 'ps-x-device-class 'device-class)
1497 (defalias 'ps-x-extent-end-position 'extent-end-position) 1505 (defalias 'ps-x-extent-end-position 'extent-end-position)
1498 (defalias 'ps-x-extent-face 'extent-face) 1506 (defalias 'ps-x-extent-face 'extent-face)
1499 (defalias 'ps-x-extent-priority 'extent-priority) 1507 (defalias 'ps-x-extent-priority 'extent-priority)
1500 (defalias 'ps-x-extent-start-position 'extent-start-position) 1508 (defalias 'ps-x-extent-start-position 'extent-start-position)
1501 (defalias 'ps-x-face-font-instance 'face-font-instance) 1509 (defalias 'ps-x-face-font-instance 'face-font-instance)
1502 (defalias 'ps-x-find-coding-system 'find-coding-system) 1510 (defalias 'ps-x-find-coding-system 'find-coding-system)
1503 (defalias 'ps-x-font-instance-properties 'font-instance-properties) 1511 (defalias 'ps-x-font-instance-properties 'font-instance-properties)
1504 (defalias 'ps-x-make-color-instance 'make-color-instance) 1512 (defalias 'ps-x-make-color-instance 'make-color-instance)
1505 (defalias 'ps-x-map-extents 'map-extents) 1513 (defalias 'ps-x-map-extents 'map-extents)
1506 1514
1507 ;; GNU Emacs 1515 ;; GNU Emacs
1508 (defalias 'ps-e-face-bold-p 'face-bold-p) 1516 (defalias 'ps-e-face-bold-p 'face-bold-p)
1509 (defalias 'ps-e-face-italic-p 'face-italic-p) 1517 (defalias 'ps-e-face-italic-p 'face-italic-p)
1510 (defalias 'ps-e-next-overlay-change 'next-overlay-change) 1518 (defalias 'ps-e-next-overlay-change 'next-overlay-change)
1511 (defalias 'ps-e-overlays-at 'overlays-at) 1519 (defalias 'ps-e-overlays-at 'overlays-at)
1512 (defalias 'ps-e-overlay-get 'overlay-get) 1520 (defalias 'ps-e-overlay-get 'overlay-get)
1513 (defalias 'ps-e-overlay-end 'overlay-end) 1521 (defalias 'ps-e-overlay-end 'overlay-end)
1514 (defalias 'ps-e-x-color-values 'x-color-values) 1522 (defalias 'ps-e-x-color-values 'x-color-values)
1515 (defalias 'ps-e-color-values 'color-values) 1523 (defalias 'ps-e-color-values 'color-values)
1516 (if (fboundp 'find-composition) 1524 (if (fboundp 'find-composition)
1517 (defalias 'ps-e-find-composition 'find-composition) 1525 (defalias 'ps-e-find-composition 'find-composition)
1518 (defalias 'ps-e-find-composition 'ignore)) 1526 (defalias 'ps-e-find-composition 'ignore))
1519 1527
1520 1528
1521 (defconst ps-windows-system 1529 (defconst ps-windows-system
1522 (memq system-type '(emx win32 w32 mswindows ms-dos windows-nt))) 1530 (memq system-type '(emx win32 w32 mswindows ms-dos windows-nt)))
1523 (defconst ps-lp-system 1531 (defconst ps-lp-system
1524 (memq system-type '(usg-unix-v dgux hpux irix))) 1532 (memq system-type '(usg-unix-v dgux hpux irix)))
1525 1533
1526 1534
1527 (defun ps-xemacs-color-name (color) 1535 (defun ps-xemacs-color-name (color)
1528 (if (ps-x-color-specifier-p color) 1536 (if (ps-x-color-specifier-p color)
1529 (ps-x-color-name color) 1537 (ps-x-color-name color)
1530 color)) 1538 color))
1531 1539
1532 1540
1533 (cond ((eq ps-print-emacs-type 'emacs) ; emacs 1541 (cond ((featurep 'xemacs) ; xemacs
1534 (defvar mark-active nil) 1542 (defalias 'ps-mark-active-p 'region-active-p)
1535 (defun ps-mark-active-p () 1543 (defun ps-face-foreground-name (face)
1536 mark-active) 1544 (ps-xemacs-color-name (face-foreground face)))
1537 (defalias 'ps-face-foreground-name 'face-foreground) 1545 (defun ps-face-background-name (face)
1538 (defalias 'ps-face-background-name 'face-background) 1546 (ps-xemacs-color-name (face-background face)))
1539 ) 1547 )
1540 (t ; xemacs 1548 (t ; emacs
1541 (defalias 'ps-mark-active-p 'region-active-p) 1549 (defvar mark-active nil)
1542 (defun ps-face-foreground-name (face) 1550 (defun ps-mark-active-p ()
1543 (ps-xemacs-color-name (face-foreground face))) 1551 mark-active)
1544 (defun ps-face-background-name (face) 1552 (defun ps-face-foreground-name (face)
1545 (ps-xemacs-color-name (face-background face))) 1553 (face-foreground face nil t))
1546 ))) 1554 (defun ps-face-background-name (face)
1555 (face-background face nil t))))
1547 1556
1548 1557
1549 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1558 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1550 ;; User Variables: 1559 ;; User Variables:
1551 1560
1552 1561
1553 ;;; Interface to the command system 1562 ;;; Interface to the command system
1554 1563
1555 (defgroup postscript nil 1564 (defgroup postscript nil
1556 "PostScript Group" 1565 "PostScript Group."
1557 :tag "PostScript" 1566 :tag "PostScript"
1567 :version "20"
1558 :group 'emacs) 1568 :group 'emacs)
1559 1569
1560 (defgroup ps-print nil 1570 (defgroup ps-print nil
1561 "PostScript generator for Emacs" 1571 "PostScript generator for Emacs."
1562 :link '(emacs-library-link :tag "Source Lisp File" "ps-print.el") 1572 :link '(emacs-library-link :tag "Source Lisp File" "ps-print.el")
1563 :prefix "ps-" 1573 :prefix "ps-"
1574 :version "20"
1564 :group 'wp 1575 :group 'wp
1565 :group 'postscript) 1576 :group 'postscript)
1566 1577
1567 (defgroup ps-print-horizontal nil 1578 (defgroup ps-print-horizontal nil
1568 "Horizontal page layout" 1579 "Horizontal page layout."
1569 :prefix "ps-" 1580 :prefix "ps-"
1570 :tag "Horizontal" 1581 :tag "Horizontal"
1582 :version "20"
1571 :group 'ps-print) 1583 :group 'ps-print)
1572 1584
1573 (defgroup ps-print-vertical nil 1585 (defgroup ps-print-vertical nil
1574 "Vertical page layout" 1586 "Vertical page layout."
1575 :prefix "ps-" 1587 :prefix "ps-"
1576 :tag "Vertical" 1588 :tag "Vertical"
1589 :version "20"
1577 :group 'ps-print) 1590 :group 'ps-print)
1578 1591
1579 (defgroup ps-print-headers nil 1592 (defgroup ps-print-headers nil
1580 "Headers & footers layout" 1593 "Headers & footers layout."
1581 :prefix "ps-" 1594 :prefix "ps-"
1582 :tag "Header & Footer" 1595 :tag "Header & Footer"
1596 :version "20"
1583 :group 'ps-print) 1597 :group 'ps-print)
1584 1598
1585 (defgroup ps-print-font nil 1599 (defgroup ps-print-font nil
1586 "Fonts customization" 1600 "Fonts customization."
1587 :prefix "ps-" 1601 :prefix "ps-"
1588 :tag "Font" 1602 :tag "Font"
1603 :version "20"
1589 :group 'ps-print) 1604 :group 'ps-print)
1590 1605
1591 (defgroup ps-print-color nil 1606 (defgroup ps-print-color nil
1592 "Color customization" 1607 "Color customization."
1593 :prefix "ps-" 1608 :prefix "ps-"
1594 :tag "Color" 1609 :tag "Color"
1610 :version "20"
1595 :group 'ps-print) 1611 :group 'ps-print)
1596 1612
1597 (defgroup ps-print-face nil 1613 (defgroup ps-print-face nil
1598 "Faces customization" 1614 "Faces customization."
1599 :prefix "ps-" 1615 :prefix "ps-"
1600 :tag "PS Faces" 1616 :tag "PS Faces"
1617 :version "20"
1601 :group 'ps-print 1618 :group 'ps-print
1602 :group 'faces) 1619 :group 'faces)
1603 1620
1604 (defgroup ps-print-n-up nil 1621 (defgroup ps-print-n-up nil
1605 "N-up customization" 1622 "N-up customization."
1606 :prefix "ps-" 1623 :prefix "ps-"
1607 :tag "N-Up" 1624 :tag "N-Up"
1625 :version "20"
1608 :group 'ps-print) 1626 :group 'ps-print)
1609 1627
1610 (defgroup ps-print-zebra nil 1628 (defgroup ps-print-zebra nil
1611 "Zebra customization" 1629 "Zebra customization."
1612 :prefix "ps-" 1630 :prefix "ps-"
1613 :tag "Zebra" 1631 :tag "Zebra"
1632 :version "20"
1614 :group 'ps-print) 1633 :group 'ps-print)
1615 1634
1616 (defgroup ps-print-background nil 1635 (defgroup ps-print-background nil
1617 "Background customization" 1636 "Background customization."
1618 :prefix "ps-" 1637 :prefix "ps-"
1619 :tag "Background" 1638 :tag "Background"
1639 :version "20"
1620 :group 'ps-print) 1640 :group 'ps-print)
1621 1641
1622 (defgroup ps-print-printer '((lpr custom-group)) 1642 (defgroup ps-print-printer '((lpr custom-group))
1623 "Printer customization" 1643 "Printer customization."
1624 :prefix "ps-" 1644 :prefix "ps-"
1625 :tag "Printer" 1645 :tag "Printer"
1646 :version "20"
1626 :group 'ps-print) 1647 :group 'ps-print)
1627 1648
1628 (defgroup ps-print-page nil 1649 (defgroup ps-print-page nil
1629 "Page customization" 1650 "Page customization."
1630 :prefix "ps-" 1651 :prefix "ps-"
1631 :tag "Page" 1652 :tag "Page"
1653 :version "20"
1632 :group 'ps-print) 1654 :group 'ps-print)
1633 1655
1634 (defgroup ps-print-miscellany nil 1656 (defgroup ps-print-miscellany nil
1635 "Miscellany customization" 1657 "Miscellany customization."
1636 :prefix "ps-" 1658 :prefix "ps-"
1637 :tag "Miscellany" 1659 :tag "Miscellany"
1660 :version "20"
1638 :group 'ps-print) 1661 :group 'ps-print)
1639 1662
1640 1663
1641 (defcustom ps-error-handler-message 'paper 1664 (defcustom ps-error-handler-message 'paper
1642 "*Specify where the error handler message should be sent. 1665 "*Specify where the error handler message should be sent.
1659 Any other value is treated as `paper'." 1682 Any other value is treated as `paper'."
1660 :type '(choice :menu-tag "Error Handler Message" 1683 :type '(choice :menu-tag "Error Handler Message"
1661 :tag "Error Handler Message" 1684 :tag "Error Handler Message"
1662 (const none) (const paper) 1685 (const none) (const paper)
1663 (const system) (const paper-and-system)) 1686 (const system) (const paper-and-system))
1687 :version "20"
1664 :group 'ps-print-miscellany) 1688 :group 'ps-print-miscellany)
1665 1689
1666 (defcustom ps-user-defined-prologue nil 1690 (defcustom ps-user-defined-prologue nil
1667 "*User defined PostScript prologue code inserted before all prologue code. 1691 "*User defined PostScript prologue code inserted before all prologue code.
1668 1692
1690 (concat \"<</DeferredMediaSelection true /PageSize [612 792] \" 1714 (concat \"<</DeferredMediaSelection true /PageSize [612 792] \"
1691 \"/MediaPosition 2 /MediaType (Plain)>> setpagedevice\"))" 1715 \"/MediaPosition 2 /MediaType (Plain)>> setpagedevice\"))"
1692 :type '(choice :menu-tag "User Defined Prologue" 1716 :type '(choice :menu-tag "User Defined Prologue"
1693 :tag "User Defined Prologue" 1717 :tag "User Defined Prologue"
1694 (const :tag "none" nil) string symbol) 1718 (const :tag "none" nil) string symbol)
1719 :version "20"
1695 :group 'ps-print-miscellany) 1720 :group 'ps-print-miscellany)
1696 1721
1697 (defcustom ps-print-prologue-header nil 1722 (defcustom ps-print-prologue-header nil
1698 "*PostScript prologue header comments besides that ps-print generates. 1723 "*PostScript prologue header comments besides that ps-print generates.
1699 1724
1706 more requirements put them first in `ps-print-prologue-header' using the 1731 more requirements put them first in `ps-print-prologue-header' using the
1707 \"%%+\" comment. For example, if you need to set numcopies to 3 and jog on 1732 \"%%+\" comment. For example, if you need to set numcopies to 3 and jog on
1708 requirements and set %%LanguageLevel: to 2, do: 1733 requirements and set %%LanguageLevel: to 2, do:
1709 1734
1710 (setq ps-print-prologue-header 1735 (setq ps-print-prologue-header
1711 \"%%+ numcopies(3) jog\\n%%LanguageLevel: 2\\n\") 1736 \"%%+ numcopies(3) jog\\n%%LanguageLevel: 2\\n\")
1712 1737
1713 The duplex requirement is inserted by ps-print (see `ps-spool-duplex'). 1738 The duplex requirement is inserted by ps-print (see `ps-spool-duplex').
1714 1739
1715 Do not forget to terminate the string with \"\\n\". 1740 Do not forget to terminate the string with \"\\n\".
1716 1741
1719 Adobe Systems Incorporated 1744 Adobe Systems Incorporated
1720 Appendix G: Document Structuring Conventions -- Version 3.0" 1745 Appendix G: Document Structuring Conventions -- Version 3.0"
1721 :type '(choice :menu-tag "Prologue Header" 1746 :type '(choice :menu-tag "Prologue Header"
1722 :tag "Prologue Header" 1747 :tag "Prologue Header"
1723 (const :tag "none" nil) string symbol) 1748 (const :tag "none" nil) string symbol)
1749 :version "20"
1724 :group 'ps-print-miscellany) 1750 :group 'ps-print-miscellany)
1725 1751
1726 (defcustom ps-printer-name (and (boundp 'printer-name) 1752 (defcustom ps-printer-name (and (boundp 'printer-name)
1727 (symbol-value 'printer-name)) 1753 (symbol-value 'printer-name))
1728 "*The name of a local printer for printing PostScript files. 1754 "*The name of a local printer for printing PostScript files.
1750 :tag "Printer Name" 1776 :tag "Printer Name"
1751 (const :tag "Same as printer-name" nil) 1777 (const :tag "Same as printer-name" nil)
1752 (const :tag "No Printer Name" t) 1778 (const :tag "No Printer Name" t)
1753 (file :tag "Print to file") 1779 (file :tag "Print to file")
1754 (string :tag "Pipe to ps-lpr-command")) 1780 (string :tag "Pipe to ps-lpr-command"))
1781 :version "20"
1755 :group 'ps-print-printer) 1782 :group 'ps-print-printer)
1756 1783
1757 (defcustom ps-printer-name-option 1784 (defcustom ps-printer-name-option
1758 (cond (ps-windows-system 1785 (cond (ps-windows-system
1759 "/D:") 1786 "/D:")
1793 programs `print' and `nprint' (the standard print programs on Windows NT and 1820 programs `print' and `nprint' (the standard print programs on Windows NT and
1794 Novell Netware respectively) are handled specially, using `ps-printer-name' as 1821 Novell Netware respectively) are handled specially, using `ps-printer-name' as
1795 the destination for output; any other program is treated like `lpr' except that 1822 the destination for output; any other program is treated like `lpr' except that
1796 an explicit filename is given as the last argument." 1823 an explicit filename is given as the last argument."
1797 :type 'string 1824 :type 'string
1825 :version "20"
1798 :group 'ps-print-printer) 1826 :group 'ps-print-printer)
1799 1827
1800 (defcustom ps-lpr-switches lpr-switches 1828 (defcustom ps-lpr-switches lpr-switches
1801 "*A list of extra switches to pass to `ps-lpr-command'." 1829 "*A list of extra switches to pass to `ps-lpr-command'."
1802 :type '(repeat :tag "PostScript lpr Switches" 1830 :type '(repeat :tag "PostScript lpr Switches"
1803 (choice :menu-tag "PostScript lpr Switch" 1831 (choice :menu-tag "PostScript lpr Switch"
1804 :tag "PostScript lpr Switch" 1832 :tag "PostScript lpr Switch"
1805 string symbol (repeat sexp))) 1833 string symbol (repeat sexp)))
1834 :version "20"
1806 :group 'ps-print-printer) 1835 :group 'ps-print-printer)
1807 1836
1808 (defcustom ps-print-region-function nil 1837 (defcustom ps-print-region-function nil
1809 "*Specify a function to print the region on a PostScript printer. 1838 "*Specify a function to print the region on a PostScript printer.
1810 See definition of `call-process-region' for calling conventions. The fourth 1839 See definition of `call-process-region' for calling conventions. The fourth
1811 and the sixth arguments are both nil." 1840 and the sixth arguments are both nil."
1812 :type '(choice (const nil) function) 1841 :type '(choice (const nil) function)
1842 :version "20"
1813 :group 'ps-print-printer) 1843 :group 'ps-print-printer)
1814 1844
1815 (defcustom ps-manual-feed nil 1845 (defcustom ps-manual-feed nil
1816 "*Non-nil means the printer will manually feed paper. 1846 "*Non-nil means the printer will manually feed paper.
1817 1847
1818 If it's nil, automatic feeding takes place." 1848 If it's nil, automatic feeding takes place."
1819 :type 'boolean 1849 :type 'boolean
1850 :version "20"
1820 :group 'ps-print-printer) 1851 :group 'ps-print-printer)
1821 1852
1822 (defcustom ps-end-with-control-d (and ps-windows-system t) 1853 (defcustom ps-end-with-control-d (and ps-windows-system t)
1823 "*Non-nil means insert C-d at end of PostScript file generated." 1854 "*Non-nil means insert C-d at end of PostScript file generated."
1824 :version "21.1" 1855 :version "21.1"
1825 :type 'boolean 1856 :type 'boolean
1857 :version "20"
1826 :group 'ps-print-printer) 1858 :group 'ps-print-printer)
1827 1859
1828 ;;; Page layout 1860 ;;; Page layout
1829 1861
1830 ;; All page dimensions are in PostScript points. 1862 ;; All page dimensions are in PostScript points.
1864 :type '(repeat (list :tag "Paper Type" 1896 :type '(repeat (list :tag "Paper Type"
1865 (symbol :tag "Name") 1897 (symbol :tag "Name")
1866 (number :tag "Width") 1898 (number :tag "Width")
1867 (number :tag "Height") 1899 (number :tag "Height")
1868 (string :tag "Media"))) 1900 (string :tag "Media")))
1901 :version "20"
1869 :group 'ps-print-page) 1902 :group 'ps-print-page)
1870 1903
1871 ;;;###autoload 1904 ;;;###autoload
1872 (defcustom ps-paper-type 'letter 1905 (defcustom ps-paper-type 'letter
1873 "*Specify the size of paper to format for. 1906 "*Specify the size of paper to format for.
1877 (if (assq (widget-value wid) 1910 (if (assq (widget-value wid)
1878 ps-page-dimensions-database) 1911 ps-page-dimensions-database)
1879 nil 1912 nil
1880 (widget-put wid :error "Unknown paper size") 1913 (widget-put wid :error "Unknown paper size")
1881 wid))) 1914 wid)))
1915 :version "20"
1882 :group 'ps-print-page) 1916 :group 'ps-print-page)
1883 1917
1884 (defcustom ps-warn-paper-type t 1918 (defcustom ps-warn-paper-type t
1885 "*Non-nil means give an error if paper size is not equal to `ps-paper-type'. 1919 "*Non-nil means give an error if paper size is not equal to `ps-paper-type'.
1886 1920
1887 It's used when `ps-spool-config' is set to `setpagedevice'." 1921 It's used when `ps-spool-config' is set to `setpagedevice'."
1888 :type 'boolean 1922 :type 'boolean
1923 :version "20"
1889 :group 'ps-print-page) 1924 :group 'ps-print-page)
1890 1925
1891 (defcustom ps-landscape-mode nil 1926 (defcustom ps-landscape-mode nil
1892 "*Non-nil means print in landscape mode." 1927 "*Non-nil means print in landscape mode."
1893 :type 'boolean 1928 :type 'boolean
1929 :version "20"
1894 :group 'ps-print-page) 1930 :group 'ps-print-page)
1895 1931
1896 (defcustom ps-print-upside-down nil 1932 (defcustom ps-print-upside-down nil
1897 "*Non-nil means print upside-down (that is, rotated by 180 degrees)." 1933 "*Non-nil means print upside-down (that is, rotated by 180 degrees)."
1898 :type 'boolean 1934 :type 'boolean
1904 1940
1905 If nil, print all pages. 1941 If nil, print all pages.
1906 1942
1907 If a list, the lists element may be an integer or a cons cell (FROM . TO) 1943 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 1944 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. 1945 integer lesser than one or if FROM is greater than TO.
1910 1946
1911 Otherwise, it's treated as nil. 1947 Otherwise, it's treated as nil.
1912 1948
1913 After ps-print processing `ps-selected-pages' is set to nil. But the 1949 After ps-print processing `ps-selected-pages' is set to nil. But the
1914 latest `ps-selected-pages' is saved in `ps-last-selected-pages' (which 1950 latest `ps-selected-pages' is saved in `ps-last-selected-pages' (which
1921 (radio :tag "Page" 1957 (radio :tag "Page"
1922 (integer :tag "Number") 1958 (integer :tag "Number")
1923 (cons :tag "Range" 1959 (cons :tag "Range"
1924 (integer :tag "From") 1960 (integer :tag "From")
1925 (integer :tag "To")))) 1961 (integer :tag "To"))))
1962 :version "20"
1926 :group 'ps-print-page) 1963 :group 'ps-print-page)
1927 1964
1928 (defcustom ps-even-or-odd-pages nil 1965 (defcustom ps-even-or-odd-pages nil
1929 "*Specify if it prints even/odd pages. 1966 "*Specify if it prints even/odd pages.
1930 1967
1979 (const :tag "All Pages" nil) 2016 (const :tag "All Pages" nil)
1980 (const :tag "Only Even Pages" even-page) 2017 (const :tag "Only Even Pages" even-page)
1981 (const :tag "Only Odd Pages" odd-page) 2018 (const :tag "Only Odd Pages" odd-page)
1982 (const :tag "Only Even Sheets" even-sheet) 2019 (const :tag "Only Even Sheets" even-sheet)
1983 (const :tag "Only Odd Sheets" odd-sheet)) 2020 (const :tag "Only Odd Sheets" odd-sheet))
2021 :version "20"
1984 :group 'ps-print-page) 2022 :group 'ps-print-page)
1985 2023
1986 (defcustom ps-print-control-characters 'control-8-bit 2024 (defcustom ps-print-control-characters 'control-8-bit
1987 "*Specify the printable form for control and 8-bit characters. 2025 "*Specify the printable form for control and 8-bit characters.
1988 That is, instead of sending, for example, a ^D (\\004) to printer, 2026 That is, instead of sending, for example, a ^D (\\004) to printer,
2010 Any other value is treated as nil." 2048 Any other value is treated as nil."
2011 :type '(choice :menu-tag "Control Char" 2049 :type '(choice :menu-tag "Control Char"
2012 :tag "Control Char" 2050 :tag "Control Char"
2013 (const 8-bit) (const control-8-bit) 2051 (const 8-bit) (const control-8-bit)
2014 (const control) (const :tag "nil" nil)) 2052 (const control) (const :tag "nil" nil))
2053 :version "20"
2015 :group 'ps-print-miscellany) 2054 :group 'ps-print-miscellany)
2016 2055
2017 (defcustom ps-n-up-printing 1 2056 (defcustom ps-n-up-printing 1
2018 "*Specify the number of pages per sheet paper." 2057 "*Specify the number of pages per sheet paper."
2019 :type '(integer 2058 :type '(integer
2025 nil 2064 nil
2026 (widget-put 2065 (widget-put
2027 wid :error 2066 wid :error
2028 "Number of pages per sheet paper must be between 1 and 100.") 2067 "Number of pages per sheet paper must be between 1 and 100.")
2029 wid))) 2068 wid)))
2069 :version "20"
2030 :group 'ps-print-n-up) 2070 :group 'ps-print-n-up)
2031 2071
2032 (defcustom ps-n-up-margin (/ (* 72 1.0) 2.54) ; 1 cm 2072 (defcustom ps-n-up-margin (/ (* 72 1.0) 2.54) ; 1 cm
2033 "*Specify the margin in points between the sheet border and n-up printing." 2073 "*Specify the margin in points between the sheet border and n-up printing."
2034 :type 'number 2074 :type 'number
2075 :version "20"
2035 :group 'ps-print-n-up) 2076 :group 'ps-print-n-up)
2036 2077
2037 (defcustom ps-n-up-border-p t 2078 (defcustom ps-n-up-border-p t
2038 "*Non-nil means a border is drawn around each page." 2079 "*Non-nil means a border is drawn around each page."
2039 :type 'boolean 2080 :type 'boolean
2081 :version "20"
2040 :group 'ps-print-n-up) 2082 :group 'ps-print-n-up)
2041 2083
2042 (defcustom ps-n-up-filling 'left-top 2084 (defcustom ps-n-up-filling 'left-top
2043 "*Specify how page matrix is filled on each sheet of paper. 2085 "*Specify how page matrix is filled on each sheet of paper.
2044 2086
2066 :tag "N-Up Filling" 2108 :tag "N-Up Filling"
2067 (const left-top) (const left-bottom) 2109 (const left-top) (const left-bottom)
2068 (const right-top) (const right-bottom) 2110 (const right-top) (const right-bottom)
2069 (const top-left) (const bottom-left) 2111 (const top-left) (const bottom-left)
2070 (const top-right) (const bottom-right)) 2112 (const top-right) (const bottom-right))
2113 :version "20"
2071 :group 'ps-print-n-up) 2114 :group 'ps-print-n-up)
2072 2115
2073 (defcustom ps-number-of-columns (if ps-landscape-mode 2 1) 2116 (defcustom ps-number-of-columns (if ps-landscape-mode 2 1)
2074 "*Specify the number of columns." 2117 "*Specify the number of columns."
2075 :type 'number 2118 :type 'number
2119 :version "20"
2076 :group 'ps-print-miscellany) 2120 :group 'ps-print-miscellany)
2077 2121
2078 (defcustom ps-zebra-stripes nil 2122 (defcustom ps-zebra-stripes nil
2079 "*Non-nil means print zebra stripes. 2123 "*Non-nil means print zebra stripes.
2080 See also documentation for `ps-zebra-stripe-height' and `ps-zebra-color'." 2124 See also documentation for `ps-zebra-stripe-height' and `ps-zebra-color'."
2081 :type 'boolean 2125 :type 'boolean
2126 :version "20"
2082 :group 'ps-print-zebra) 2127 :group 'ps-print-zebra)
2083 2128
2084 (defcustom ps-zebra-stripe-height 3 2129 (defcustom ps-zebra-stripe-height 3
2085 "*Number of zebra stripe lines. 2130 "*Number of zebra stripe lines.
2086 See also documentation for `ps-zebra-stripes' and `ps-zebra-color'." 2131 See also documentation for `ps-zebra-stripes' and `ps-zebra-color'."
2087 :type 'number 2132 :type 'number
2133 :version "20"
2088 :group 'ps-print-zebra) 2134 :group 'ps-print-zebra)
2089 2135
2090 (defcustom ps-zebra-color 0.95 2136 (defcustom ps-zebra-color 0.95
2091 "*Zebra stripe gray scale or RGB color. 2137 "*Zebra stripe gray scale or RGB color.
2092 See also documentation for `ps-zebra-stripes' and `ps-zebra-stripe-height'." 2138 See also documentation for `ps-zebra-stripes' and `ps-zebra-stripe-height'."
2096 (string :tag "Color Name" :value "gray95") 2142 (string :tag "Color Name" :value "gray95")
2097 (list :tag "RGB Color" :value (0.95 0.95 0.95) 2143 (list :tag "RGB Color" :value (0.95 0.95 0.95)
2098 (number :tag "Red") 2144 (number :tag "Red")
2099 (number :tag "Green") 2145 (number :tag "Green")
2100 (number :tag "Blue"))) 2146 (number :tag "Blue")))
2147 :version "20"
2101 :group 'ps-print-zebra) 2148 :group 'ps-print-zebra)
2102 2149
2103 (defcustom ps-zebra-stripe-follow nil 2150 (defcustom ps-zebra-stripe-follow nil
2104 "*Specify how zebra stripes continue on next page. 2151 "*Specify how zebra stripes continue on next page.
2105 2152
2132 20 XXXXX + 20 XXXXXXXX + 18 XXXXXX + 18 + 2179 20 XXXXX + 20 XXXXXXXX + 18 XXXXXX + 18 +
2133 21 + 21 XXXXXXXX + 2180 21 + 21 XXXXXXXX +
2134 22 + 22 + 2181 22 + 22 +
2135 -------- ----------- --------- ---------------- 2182 -------- ----------- --------- ----------------
2136 2183
2137 Any other value is treated as `nil'." 2184 Any other value is treated as nil."
2138 :type '(choice :menu-tag "Zebra Stripe Follow" 2185 :type '(choice :menu-tag "Zebra Stripe Follow"
2139 :tag "Zebra Stripe Follow" 2186 :tag "Zebra Stripe Follow"
2140 (const :tag "Always Restart" nil) 2187 (const :tag "Always Restart" nil)
2141 (const :tag "Continue on Next Page" follow) 2188 (const :tag "Continue on Next Page" follow)
2142 (const :tag "Print Only Full Stripe" full) 2189 (const :tag "Print Only Full Stripe" full)
2143 (const :tag "Continue on Full Stripe" full-follow)) 2190 (const :tag "Continue on Full Stripe" full-follow))
2191 :version "20"
2144 :group 'ps-print-zebra) 2192 :group 'ps-print-zebra)
2145 2193
2146 (defcustom ps-line-number nil 2194 (defcustom ps-line-number nil
2147 "*Non-nil means print line number." 2195 "*Non-nil means print line number."
2148 :type 'boolean 2196 :type 'boolean
2197 :version "20"
2149 :group 'ps-print-miscellany) 2198 :group 'ps-print-miscellany)
2150 2199
2151 (defcustom ps-line-number-step 1 2200 (defcustom ps-line-number-step 1
2152 "*Specify the interval that line number is printed. 2201 "*Specify the interval that line number is printed.
2153 2202
2173 Any other value is treated as `zebra'." 2222 Any other value is treated as `zebra'."
2174 :type '(choice :menu-tag "Line Number Step" 2223 :type '(choice :menu-tag "Line Number Step"
2175 :tag "Line Number Step" 2224 :tag "Line Number Step"
2176 (integer :tag "Step Interval") 2225 (integer :tag "Step Interval")
2177 (const :tag "Synchronize Zebra" zebra)) 2226 (const :tag "Synchronize Zebra" zebra))
2227 :version "20"
2178 :group 'ps-print-miscellany) 2228 :group 'ps-print-miscellany)
2179 2229
2180 (defcustom ps-line-number-start 1 2230 (defcustom ps-line-number-start 1
2181 "*Specify the starting point in the interval given by `ps-line-number-step'. 2231 "*Specify the starting point in the interval given by `ps-line-number-step'.
2182 2232
2202 2252
2203 * If `ps-line-number-step' is set to `zebra', must be between 1 and the 2253 * If `ps-line-number-step' is set to `zebra', must be between 1 and the
2204 value of `ps-zebra-strip-height' inclusive. Use this combination if you 2254 value of `ps-zebra-strip-height' inclusive. Use this combination if you
2205 wish that line number be relative to zebra stripes." 2255 wish that line number be relative to zebra stripes."
2206 :type '(integer :tag "Start Step Interval") 2256 :type '(integer :tag "Start Step Interval")
2257 :version "20"
2207 :group 'ps-print-miscellany) 2258 :group 'ps-print-miscellany)
2208 2259
2209 (defcustom ps-print-background-image nil 2260 (defcustom ps-print-background-image nil
2210 "*EPS image list to be printed on background. 2261 "*EPS image list to be printed on background.
2211 2262
2216 FILENAME is a file name which contains an EPS image or some PostScript 2267 FILENAME is a file name which contains an EPS image or some PostScript
2217 programming like EPS. 2268 programming like EPS.
2218 FILENAME is ignored, if it doesn't exist or is read protected. 2269 FILENAME is ignored, if it doesn't exist or is read protected.
2219 2270
2220 X and Y are relative positions on paper to put the image. 2271 X and Y are relative positions on paper to put the image.
2221 If X and Y are nil, the image is centralized on paper. 2272 If X and Y are nil, the image is centered on paper.
2222 2273
2223 XSCALE and YSCALE are scale factor to be applied to image before printing. 2274 XSCALE and YSCALE are scale factor to be applied to image before printing.
2224 If XSCALE and YSCALE are nil, the original size is used. 2275 If XSCALE and YSCALE are nil, the original size is used.
2225 2276
2226 ROTATION is the image rotation angle; if nil, the default is 0. 2277 ROTATION is the image rotation angle; if nil, the default is 0.
2248 (repeat :tag "Pages" :inline t 2299 (repeat :tag "Pages" :inline t
2249 (radio (integer :tag "Page") 2300 (radio (integer :tag "Page")
2250 (cons :tag "Range" 2301 (cons :tag "Range"
2251 (integer :tag "From") 2302 (integer :tag "From")
2252 (integer :tag "To")))))) 2303 (integer :tag "To"))))))
2304 :version "20"
2253 :group 'ps-print-background) 2305 :group 'ps-print-background)
2254 2306
2255 (defcustom ps-print-background-text nil 2307 (defcustom ps-print-background-text nil
2256 "*Text list to be printed on background. 2308 "*Text list to be printed on background.
2257 2309
2299 (repeat :tag "Pages" :inline t 2351 (repeat :tag "Pages" :inline t
2300 (radio (integer :tag "Page") 2352 (radio (integer :tag "Page")
2301 (cons :tag "Range" 2353 (cons :tag "Range"
2302 (integer :tag "From") 2354 (integer :tag "From")
2303 (integer :tag "To")))))) 2355 (integer :tag "To"))))))
2356 :version "20"
2304 :group 'ps-print-background) 2357 :group 'ps-print-background)
2305 2358
2306 ;;; Horizontal layout 2359 ;;; Horizontal layout
2307 2360
2308 ;; ------------------------------------------ 2361 ;; ------------------------------------------
2312 ;; ------------------------------------------ 2365 ;; ------------------------------------------
2313 2366
2314 (defcustom ps-left-margin (/ (* 72 2.0) 2.54) ; 2 cm 2367 (defcustom ps-left-margin (/ (* 72 2.0) 2.54) ; 2 cm
2315 "*Left margin in points (1/72 inch)." 2368 "*Left margin in points (1/72 inch)."
2316 :type 'number 2369 :type 'number
2370 :version "20"
2317 :group 'ps-print-horizontal) 2371 :group 'ps-print-horizontal)
2318 2372
2319 (defcustom ps-right-margin (/ (* 72 2.0) 2.54) ; 2 cm 2373 (defcustom ps-right-margin (/ (* 72 2.0) 2.54) ; 2 cm
2320 "*Right margin in points (1/72 inch)." 2374 "*Right margin in points (1/72 inch)."
2321 :type 'number 2375 :type 'number
2376 :version "20"
2322 :group 'ps-print-horizontal) 2377 :group 'ps-print-horizontal)
2323 2378
2324 (defcustom ps-inter-column (/ (* 72 2.0) 2.54) ; 2 cm 2379 (defcustom ps-inter-column (/ (* 72 2.0) 2.54) ; 2 cm
2325 "*Horizontal space between columns in points (1/72 inch)." 2380 "*Horizontal space between columns in points (1/72 inch)."
2326 :type 'number 2381 :type 'number
2382 :version "20"
2327 :group 'ps-print-horizontal) 2383 :group 'ps-print-horizontal)
2328 2384
2329 ;;; Vertical layout 2385 ;;; Vertical layout
2330 2386
2331 ;; |--------| 2387 ;; |--------|
2341 ;; |--------| 2397 ;; |--------|
2342 2398
2343 (defcustom ps-bottom-margin (/ (* 72 1.5) 2.54) ; 1.5 cm 2399 (defcustom ps-bottom-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
2344 "*Bottom margin in points (1/72 inch)." 2400 "*Bottom margin in points (1/72 inch)."
2345 :type 'number 2401 :type 'number
2402 :version "20"
2346 :group 'ps-print-vertical) 2403 :group 'ps-print-vertical)
2347 2404
2348 (defcustom ps-top-margin (/ (* 72 1.5) 2.54) ; 1.5 cm 2405 (defcustom ps-top-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
2349 "*Top margin in points (1/72 inch)." 2406 "*Top margin in points (1/72 inch)."
2350 :type 'number 2407 :type 'number
2408 :version "20"
2351 :group 'ps-print-vertical) 2409 :group 'ps-print-vertical)
2352 2410
2353 (defcustom ps-header-offset (/ (* 72 1.0) 2.54) ; 1.0 cm 2411 (defcustom ps-header-offset (/ (* 72 1.0) 2.54) ; 1.0 cm
2354 "*Vertical space in points (1/72 inch) between the main text and the header." 2412 "*Vertical space in points (1/72 inch) between the main text and the header."
2355 :type 'number 2413 :type 'number
2414 :version "20"
2356 :group 'ps-print-vertical) 2415 :group 'ps-print-vertical)
2357 2416
2358 (defcustom ps-header-line-pad 0.15 2417 (defcustom ps-header-line-pad 0.15
2359 "*Portion of a header title line height to insert. 2418 "*Portion of a header title line height to insert.
2360 The insertion is done between the header frame and the text it contains, 2419 The insertion is done between the header frame and the text it contains,
2361 both in the vertical and horizontal directions." 2420 both in the vertical and horizontal directions."
2362 :type 'number 2421 :type 'number
2422 :version "20"
2363 :group 'ps-print-vertical) 2423 :group 'ps-print-vertical)
2364 2424
2365 (defcustom ps-footer-offset (/ (* 72 1.0) 2.54) ; 1.0 cm 2425 (defcustom ps-footer-offset (/ (* 72 1.0) 2.54) ; 1.0 cm
2366 "*Vertical space in points (1/72 inch) between the main text and the footer." 2426 "*Vertical space in points (1/72 inch) between the main text and the footer."
2367 :type 'number 2427 :type 'number
2428 :version "20"
2368 :group 'ps-print-vertical) 2429 :group 'ps-print-vertical)
2369 2430
2370 (defcustom ps-footer-line-pad 0.15 2431 (defcustom ps-footer-line-pad 0.15
2371 "*Portion of a footer title line height to insert. 2432 "*Portion of a footer title line height to insert.
2372 The insertion is done between the footer frame and the text it contains, 2433 The insertion is done between the footer frame and the text it contains,
2373 both in the vertical and horizontal directions." 2434 both in the vertical and horizontal directions."
2374 :type 'number 2435 :type 'number
2436 :version "20"
2375 :group 'ps-print-vertical) 2437 :group 'ps-print-vertical)
2376 2438
2377 ;;; Header/Footer setup 2439 ;;; Header/Footer setup
2378 2440
2379 (defcustom ps-print-header t 2441 (defcustom ps-print-header t
2380 "*Non-nil means print a header at the top of each page. 2442 "*Non-nil means print a header at the top of each page.
2381 By default, the header displays the buffer name, page number, and, if the 2443 By default, the header displays the buffer name, page number, and, if the
2382 buffer is visiting a file, the file's directory. Headers are customizable by 2444 buffer is visiting a file, the file's directory. Headers are customizable by
2383 changing variables `ps-left-header' and `ps-right-header'." 2445 changing variables `ps-left-header' and `ps-right-header'."
2384 :type 'boolean 2446 :type 'boolean
2447 :version "20"
2385 :group 'ps-print-headers) 2448 :group 'ps-print-headers)
2386 2449
2387 (defcustom ps-print-header-frame t 2450 (defcustom ps-print-header-frame t
2388 "*Non-nil means draw a gaudy frame around the header." 2451 "*Non-nil means draw a gaudy frame around the header."
2389 :type 'boolean 2452 :type 'boolean
2453 :version "20"
2390 :group 'ps-print-headers) 2454 :group 'ps-print-headers)
2391 2455
2392 (defcustom ps-header-frame-alist 2456 (defcustom ps-header-frame-alist
2393 '((fore-color . 0.0) 2457 '((fore-color . 0.0)
2394 (back-color . 0.9) 2458 (back-color . 0.9)
2464 (string :tag "Color Name" :value "black") 2528 (string :tag "Color Name" :value "black")
2465 (list :tag "RGB Color" :value (0.0 0.0 0.0) 2529 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2466 (number :tag "Red") 2530 (number :tag "Red")
2467 (number :tag "Green") 2531 (number :tag "Green")
2468 (number :tag "Blue")))))) 2532 (number :tag "Blue"))))))
2533 :version "20"
2469 :group 'ps-print-headers) 2534 :group 'ps-print-headers)
2470 2535
2471 (defcustom ps-header-lines 2 2536 (defcustom ps-header-lines 2
2472 "*Number of lines to display in page header, when generating PostScript." 2537 "*Number of lines to display in page header, when generating PostScript."
2473 :type 'integer 2538 :type 'integer
2539 :version "20"
2474 :group 'ps-print-headers) 2540 :group 'ps-print-headers)
2475 2541
2476 (defcustom ps-print-footer nil 2542 (defcustom ps-print-footer nil
2477 "*Non-nil means print a footer at the bottom of each page. 2543 "*Non-nil means print a footer at the bottom of each page.
2478 By default, the footer displays page number. 2544 By default, the footer displays page number.
2479 Footers are customizable by changing variables `ps-left-footer' and 2545 Footers are customizable by changing variables `ps-left-footer' and
2480 `ps-right-footer'." 2546 `ps-right-footer'."
2547 :type 'boolean
2481 :version "21.1" 2548 :version "21.1"
2482 :type 'boolean
2483 :group 'ps-print-headers) 2549 :group 'ps-print-headers)
2484 2550
2485 (defcustom ps-print-footer-frame t 2551 (defcustom ps-print-footer-frame t
2486 "*Non-nil means draw a gaudy frame around the footer." 2552 "*Non-nil means draw a gaudy frame around the footer."
2553 :type 'boolean
2487 :version "21.1" 2554 :version "21.1"
2488 :type 'boolean
2489 :group 'ps-print-headers) 2555 :group 'ps-print-headers)
2490 2556
2491 (defcustom ps-footer-frame-alist 2557 (defcustom ps-footer-frame-alist
2492 '((fore-color . 0.0) 2558 '((fore-color . 0.0)
2493 (back-color . 0.9) 2559 (back-color . 0.9)
2498 2564
2499 Don't change this alist directly, instead use customization, or `ps-value', 2565 Don't change this alist directly, instead use customization, or `ps-value',
2500 `ps-get', `ps-put' and `ps-del' functions (see them for documentation). 2566 `ps-get', `ps-put' and `ps-del' functions (see them for documentation).
2501 2567
2502 See also `ps-header-frame-alist' for documentation." 2568 See also `ps-header-frame-alist' for documentation."
2503 :version "21.1"
2504 :type '(repeat 2569 :type '(repeat
2505 (choice :menu-tag "Header Frame Element" 2570 (choice :menu-tag "Header Frame Element"
2506 :tag "" 2571 :tag ""
2507 (cons :tag "Foreground Color" :format "%v" 2572 (cons :tag "Foreground Color" :format "%v"
2508 (const :format "" fore-color) 2573 (const :format "" fore-color)
2545 (string :tag "Color Name" :value "black") 2610 (string :tag "Color Name" :value "black")
2546 (list :tag "RGB Color" :value (0.0 0.0 0.0) 2611 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2547 (number :tag "Red") 2612 (number :tag "Red")
2548 (number :tag "Green") 2613 (number :tag "Green")
2549 (number :tag "Blue")))))) 2614 (number :tag "Blue"))))))
2615 :version "21.1"
2550 :group 'ps-print-headers) 2616 :group 'ps-print-headers)
2551 2617
2552 (defcustom ps-footer-lines 2 2618 (defcustom ps-footer-lines 2
2553 "*Number of lines to display in page footer, when generating PostScript." 2619 "*Number of lines to display in page footer, when generating PostScript."
2620 :type 'integer
2554 :version "21.1" 2621 :version "21.1"
2555 :type 'integer
2556 :group 'ps-print-headers) 2622 :group 'ps-print-headers)
2557 2623
2558 (defcustom ps-print-only-one-header nil 2624 (defcustom ps-print-only-one-header nil
2559 "*Non-nil means print only one header/footer at the top/bottom of each page. 2625 "*Non-nil means print only one header/footer at the top/bottom of each page.
2560 This is useful when printing more than one column, so it is possible to have 2626 This is useful when printing more than one column, so it is possible to have
2561 only one header/footer over all columns or one header/footer per column. 2627 only one header/footer over all columns or one header/footer per column.
2562 See also `ps-print-header' and `ps-print-footer'." 2628 See also `ps-print-header' and `ps-print-footer'."
2563 :type 'boolean 2629 :type 'boolean
2630 :version "20"
2564 :group 'ps-print-headers) 2631 :group 'ps-print-headers)
2565 2632
2566 (defcustom ps-switch-header 'duplex 2633 (defcustom ps-switch-header 'duplex
2567 "*Specify if headers/footers are switched or not. 2634 "*Specify if headers/footers are switched or not.
2568 2635
2581 :type '(choice :menu-tag "Switch Header/Footer" 2648 :type '(choice :menu-tag "Switch Header/Footer"
2582 :tag "Switch Header/Footer" 2649 :tag "Switch Header/Footer"
2583 (const :tag "Never Switch" nil) 2650 (const :tag "Never Switch" nil)
2584 (const :tag "Always Switch" t) 2651 (const :tag "Always Switch" t)
2585 (const :tag "Switch When Duplexing" duplex)) 2652 (const :tag "Switch When Duplexing" duplex))
2653 :version "20"
2586 :group 'ps-print-headers) 2654 :group 'ps-print-headers)
2587 2655
2588 (defcustom ps-show-n-of-n t 2656 (defcustom ps-show-n-of-n t
2589 "*Non-nil means show page numbers as N/M, meaning page N of M. 2657 "*Non-nil means show page numbers as N/M, meaning page N of M.
2590 NOTE: page numbers are displayed as part of headers, 2658 NOTE: page numbers are displayed as part of headers,
2591 see variable `ps-print-header'." 2659 see variable `ps-print-header'."
2592 :type 'boolean 2660 :type 'boolean
2661 :version "20"
2593 :group 'ps-print-headers) 2662 :group 'ps-print-headers)
2594 2663
2595 (defcustom ps-spool-config 2664 (defcustom ps-spool-config
2596 (if ps-windows-system 2665 (if ps-windows-system
2597 nil 2666 nil
2623 the printed file isn't OK, set `ps-spool-config' to nil." 2692 the printed file isn't OK, set `ps-spool-config' to nil."
2624 :type '(choice :menu-tag "Spool Config" 2693 :type '(choice :menu-tag "Spool Config"
2625 :tag "Spool Config" 2694 :tag "Spool Config"
2626 (const lpr-switches) (const setpagedevice) 2695 (const lpr-switches) (const setpagedevice)
2627 (const :tag "nil" nil)) 2696 (const :tag "nil" nil))
2697 :version "20"
2628 :group 'ps-print-headers) 2698 :group 'ps-print-headers)
2629 2699
2630 (defcustom ps-spool-duplex nil ; Not many people have duplex printers, 2700 (defcustom ps-spool-duplex nil ; Not many people have duplex printers,
2631 ; so default to nil. 2701 ; so default to nil.
2632 "*Non-nil generates PostScript for a two-sided printer. 2702 "*Non-nil generates PostScript for a two-sided printer.
2636 reversed on duplex printers so that the page numbers fall to the left on 2706 reversed on duplex printers so that the page numbers fall to the left on
2637 even-numbered pages. 2707 even-numbered pages.
2638 2708
2639 See also `ps-spool-tumble'." 2709 See also `ps-spool-tumble'."
2640 :type 'boolean 2710 :type 'boolean
2711 :version "20"
2641 :group 'ps-print-headers) 2712 :group 'ps-print-headers)
2642 2713
2643 (defcustom ps-spool-tumble nil 2714 (defcustom ps-spool-tumble nil
2644 "*Specify how the page images on opposite sides of a sheet are oriented. 2715 "*Specify how the page images on opposite sides of a sheet are oriented.
2645 If `ps-spool-tumble' is nil, produces output suitable for binding on the left 2716 If `ps-spool-tumble' is nil, produces output suitable for binding on the left
2646 or right. If `ps-spool-tumble' is non-nil, produces output suitable for 2717 or right. If `ps-spool-tumble' is non-nil, produces output suitable for
2647 binding at the top or bottom. 2718 binding at the top or bottom.
2648 2719
2649 It has effect only when `ps-spool-duplex' is non-nil." 2720 It has effect only when `ps-spool-duplex' is non-nil."
2650 :type 'boolean 2721 :type 'boolean
2722 :version "20"
2651 :group 'ps-print-headers) 2723 :group 'ps-print-headers)
2652 2724
2653 ;;; Fonts 2725 ;;; Fonts
2654 2726
2655 (defcustom ps-font-info-database 2727 (defcustom ps-font-info-database
2747 (fonts (normal . "Zapf-Dingbats")) 2819 (fonts (normal . "Zapf-Dingbats"))
2748 (size . 10.0) 2820 (size . 10.0)
2749 (line-height . 9.63) 2821 (line-height . 9.63)
2750 (space-width . 2.78) 2822 (space-width . 2.78)
2751 (avg-char-width . 2.78)) 2823 (avg-char-width . 2.78))
2824 (ZapfChancery-MediumItalic
2825 (fonts (normal . "ZapfChancery-MediumItalic"))
2826 (size . 10.0)
2827 (line-height . 11.45)
2828 (space-width . 2.2)
2829 (avg-char-width . 4.10811))
2830 ;; We keep this wrong entry name (but with correct font name) for
2831 ;; backward compatibility.
2752 (Zapf-Chancery-MediumItalic 2832 (Zapf-Chancery-MediumItalic
2753 (fonts (normal . "Zapf-Chancery-MediumItalic")) 2833 (fonts (normal . "ZapfChancery-MediumItalic"))
2754 (size . 10.0) 2834 (size . 10.0)
2755 (line-height . 11.45) 2835 (line-height . 11.45)
2756 (space-width . 2.2) 2836 (space-width . 2.2)
2757 (avg-char-width . 4.10811)) 2837 (avg-char-width . 4.10811))
2758 ) 2838 )
2796 (const :format "" space-width) 2876 (const :format "" space-width)
2797 (number :tag "Space Width")) 2877 (number :tag "Space Width"))
2798 (cons :format "%v" 2878 (cons :format "%v"
2799 (const :format "" avg-char-width) 2879 (const :format "" avg-char-width)
2800 (number :tag "Average Character Width")))) 2880 (number :tag "Average Character Width"))))
2881 :version "20"
2801 :group 'ps-print-font) 2882 :group 'ps-print-font)
2802 2883
2803 (defcustom ps-font-family 'Courier 2884 (defcustom ps-font-family 'Courier
2804 "*Font family name for ordinary text, when generating PostScript." 2885 "*Font family name for ordinary text, when generating PostScript."
2805 :type 'symbol 2886 :type 'symbol
2887 :version "20"
2806 :group 'ps-print-font) 2888 :group 'ps-print-font)
2807 2889
2808 (defcustom ps-font-size '(7 . 8.5) 2890 (defcustom ps-font-size '(7 . 8.5)
2809 "*Font size, in points, for ordinary text, when generating PostScript." 2891 "*Font size, in points, for ordinary text, when generating PostScript."
2810 :type '(choice :menu-tag "Ordinary Text Font Size" 2892 :type '(choice :menu-tag "Ordinary Text Font Size"
2811 :tag "Ordinary Text Font Size" 2893 :tag "Ordinary Text Font Size"
2812 (number :tag "Text Size") 2894 (number :tag "Text Size")
2813 (cons :tag "Landscape/Portrait" 2895 (cons :tag "Landscape/Portrait"
2814 (number :tag "Landscape Text Size") 2896 (number :tag "Landscape Text Size")
2815 (number :tag "Portrait Text Size"))) 2897 (number :tag "Portrait Text Size")))
2898 :version "20"
2816 :group 'ps-print-font) 2899 :group 'ps-print-font)
2817 2900
2818 (defcustom ps-header-font-family 'Helvetica 2901 (defcustom ps-header-font-family 'Helvetica
2819 "*Font family name for text in the header, when generating PostScript." 2902 "*Font family name for text in the header, when generating PostScript."
2820 :type 'symbol 2903 :type 'symbol
2904 :version "20"
2821 :group 'ps-print-font) 2905 :group 'ps-print-font)
2822 2906
2823 (defcustom ps-header-font-size '(10 . 12) 2907 (defcustom ps-header-font-size '(10 . 12)
2824 "*Font size, in points, for text in the header, when generating PostScript." 2908 "*Font size, in points, for text in the header, when generating PostScript."
2825 :type '(choice :menu-tag "Header Font Size" 2909 :type '(choice :menu-tag "Header Font Size"
2826 :tag "Header Font Size" 2910 :tag "Header Font Size"
2827 (number :tag "Header Size") 2911 (number :tag "Header Size")
2828 (cons :tag "Landscape/Portrait" 2912 (cons :tag "Landscape/Portrait"
2829 (number :tag "Landscape Header Size") 2913 (number :tag "Landscape Header Size")
2830 (number :tag "Portrait Header Size"))) 2914 (number :tag "Portrait Header Size")))
2915 :version "20"
2831 :group 'ps-print-font) 2916 :group 'ps-print-font)
2832 2917
2833 (defcustom ps-header-title-font-size '(12 . 14) 2918 (defcustom ps-header-title-font-size '(12 . 14)
2834 "*Font size, in points, for the top line of text in header, in PostScript." 2919 "*Font size, in points, for the top line of text in header, in PostScript."
2835 :type '(choice :menu-tag "Header Title Font Size" 2920 :type '(choice :menu-tag "Header Title Font Size"
2836 :tag "Header Title Font Size" 2921 :tag "Header Title Font Size"
2837 (number :tag "Header Title Size") 2922 (number :tag "Header Title Size")
2838 (cons :tag "Landscape/Portrait" 2923 (cons :tag "Landscape/Portrait"
2839 (number :tag "Landscape Header Title Size") 2924 (number :tag "Landscape Header Title Size")
2840 (number :tag "Portrait Header Title Size"))) 2925 (number :tag "Portrait Header Title Size")))
2926 :version "20"
2841 :group 'ps-print-font) 2927 :group 'ps-print-font)
2842 2928
2843 (defcustom ps-footer-font-family 'Helvetica 2929 (defcustom ps-footer-font-family 'Helvetica
2844 "*Font family name for text in the footer, when generating PostScript." 2930 "*Font family name for text in the footer, when generating PostScript."
2931 :type 'symbol
2845 :version "21.1" 2932 :version "21.1"
2846 :type 'symbol
2847 :group 'ps-print-font) 2933 :group 'ps-print-font)
2848 2934
2849 (defcustom ps-footer-font-size '(10 . 12) 2935 (defcustom ps-footer-font-size '(10 . 12)
2850 "*Font size, in points, for text in the footer, when generating PostScript." 2936 "*Font size, in points, for text in the footer, when generating PostScript."
2851 :version "21.1"
2852 :type '(choice :menu-tag "Footer Font Size" 2937 :type '(choice :menu-tag "Footer Font Size"
2853 :tag "Footer Font Size" 2938 :tag "Footer Font Size"
2854 (number :tag "Footer Size") 2939 (number :tag "Footer Size")
2855 (cons :tag "Landscape/Portrait" 2940 (cons :tag "Landscape/Portrait"
2856 (number :tag "Landscape Footer Size") 2941 (number :tag "Landscape Footer Size")
2857 (number :tag "Portrait Footer Size"))) 2942 (number :tag "Portrait Footer Size")))
2943 :version "21.1"
2858 :group 'ps-print-font) 2944 :group 'ps-print-font)
2859 2945
2860 (defcustom ps-line-number-color "black" 2946 (defcustom ps-line-number-color "black"
2861 "*Specify color for line-number, when generating PostScript." 2947 "*Specify color for line-number, when generating PostScript."
2862 :type '(choice :menu-tag "Line Number Color" 2948 :type '(choice :menu-tag "Line Number Color"
2872 :group 'ps-print-miscellany) 2958 :group 'ps-print-miscellany)
2873 2959
2874 (defcustom ps-line-number-font "Times-Italic" 2960 (defcustom ps-line-number-font "Times-Italic"
2875 "*Font for line-number, when generating PostScript." 2961 "*Font for line-number, when generating PostScript."
2876 :type 'string 2962 :type 'string
2963 :version "20"
2877 :group 'ps-print-font 2964 :group 'ps-print-font
2878 :group 'ps-print-miscellany) 2965 :group 'ps-print-miscellany)
2879 2966
2880 (defcustom ps-line-number-font-size 6 2967 (defcustom ps-line-number-font-size 6
2881 "*Font size, in points, for line number, when generating PostScript." 2968 "*Font size, in points, for line number, when generating PostScript."
2883 :tag "Line Number Font Size" 2970 :tag "Line Number Font Size"
2884 (number :tag "Font Size") 2971 (number :tag "Font Size")
2885 (cons :tag "Landscape/Portrait" 2972 (cons :tag "Landscape/Portrait"
2886 (number :tag "Landscape Font Size") 2973 (number :tag "Landscape Font Size")
2887 (number :tag "Portrait Font Size"))) 2974 (number :tag "Portrait Font Size")))
2975 :version "20"
2888 :group 'ps-print-font 2976 :group 'ps-print-font
2889 :group 'ps-print-miscellany) 2977 :group 'ps-print-miscellany)
2890 2978
2891 ;;; Colors 2979 ;;; Colors
2892 2980
2913 :type '(choice :menu-tag "Print Color" 3001 :type '(choice :menu-tag "Print Color"
2914 :tag "Print Color" 3002 :tag "Print Color"
2915 (const :tag "Do NOT Print Color" nil) 3003 (const :tag "Do NOT Print Color" nil)
2916 (const :tag "Print Always Color" t) 3004 (const :tag "Print Always Color" t)
2917 (const :tag "Print Black/White Color" black-white)) 3005 (const :tag "Print Black/White Color" black-white))
3006 :version "20"
2918 :group 'ps-print-color) 3007 :group 'ps-print-color)
2919 3008
2920 (defcustom ps-default-fg '(0.0 0.0 0.0) ; black 3009 (defcustom ps-default-fg '(0.0 0.0 0.0) ; black
2921 "*RGB values of the default foreground color. Defaults to black." 3010 "*RGB values of the default foreground color. Defaults to black.
3011
3012 The `ps-default-fg' variable contains the default foreground color used by
3013 ps-print, that is, if there is a face in a text that doesn't have a foreground
3014 color, the `ps-default-fg' color should be used.
3015
3016 Valid values are:
3017
3018 t The foreground color of Emacs session will be used.
3019
3020 NUMBER It's a real value between 0.0 (black) and 1.0 (white) that
3021 indicate the gray color.
3022
3023 COLOR-NAME It's a string which contains the color name. For example:
3024 \"yellow\".
3025
3026 LIST It's a list of RGB values, that is a list of three real values
3027 of the form:
3028
3029 (RED, GREEN, BLUE)
3030
3031 Where RED, GREEN and BLUE are reals between 0.0 (no color) and
3032 1.0 (full color).
3033
3034 Any other value is ignored and black will be used.
3035
3036 It's used only when `ps-print-color-p' is non-nil."
2922 :type '(choice :menu-tag "Default Foreground Gray/Color" 3037 :type '(choice :menu-tag "Default Foreground Gray/Color"
2923 :tag "Default Foreground Gray/Color" 3038 :tag "Default Foreground Gray/Color"
2924 (const :tag "Session Foreground" t) 3039 (const :tag "Session Foreground" t)
2925 (number :tag "Gray Scale" :value 0.0) 3040 (number :tag "Gray Scale" :value 0.0)
2926 (string :tag "Color Name" :value "black") 3041 (string :tag "Color Name" :value "black")
2927 (list :tag "RGB Color" :value (0.0 0.0 0.0) 3042 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2928 (number :tag "Red") 3043 (number :tag "Red")
2929 (number :tag "Green") 3044 (number :tag "Green")
2930 (number :tag "Blue"))) 3045 (number :tag "Blue")))
3046 :version "20"
2931 :group 'ps-print-color) 3047 :group 'ps-print-color)
2932 3048
2933 (defcustom ps-default-bg '(1.0 1.0 1.0) ; white 3049 (defcustom ps-default-bg '(1.0 1.0 1.0) ; white
2934 "*RGB values of the default background color. Defaults to white." 3050 "*RGB values of the default background color. Defaults to white.
3051
3052 The `ps-default-bg' variable contains the default background color used by
3053 ps-print, that is, if there is a face in a text that doesn't have a background
3054 color, the `ps-default-bg' color should be used.
3055
3056 Valid values are:
3057
3058 t The background color of Emacs session will be used.
3059
3060 NUMBER It's a real value between 0.0 (black) and 1.0 (white) that
3061 indicate the gray color.
3062
3063 COLOR-NAME It's a string which contains the color name. For example:
3064 \"yellow\".
3065
3066 LIST It's a list of RGB values, that is a list of three real values
3067 of the form:
3068
3069 (RED, GREEN, BLUE)
3070
3071 Where RED, GREEN and BLUE are reals between 0.0 (no color) and
3072 1.0 (full color).
3073
3074 Any other value is ignored and white will be used.
3075
3076 It's used only when `ps-print-color-p' is non-nil.
3077
3078 See also `ps-use-face-background'."
2935 :type '(choice :menu-tag "Default Background Gray/Color" 3079 :type '(choice :menu-tag "Default Background Gray/Color"
2936 :tag "Default Background Gray/Color" 3080 :tag "Default Background Gray/Color"
2937 (const :tag "Session Background" t) 3081 (const :tag "Session Background" t)
2938 (number :tag "Gray Scale" :value 1.0) 3082 (number :tag "Gray Scale" :value 1.0)
2939 (string :tag "Color Name" :value "white") 3083 (string :tag "Color Name" :value "white")
2940 (list :tag "RGB Color" :value (1.0 1.0 1.0) 3084 (list :tag "RGB Color" :value (1.0 1.0 1.0)
2941 (number :tag "Red") 3085 (number :tag "Red")
2942 (number :tag "Green") 3086 (number :tag "Green")
2943 (number :tag "Blue"))) 3087 (number :tag "Blue")))
3088 :version "20"
2944 :group 'ps-print-color) 3089 :group 'ps-print-color)
2945 3090
2946 (defcustom ps-auto-font-detect t 3091 (defcustom ps-auto-font-detect t
2947 "*Non-nil means automatically detect bold/italic/underline face attributes. 3092 "*Non-nil means automatically detect bold/italic/underline face attributes.
2948 If nil, we rely solely on the lists `ps-bold-faces', `ps-italic-faces', and 3093 If nil, we rely solely on the lists `ps-bold-faces', `ps-italic-faces', and
2949 `ps-underlined-faces'." 3094 `ps-underlined-faces'."
2950 :type 'boolean 3095 :type 'boolean
3096 :version "20"
2951 :group 'ps-print-font) 3097 :group 'ps-print-font)
2952 3098
2953 (defcustom ps-black-white-faces 3099 (defcustom ps-black-white-faces
2954 '((font-lock-builtin-face "black" nil bold ) 3100 '((font-lock-builtin-face "black" nil bold )
2955 (font-lock-comment-face "gray20" nil italic) 3101 (font-lock-comment-face "gray20" nil italic)
2985 (const strikeout) 3131 (const strikeout)
2986 (const overline) 3132 (const overline)
2987 (const shadow) 3133 (const shadow)
2988 (const box) 3134 (const box)
2989 (const outline))))) 3135 (const outline)))))
3136 :version "20"
2990 :group 'ps-print-face) 3137 :group 'ps-print-face)
2991 3138
2992 (defcustom ps-bold-faces 3139 (defcustom ps-bold-faces
2993 (unless ps-print-color-p 3140 (unless ps-print-color-p
2994 '(font-lock-function-name-face 3141 '(font-lock-function-name-face
2997 font-lock-keyword-face 3144 font-lock-keyword-face
2998 font-lock-warning-face)) 3145 font-lock-warning-face))
2999 "*A list of the \(non-bold\) faces that should be printed in bold font. 3146 "*A list of the \(non-bold\) faces that should be printed in bold font.
3000 This applies to generating PostScript." 3147 This applies to generating PostScript."
3001 :type '(repeat face) 3148 :type '(repeat face)
3149 :version "20"
3002 :group 'ps-print-face) 3150 :group 'ps-print-face)
3003 3151
3004 (defcustom ps-italic-faces 3152 (defcustom ps-italic-faces
3005 (unless ps-print-color-p 3153 (unless ps-print-color-p
3006 '(font-lock-variable-name-face 3154 '(font-lock-variable-name-face
3009 font-lock-comment-face 3157 font-lock-comment-face
3010 font-lock-warning-face)) 3158 font-lock-warning-face))
3011 "*A list of the \(non-italic\) faces that should be printed in italic font. 3159 "*A list of the \(non-italic\) faces that should be printed in italic font.
3012 This applies to generating PostScript." 3160 This applies to generating PostScript."
3013 :type '(repeat face) 3161 :type '(repeat face)
3162 :version "20"
3014 :group 'ps-print-face) 3163 :group 'ps-print-face)
3015 3164
3016 (defcustom ps-underlined-faces 3165 (defcustom ps-underlined-faces
3017 (unless ps-print-color-p 3166 (unless ps-print-color-p
3018 '(font-lock-function-name-face 3167 '(font-lock-function-name-face
3019 font-lock-constant-face 3168 font-lock-constant-face
3020 font-lock-warning-face)) 3169 font-lock-warning-face))
3021 "*A list of the \(non-underlined\) faces that should be printed underlined. 3170 "*A list of the \(non-underlined\) faces that should be printed underlined.
3022 This applies to generating PostScript." 3171 This applies to generating PostScript."
3023 :type '(repeat face) 3172 :type '(repeat face)
3173 :version "20"
3024 :group 'ps-print-face) 3174 :group 'ps-print-face)
3025 3175
3026 (defcustom ps-use-face-background nil 3176 (defcustom ps-use-face-background nil
3027 "*Specify if face background should be used. 3177 "*Specify if face background should be used.
3028 3178
3038 (const :tag "Always Use Face Background" t) 3188 (const :tag "Always Use Face Background" t)
3039 (const :tag "Never Use Face Background" nil) 3189 (const :tag "Never Use Face Background" nil)
3040 (repeat :menu-tag "Face Background List" 3190 (repeat :menu-tag "Face Background List"
3041 :tag "Face Background List" 3191 :tag "Face Background List"
3042 face)) 3192 face))
3193 :version "20"
3043 :group 'ps-print-face) 3194 :group 'ps-print-face)
3044 3195
3045 (defcustom ps-left-header 3196 (defcustom ps-left-header
3046 (list 'ps-get-buffer-name 'ps-header-dirpart) 3197 (list 'ps-get-buffer-name 'ps-header-dirpart)
3047 "*The items to display (each on a line) on the left part of the page header. 3198 "*The items to display (each on a line) on the left part of the page header.
3055 delimiters '(' and ')'. 3206 delimiters '(' and ')'.
3056 3207
3057 For symbols with bound functions, the function is called and should return a 3208 For symbols with bound functions, the function is called and should return a
3058 string to be inserted into the array. For symbols with bound values, the value 3209 string to be inserted into the array. For symbols with bound values, the value
3059 should be a string to be inserted into the array. In either case, function or 3210 should be a string to be inserted into the array. In either case, function or
3060 variable, the string value has PostScript string delimiters added to it." 3211 variable, the string value has PostScript string delimiters added to it.
3212
3213 If symbols are unbounded, they are silently ignored."
3061 :type '(repeat (choice :menu-tag "Left Header" 3214 :type '(repeat (choice :menu-tag "Left Header"
3062 :tag "Left Header" 3215 :tag "Left Header"
3063 string symbol)) 3216 string symbol))
3217 :version "20"
3064 :group 'ps-print-headers) 3218 :group 'ps-print-headers)
3065 3219
3066 (defcustom ps-right-header 3220 (defcustom ps-right-header
3067 (list "/pagenumberstring load" 3221 (list "/pagenumberstring load"
3068 'ps-time-stamp-locale-default 'ps-time-stamp-hh:mm:ss) 3222 'ps-time-stamp-locale-default 'ps-time-stamp-hh:mm:ss)
3079 3233
3080 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\". 3234 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\".
3081 3235
3082 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\". 3236 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\".
3083 3237
3238 `ps-time-stamp-yyyy-mm-dd' Return date as \"2001-06-18\" (ISO
3239 date).
3240
3241 `ps-time-stamp-iso8601' Alias for `ps-time-stamp-yyyy-mm-dd'.
3242
3084 You can also create your own time stamp function by using `format-time-string' 3243 You can also create your own time stamp function by using `format-time-string'
3085 \(which see)." 3244 \(which see)."
3086 :type '(repeat (choice :menu-tag "Right Header" 3245 :type '(repeat (choice :menu-tag "Right Header"
3087 :tag "Right Header" 3246 :tag "Right Header"
3088 string symbol)) 3247 string symbol))
3248 :version "20"
3089 :group 'ps-print-headers) 3249 :group 'ps-print-headers)
3090 3250
3091 (defcustom ps-left-footer 3251 (defcustom ps-left-footer
3092 (list 'ps-get-buffer-name 'ps-header-dirpart) 3252 (list 'ps-get-buffer-name 'ps-header-dirpart)
3093 "*The items to display (each on a line) on the left part of the page footer. 3253 "*The items to display (each on a line) on the left part of the page footer.
3101 ')'. 3261 ')'.
3102 3262
3103 For symbols with bound functions, the function is called and should return a 3263 For symbols with bound functions, the function is called and should return a
3104 string to be inserted into the array. For symbols with bound values, the value 3264 string to be inserted into the array. For symbols with bound values, the value
3105 should be a string to be inserted into the array. In either case, function or 3265 should be a string to be inserted into the array. In either case, function or
3106 variable, the string value has PostScript string delimiters added to it." 3266 variable, the string value has PostScript string delimiters added to it.
3107 :version "21.1" 3267
3268 If symbols are unbounded, they are silently ignored."
3108 :type '(repeat (choice :menu-tag "Left Footer" 3269 :type '(repeat (choice :menu-tag "Left Footer"
3109 :tag "Left Footer" 3270 :tag "Left Footer"
3110 string symbol)) 3271 string symbol))
3272 :version "21.1"
3111 :group 'ps-print-headers) 3273 :group 'ps-print-headers)
3112 3274
3113 (defcustom ps-right-footer 3275 (defcustom ps-right-footer
3114 (list "/pagenumberstring load" 3276 (list "/pagenumberstring load"
3115 'ps-time-stamp-locale-default 'ps-time-stamp-hh:mm:ss) 3277 'ps-time-stamp-locale-default 'ps-time-stamp-hh:mm:ss)
3126 3288
3127 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\". 3289 `ps-time-stamp-hh:mm:ss' Return time as \"17:28:31\".
3128 3290
3129 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\". 3291 `ps-time-stamp-mon-dd-yyyy' Return date as \"Jun 18 2001\".
3130 3292
3293 `ps-time-stamp-yyyy-mm-dd' Return date as \"2001-06-18\" (ISO
3294 date).
3295
3296 `ps-time-stamp-iso8601' Alias for `ps-time-stamp-yyyy-mm-dd'.
3297
3131 You can also create your own time stamp function by using `format-time-string' 3298 You can also create your own time stamp function by using `format-time-string'
3132 \(which see)." 3299 \(which see)."
3133 :version "21.1"
3134 :type '(repeat (choice :menu-tag "Right Footer" 3300 :type '(repeat (choice :menu-tag "Right Footer"
3135 :tag "Right Footer" 3301 :tag "Right Footer"
3136 string symbol)) 3302 string symbol))
3303 :version "21.1"
3137 :group 'ps-print-headers) 3304 :group 'ps-print-headers)
3138 3305
3139 (defcustom ps-razzle-dazzle t 3306 (defcustom ps-razzle-dazzle t
3140 "*Non-nil means report progress while formatting buffer." 3307 "*Non-nil means report progress while formatting buffer."
3141 :type 'boolean 3308 :type 'boolean
3309 :version "20"
3142 :group 'ps-print-miscellany) 3310 :group 'ps-print-miscellany)
3143 3311
3144 (defcustom ps-adobe-tag "%!PS-Adobe-3.0\n" 3312 (defcustom ps-adobe-tag "%!PS-Adobe-3.0\n"
3145 "*Contains the header line identifying the output as PostScript. 3313 "*Contains the header line identifying the output as PostScript.
3146 By default, `ps-adobe-tag' contains the standard identifier. Some printers 3314 By default, `ps-adobe-tag' contains the standard identifier. Some printers
3147 require slightly different versions of this line." 3315 require slightly different versions of this line."
3148 :type 'string 3316 :type 'string
3317 :version "20"
3149 :group 'ps-print-miscellany) 3318 :group 'ps-print-miscellany)
3150 3319
3151 (defcustom ps-build-face-reference t 3320 (defcustom ps-build-face-reference t
3152 "*Non-nil means build the reference face lists. 3321 "*Non-nil means build the reference face lists.
3153 3322
3158 3327
3159 You should set this value back to t after you change the attributes of any 3328 You should set this value back to t after you change the attributes of any
3160 face, or create new faces. Most users shouldn't have to worry about its 3329 face, or create new faces. Most users shouldn't have to worry about its
3161 setting, though." 3330 setting, though."
3162 :type 'boolean 3331 :type 'boolean
3332 :version "20"
3163 :group 'ps-print-face) 3333 :group 'ps-print-face)
3164 3334
3165 (defcustom ps-always-build-face-reference nil 3335 (defcustom ps-always-build-face-reference nil
3166 "*Non-nil means always rebuild the reference face lists. 3336 "*Non-nil means always rebuild the reference face lists.
3167 3337
3168 If this variable is non-nil, ps-print will rebuild its internal reference lists 3338 If this variable is non-nil, ps-print will rebuild its internal reference lists
3169 of bold and italic faces *every* time one of the ...-with-faces commands is 3339 of bold and italic faces *every* time one of the ...-with-faces commands is
3170 called. Most users shouldn't need to set this variable." 3340 called. Most users shouldn't need to set this variable."
3171 :type 'boolean 3341 :type 'boolean
3342 :version "20"
3172 :group 'ps-print-face) 3343 :group 'ps-print-face)
3173 3344
3174 (defcustom ps-banner-page-when-duplexing nil 3345 (defcustom ps-banner-page-when-duplexing nil
3175 "*Non-nil means the very first page is skipped. 3346 "*Non-nil means the very first page is skipped.
3176 It's like the very first character of buffer (or region) is ^L (\\014)." 3347 It's like the very first character of buffer (or region) is ^L (\\014)."
3177 :type 'boolean 3348 :type 'boolean
3349 :version "20"
3178 :group 'ps-print-headers) 3350 :group 'ps-print-headers)
3179 3351
3180 (defcustom ps-postscript-code-directory 3352 (defcustom ps-postscript-code-directory
3181 (or (cond 3353 (or (if (featurep 'xemacs)
3182 ((eq ps-print-emacs-type 'emacs) ; emacs 3354 (cond ((fboundp 'locate-data-directory) ; xemacs
3183 data-directory) 3355 (locate-data-directory "ps-print"))
3184 ((fboundp 'locate-data-directory) ; xemacs 3356 ((boundp 'data-directory) ; xemacs
3185 (locate-data-directory "ps-print")) 3357 data-directory)
3186 ((boundp 'data-directory) ; xemacs 3358 (t ; don't know what to do
3187 data-directory) 3359 nil))
3188 (t ; don't know what to do 3360 data-directory) ; emacs
3189 nil))
3190 (error "`ps-postscript-code-directory' isn't set properly")) 3361 (error "`ps-postscript-code-directory' isn't set properly"))
3191 "*Directory where it's located the PostScript prologue file used by ps-print. 3362 "*Directory where it's located the PostScript prologue file used by ps-print.
3192 By default, this directory is the same as in the variable `data-directory'." 3363 By default, this directory is the same as in the variable `data-directory'."
3193 :type 'directory 3364 :type 'directory
3365 :version "20"
3194 :group 'ps-print-miscellany) 3366 :group 'ps-print-miscellany)
3195 3367
3196 (defcustom ps-line-spacing 0 3368 (defcustom ps-line-spacing 0
3197 "*Specify line spacing, in points, for ordinary text. 3369 "*Specify line spacing, in points, for ordinary text.
3198 3370
3426 (let (ps-prefix-quote) 3598 (let (ps-prefix-quote)
3427 (mapconcat 3599 (mapconcat
3428 #'ps-print-quote 3600 #'ps-print-quote
3429 (list 3601 (list
3430 (concat "\n;;; ps-print version " ps-print-version "\n") 3602 (concat "\n;;; ps-print version " ps-print-version "\n")
3603 ";; internal vars"
3604 (ps-comment-string "emacs-version " emacs-version)
3605 (ps-comment-string "ps-print-emacs-type" ps-print-emacs-type)
3606 (ps-comment-string "ps-windows-system " ps-windows-system)
3607 (ps-comment-string "ps-lp-system " ps-lp-system)
3608 nil
3431 '(25 . ps-print-color-p) 3609 '(25 . ps-print-color-p)
3432 '(25 . ps-lpr-command) 3610 '(25 . ps-lpr-command)
3433 '(25 . ps-lpr-switches) 3611 '(25 . ps-lpr-switches)
3434 '(25 . ps-printer-name) 3612 '(25 . ps-printer-name)
3435 '(25 . ps-printer-name-option) 3613 '(25 . ps-printer-name-option)
3580 " " 3758 " "
3581 (setq ps-prefix-quote t) 3759 (setq ps-prefix-quote t)
3582 "(setq ") 3760 "(setq ")
3583 key 3761 key
3584 (if (> col len) 3762 (if (> col len)
3585 (make-string (- col len) ?\ ) 3763 (make-string (- col len) ?\s)
3586 " ") 3764 " ")
3587 (cond ((null val) "nil") 3765 (ps-value-string val))))
3588 ((eq val t) "t")
3589 ((or (symbolp val) (listp val)) (format "'%S" val))
3590 (t (format "%S" val))))))
3591 (t "") 3766 (t "")
3592 )) 3767 ))
3768
3769
3770 (defun ps-value-string (val)
3771 "Return a string representation of VAL. Used by `ps-print-quote'."
3772 (cond ((null val)
3773 "nil")
3774 ((eq val t)
3775 "t")
3776 ((or (symbolp val) (listp val))
3777 (format "'%S" val))
3778 (t
3779 (format "%S" val))))
3780
3781
3782 (defun ps-comment-string (str value)
3783 "Return a comment string like \";; STR = VALUE\"."
3784 (format ";; %s = %s" str (ps-value-string value)))
3593 3785
3594 3786
3595 (defun ps-value (alist-sym key) 3787 (defun ps-value (alist-sym key)
3596 "Return value from association list ALIST-SYM which car is `eq' to KEY." 3788 "Return value from association list ALIST-SYM which car is `eq' to KEY."
3597 (cdr (assq key (symbol-value alist-sym)))) 3789 (cdr (assq key (symbol-value alist-sym))))
3638 (defun ps-time-stamp-mon-dd-yyyy () 3830 (defun ps-time-stamp-mon-dd-yyyy ()
3639 "Return date as \"Jun 18 2001\"." 3831 "Return date as \"Jun 18 2001\"."
3640 (format-time-string "%b %d %Y")) 3832 (format-time-string "%b %d %Y"))
3641 3833
3642 3834
3835 (defun ps-time-stamp-yyyy-mm-dd ()
3836 "Return date as \"2001-06-18\" (ISO date)."
3837 (format-time-string "%Y-%m-%d"))
3838
3839
3840 ;; Alias for `ps-time-stamp-yyyy-mm-dd' (which see).
3841 (defalias 'ps-time-stamp-iso8601 'ps-time-stamp-yyyy-mm-dd)
3842
3843
3643 (defun ps-time-stamp-hh:mm:ss () 3844 (defun ps-time-stamp-hh:mm:ss ()
3644 "Return time as \"17:28:31\"." 3845 "Return time as \"17:28:31\"."
3645 (format-time-string "%T")) 3846 (format-time-string "%T"))
3646 3847
3647 3848
3648 (eval-and-compile 3849 (and (featurep 'xemacs)
3649 (and (eq ps-print-emacs-type 'xemacs) 3850 ;; XEmacs change: Need to check for emacs-major-version too.
3650 ;; XEmacs change: Need to check for emacs-major-version too. 3851 (or (< emacs-major-version 19)
3651 (or (< emacs-major-version 19) 3852 (and (= emacs-major-version 19) (< emacs-minor-version 12)))
3652 (and (= emacs-major-version 19) (< emacs-minor-version 12))) 3853 (setq ps-print-color-p nil))
3653 (setq ps-print-color-p nil)) 3854
3654 3855
3655 3856 ;; Return t if the device (which can be changed during an emacs session)
3656 ;; Return t if the device (which can be changed during an emacs session) 3857 ;; can handle colors.
3657 ;; can handle colors. 3858 ;; This function is not yet implemented for GNU emacs.
3658 ;; This function is not yet implemented for GNU emacs. 3859 (cond ((and (featurep 'xemacs)
3659 (cond ((and (eq ps-print-emacs-type 'xemacs) 3860 ;; XEmacs change: Need to check for emacs-major-version too.
3660 ;; XEmacs change: Need to check for emacs-major-version too. 3861 (or (> emacs-major-version 19)
3661 (or (> emacs-major-version 19) 3862 (and (= emacs-major-version 19)
3662 (and (= emacs-major-version 19) 3863 (>= emacs-minor-version 12)))) ; xemacs >= 19.12
3663 (>= emacs-minor-version 12)))) ; xemacs >= 19.12 3864 (defun ps-color-device ()
3664 (defun ps-color-device () 3865 (eq (ps-x-device-class) 'color)))
3665 (eq (ps-x-device-class) 'color))) 3866
3666 3867 (t ; emacs
3667 (t ; emacs 3868 (defun ps-color-device ()
3668 (defun ps-color-device () 3869 (if (fboundp 'color-values)
3669 (if (fboundp 'color-values) 3870 (ps-e-color-values "Green")
3670 (ps-e-color-values "Green") 3871 t))))
3671 t)))) 3872
3672 3873
3673 3874 (defun ps-mapper (extent list)
3674 (defun ps-mapper (extent list) 3875 (nconc list
3675 (nconc list 3876 (list (list (ps-x-extent-start-position extent) 'push extent)
3676 (list (list (ps-x-extent-start-position extent) 'push extent) 3877 (list (ps-x-extent-end-position extent) 'pull extent)))
3677 (list (ps-x-extent-end-position extent) 'pull extent))) 3878 nil)
3678 nil) 3879
3679 3880 (defun ps-extent-sorter (a b)
3680 (defun ps-extent-sorter (a b) 3881 (< (ps-x-extent-priority a) (ps-x-extent-priority b)))
3681 (< (ps-x-extent-priority a) (ps-x-extent-priority b))) 3882
3682 3883 (defun ps-xemacs-face-kind-p (face kind kind-regex)
3683 (defun ps-xemacs-face-kind-p (face kind kind-regex) 3884 (let* ((frame-font (or (ps-x-face-font-instance face)
3684 (let* ((frame-font (or (ps-x-face-font-instance face) 3885 (ps-x-face-font-instance 'default)))
3685 (ps-x-face-font-instance 'default))) 3886 (kind-cons
3686 (kind-cons 3887 (and frame-font
3687 (and frame-font 3888 (assq kind
3688 (assq kind 3889 (ps-x-font-instance-properties frame-font))))
3689 (ps-x-font-instance-properties frame-font)))) 3890 (kind-spec (cdr-safe kind-cons))
3690 (kind-spec (cdr-safe kind-cons)) 3891 (case-fold-search t))
3691 (case-fold-search t)) 3892 (and kind-spec (string-match kind-regex kind-spec))))
3692 (and kind-spec (string-match kind-regex kind-spec)))) 3893
3693 3894 (cond ((featurep 'xemacs) ; xemacs
3694 (cond ((eq ps-print-emacs-type 'emacs) ; emacs 3895
3695 3896 ;; to avoid XEmacs compilation gripes
3696 (defun ps-color-values (x-color) 3897 (defvar coding-system-for-write nil)
3898 (defvar coding-system-for-read nil)
3899 (defvar buffer-file-coding-system nil)
3900
3901 (and (fboundp 'find-coding-system)
3902 (or (ps-x-find-coding-system 'raw-text-unix)
3903 (ps-x-copy-coding-system 'no-conversion-unix 'raw-text-unix)))
3904
3905 (defun ps-color-values (x-color)
3906 (let ((color (ps-xemacs-color-name x-color)))
3697 (cond 3907 (cond
3698 ((fboundp 'color-values)
3699 (ps-e-color-values x-color))
3700 ((fboundp 'x-color-values) 3908 ((fboundp 'x-color-values)
3701 (ps-e-x-color-values x-color)) 3909 (ps-e-x-color-values color))
3910 ((and (fboundp 'color-instance-rgb-components)
3911 (ps-color-device))
3912 (ps-x-color-instance-rgb-components
3913 (if (ps-x-color-instance-p x-color)
3914 x-color
3915 (ps-x-make-color-instance color))))
3702 (t 3916 (t
3703 (error "No available function to determine X color values")))) 3917 (error "No available function to determine X color values")))))
3704 3918
3705 (defun ps-face-bold-p (face) 3919 (defun ps-face-bold-p (face)
3706 (or (ps-e-face-bold-p face) 3920 (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold")
3707 (memq face ps-bold-faces))) 3921 (memq face ps-bold-faces))) ; Kludge-compatible
3708 3922
3709 (defun ps-face-italic-p (face) 3923 (defun ps-face-italic-p (face)
3710 (or (ps-e-face-italic-p face) 3924 (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o")
3711 (memq face ps-italic-faces))) 3925 (ps-xemacs-face-kind-p face 'SLANT "i\\|o")
3712 ) 3926 (memq face ps-italic-faces))) ; Kludge-compatible
3713 3927 )
3714 (t ; xemacs 3928
3715 3929 (t ; emacs
3716 ;; to avoid XEmacs compilation gripes 3930
3717 (defvar coding-system-for-write nil) 3931 (defun ps-color-values (x-color)
3718 (defvar coding-system-for-read nil) 3932 (cond
3719 (defvar buffer-file-coding-system nil) 3933 ((fboundp 'color-values)
3720 3934 (ps-e-color-values x-color))
3721 (and (fboundp 'find-coding-system) 3935 ((fboundp 'x-color-values)
3722 (or (ps-x-find-coding-system 'raw-text-unix) 3936 (ps-e-x-color-values x-color))
3723 (ps-x-copy-coding-system 'no-conversion-unix 'raw-text-unix))) 3937 (t
3724 3938 (error "No available function to determine X color values"))))
3725 (defun ps-color-values (x-color) 3939
3726 (let ((color (ps-xemacs-color-name x-color))) 3940 (defun ps-face-bold-p (face)
3727 (cond 3941 (or (ps-e-face-bold-p face)
3728 ((fboundp 'x-color-values) 3942 (memq face ps-bold-faces)))
3729 (ps-e-x-color-values color)) 3943
3730 ((and (fboundp 'color-instance-rgb-components) 3944 (defun ps-face-italic-p (face)
3731 (ps-color-device)) 3945 (or (ps-e-face-italic-p face)
3732 (ps-x-color-instance-rgb-components 3946 (memq face ps-italic-faces)))
3733 (if (ps-x-color-instance-p x-color) 3947 ))
3734 x-color
3735 (ps-x-make-color-instance color))))
3736 (t
3737 (error "No available function to determine X color values")))))
3738
3739 (defun ps-face-bold-p (face)
3740 (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold")
3741 (memq face ps-bold-faces))) ; Kludge-compatible
3742
3743 (defun ps-face-italic-p (face)
3744 (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o")
3745 (ps-xemacs-face-kind-p face 'SLANT "i\\|o")
3746 (memq face ps-italic-faces))) ; Kludge-compatible
3747 )))
3748 3948
3749 3949
3750 (defvar ps-print-color-scale 1.0) 3950 (defvar ps-print-color-scale 1.0)
3751 3951
3752 (defun ps-color-scale (color) 3952 (defun ps-color-scale (color)
3815 (defvar ps-background-text-count 0) 4015 (defvar ps-background-text-count 0)
3816 (defvar ps-background-image-count 0) 4016 (defvar ps-background-image-count 0)
3817 4017
3818 (defvar ps-current-font 0) 4018 (defvar ps-current-font 0)
3819 (defvar ps-default-foreground nil) 4019 (defvar ps-default-foreground nil)
4020 (defvar ps-default-background nil)
3820 (defvar ps-default-color nil) 4021 (defvar ps-default-color nil)
3821 (defvar ps-current-color nil) 4022 (defvar ps-current-color nil)
3822 (defvar ps-current-bg nil) 4023 (defvar ps-current-bg nil)
3823 4024
3824 (defvar ps-zebra-stripe-full-p nil) 4025 (defvar ps-zebra-stripe-full-p nil)
3825 (defvar ps-razchunk 0) 4026 (defvar ps-razchunk 0)
3826 4027
3827 (defvar ps-color-p nil) 4028 (defvar ps-color-p nil)
3828 (defvar ps-color-format 4029 (defvar ps-color-format
3829 (if (eq ps-print-emacs-type 'emacs) 4030 (if (featurep 'xemacs)
3830 4031 ;; XEmacs will have to make do with %s (princ) for floats.
3831 ;; Emacs understands the %f format; we'll use it to limit color RGB 4032 "%s %s %s"
3832 ;; values to three decimals to cut down some on the size of the 4033
3833 ;; PostScript output. 4034 ;; Emacs understands the %f format; we'll use it to limit color RGB
3834 "%0.3f %0.3f %0.3f" 4035 ;; values to three decimals to cut down some on the size of the
3835 4036 ;; PostScript output.
3836 ;; XEmacs will have to make do with %s (princ) for floats. 4037 "%0.3f %0.3f %0.3f"))
3837 "%s %s %s"))
3838 4038
3839 ;; These values determine how much print-height to deduct when headers/footers 4039 ;; These values determine how much print-height to deduct when headers/footers
3840 ;; are turned on. This is a pretty clumsy way of handling it, but it'll do for 4040 ;; are turned on. This is a pretty clumsy way of handling it, but it'll do for
3841 ;; now. 4041 ;; now.
3842 4042
3935 "Extend face in ALIST-SYM. 4135 "Extend face in ALIST-SYM.
3936 4136
3937 If optional MERGE-P is non-nil, extensions in FACE-EXTENSION-LIST are merged 4137 If optional MERGE-P is non-nil, extensions in FACE-EXTENSION-LIST are merged
3938 with face extension in ALIST-SYM; otherwise, overrides. 4138 with face extension in ALIST-SYM; otherwise, overrides.
3939 4139
3940 If optional ALIST-SYM is nil, it's used `ps-print-face-extension-alist'; 4140 If optional ALIST-SYM is nil, `ps-print-face-extension-alist' is used;
3941 otherwise, it should be an alist symbol. 4141 otherwise, it should be an alist symbol.
3942 4142
3943 The elements in FACE-EXTENSION-LIST is like those for `ps-extend-face'. 4143 The elements in FACE-EXTENSION-LIST are like those for `ps-extend-face'.
3944 4144
3945 See `ps-extend-face' for documentation." 4145 See `ps-extend-face' for documentation."
3946 (while face-extension-list 4146 (while face-extension-list
3947 (ps-extend-face (car face-extension-list) merge-p alist-sym) 4147 (ps-extend-face (car face-extension-list) merge-p alist-sym)
3948 (setq face-extension-list (cdr face-extension-list)))) 4148 (setq face-extension-list (cdr face-extension-list))))
3953 "Extend face in ALIST-SYM. 4153 "Extend face in ALIST-SYM.
3954 4154
3955 If optional MERGE-P is non-nil, extensions in FACE-EXTENSION list are merged 4155 If optional MERGE-P is non-nil, extensions in FACE-EXTENSION list are merged
3956 with face extensions in ALIST-SYM; otherwise, overrides. 4156 with face extensions in ALIST-SYM; otherwise, overrides.
3957 4157
3958 If optional ALIST-SYM is nil, it's used `ps-print-face-extension-alist'; 4158 If optional ALIST-SYM is nil, `ps-print-face-extension-alist' is used;
3959 otherwise, it should be an alist symbol. 4159 otherwise, it should be an alist symbol.
3960 4160
3961 The elements of FACE-EXTENSION list have the form: 4161 The elements of FACE-EXTENSION list have the form:
3962 4162
3963 (FACE-NAME FOREGROUND BACKGROUND EXTENSION...) 4163 (FACE-NAME FOREGROUND BACKGROUND EXTENSION...)
4056 4256
4057 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4257 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4058 ;; Internal functions and variables 4258 ;; Internal functions and variables
4059 4259
4060 4260
4261 (defun ps-message-log-max ()
4262 (and (not (string= (buffer-name) "*Messages*"))
4263 (boundp 'message-log-max)
4264 message-log-max))
4265
4266
4061 (defvar ps-print-hook nil) 4267 (defvar ps-print-hook nil)
4062 (defvar ps-print-begin-sheet-hook nil) 4268 (defvar ps-print-begin-sheet-hook nil)
4063 (defvar ps-print-begin-page-hook nil) 4269 (defvar ps-print-begin-page-hook nil)
4064 (defvar ps-print-begin-column-hook nil) 4270 (defvar ps-print-begin-column-hook nil)
4065 4271
4068 (ps-spool-without-faces from to region-p) 4274 (ps-spool-without-faces from to region-p)
4069 (ps-do-despool filename)) 4275 (ps-do-despool filename))
4070 4276
4071 4277
4072 (defun ps-spool-without-faces (from to &optional region-p) 4278 (defun ps-spool-without-faces (from to &optional region-p)
4073 (run-hooks 'ps-print-hook) 4279 (let ((message-log-max (ps-message-log-max))) ; to print *Messages* buffer
4074 (ps-printing-region region-p from) 4280 (run-hooks 'ps-print-hook)
4075 (ps-generate (current-buffer) from to 'ps-generate-postscript)) 4281 (ps-printing-region region-p from to)
4282 (ps-generate (current-buffer) from to 'ps-generate-postscript)))
4076 4283
4077 4284
4078 (defun ps-print-with-faces (from to &optional filename region-p) 4285 (defun ps-print-with-faces (from to &optional filename region-p)
4079 (ps-spool-with-faces from to region-p) 4286 (ps-spool-with-faces from to region-p)
4080 (ps-do-despool filename)) 4287 (ps-do-despool filename))
4081 4288
4082 4289
4083 (defun ps-spool-with-faces (from to &optional region-p) 4290 (defun ps-spool-with-faces (from to &optional region-p)
4084 (run-hooks 'ps-print-hook) 4291 (let ((message-log-max (ps-message-log-max))) ; to print *Messages* buffer
4085 (ps-printing-region region-p from) 4292 (run-hooks 'ps-print-hook)
4086 (ps-generate (current-buffer) from to 'ps-generate-postscript-with-faces)) 4293 (ps-printing-region region-p from to)
4294 (ps-generate (current-buffer) from to 'ps-generate-postscript-with-faces)))
4087 4295
4088 4296
4089 (defun ps-count-lines-preprint (from to) 4297 (defun ps-count-lines-preprint (from to)
4090 (or (and from to) 4298 (or (and from to)
4091 (error "The mark is not set now")) 4299 (error "The mark is not set now"))
4092 (list (count-lines from to))) 4300 (let ((message-log-max (ps-message-log-max))) ; to count lines of *Messages*
4301 (list (count-lines from to))))
4093 4302
4094 4303
4095 (defun ps-count-lines (from to) 4304 (defun ps-count-lines (from to)
4096 (+ (count-lines from to) 4305 (+ (count-lines from to)
4097 (save-excursion 4306 (save-excursion
4098 (goto-char to) 4307 (goto-char to)
4099 (if (= (current-column) 0) 1 0)))) 4308 (if (= (current-column) 0) 1 0))))
4100 4309
4101 4310
4102 (defvar ps-printing-region nil 4311 (defvar ps-printing-region nil
4103 "Variable used to indicate if the region that ps-print is printing. 4312 "Variable used to indicate the region that ps-print is printing.
4104 It is a cons, the car of which is the line number where the region begins, and 4313 It is a cons, the car of which is the line number where the region begins, and
4105 its cdr is the total number of lines in the buffer. Formatting functions can 4314 its cdr is the total number of lines in the buffer. Formatting functions can
4106 use this information to print the original line number (and not the number of 4315 use this information to print the original line number (and not the number of
4107 lines printed), and to indicate in the header that the printout is of a partial 4316 lines printed), and to indicate in the header that the printout is of a partial
4108 file.") 4317 file.")
4110 4319
4111 (defvar ps-printing-region-p nil 4320 (defvar ps-printing-region-p nil
4112 "Non-nil means ps-print is printing a region.") 4321 "Non-nil means ps-print is printing a region.")
4113 4322
4114 4323
4115 (defun ps-printing-region (region-p from) 4324 (defun ps-printing-region (region-p from to)
4116 (setq ps-printing-region-p region-p 4325 (setq ps-printing-region-p region-p
4117 ps-printing-region 4326 ps-printing-region
4118 (cons (if region-p 4327 (cons (if region-p
4119 (ps-count-lines (point-min) from) 4328 (ps-count-lines (point-min) (min from to))
4120 1) 4329 1)
4121 (ps-count-lines (point-min) (point-max))))) 4330 (ps-count-lines (point-min) (point-max)))))
4122 4331
4123 4332
4124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4333 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4452 (or (numberp prefix-arg) 4661 (or (numberp prefix-arg)
4453 (listp prefix-arg)) 4662 (listp prefix-arg))
4454 (let* ((name (concat (file-name-nondirectory (or (buffer-file-name) 4663 (let* ((name (concat (file-name-nondirectory (or (buffer-file-name)
4455 (buffer-name))) 4664 (buffer-name)))
4456 ".ps")) 4665 ".ps"))
4457 (prompt (format "Save PostScript to file: (default %s) " name)) 4666 (prompt (format "Save PostScript to file (default %s): " name))
4458 (res (read-file-name prompt default-directory name nil))) 4667 (res (read-file-name prompt default-directory name nil)))
4459 (while (cond ((file-directory-p res) 4668 (while (cond ((file-directory-p res)
4460 (ding) 4669 (ding)
4461 (setq prompt "It's a directory")) 4670 (setq prompt "It's a directory"))
4462 ((not (file-writable-p res)) 4671 ((not (file-writable-p res))
4607 (defun ps-insert-file (fname) 4816 (defun ps-insert-file (fname)
4608 (ps-flush-output) 4817 (ps-flush-output)
4609 (save-excursion 4818 (save-excursion
4610 (set-buffer ps-spool-buffer) 4819 (set-buffer ps-spool-buffer)
4611 (goto-char (point-max)) 4820 (goto-char (point-max))
4612 (insert-file fname))) 4821 (insert-file-contents fname)))
4822
4823 ;; These functions are used in `ps-mule' to get charset of header and footer.
4824 ;; To avoid unnecessary calls to functions in `ps-left-header',
4825 ;; `ps-right-header', `ps-left-footer' and `ps-right-footer'.
4826
4827 (defun ps-generate-string-list (content)
4828 (let (str)
4829 (while content
4830 (setq str (cons (cond
4831 ;; string
4832 ((stringp (car content))
4833 (car content))
4834 ;; function symbol
4835 ((functionp (car content))
4836 (concat "(" (funcall (car content)) ")"))
4837 ;; variable symbol
4838 ((and (symbolp (car content)) (boundp (car content)))
4839 (concat "(" (symbol-value (car content)) ")"))
4840 ;; otherwise, empty string
4841 (t
4842 ""))
4843 str)
4844 content (cdr content)))
4845 (nreverse str)))
4846
4847 (defvar ps-lh-cache nil)
4848 (defvar ps-rh-cache nil)
4849 (defvar ps-lf-cache nil)
4850 (defvar ps-rf-cache nil)
4851
4852 (defun ps-header-footer-string ()
4853 (and ps-print-header
4854 (setq ps-lh-cache (ps-generate-string-list ps-left-header)
4855 ps-rh-cache (ps-generate-string-list ps-right-header)))
4856 (and ps-print-footer
4857 (setq ps-lf-cache (ps-generate-string-list ps-left-footer)
4858 ps-rf-cache (ps-generate-string-list ps-right-footer)))
4859 (append ps-lh-cache ps-rh-cache ps-lf-cache ps-rf-cache))
4613 4860
4614 ;; These functions insert the arrays that define the contents of the headers. 4861 ;; These functions insert the arrays that define the contents of the headers.
4615 4862
4616 (defun ps-generate-header-line (fonttag &optional content) 4863 (defun ps-generate-header-line (fonttag &optional content)
4617 (ps-output " [" fonttag " ") 4864 (ps-output " [" fonttag " ")
4621 ((stringp content) 4868 ((stringp content)
4622 (ps-output (ps-mule-encode-header-string content fonttag))) 4869 (ps-output (ps-mule-encode-header-string content fonttag)))
4623 4870
4624 ;; Functions are called -- they should return strings; they will be inserted 4871 ;; Functions are called -- they should return strings; they will be inserted
4625 ;; as strings and the PS string delimiters added. 4872 ;; as strings and the PS string delimiters added.
4626 ((and (symbolp content) (fboundp content)) 4873 ((functionp content)
4627 (ps-output-string (ps-mule-encode-header-string (funcall content) 4874 (ps-output-string (ps-mule-encode-header-string (funcall content)
4628 fonttag))) 4875 fonttag)))
4629 4876
4630 ;; Variables will have their contents inserted. They should contain 4877 ;; Variables will have their contents inserted. They should contain
4631 ;; strings, and will be inserted as strings. 4878 ;; strings, and will be inserted as strings.
4699 4946
4700 ;; Emacs understands the %f format; we'll use it to limit color RGB values 4947 ;; Emacs understands the %f format; we'll use it to limit color RGB values
4701 ;; to three decimals to cut down some on the size of the PostScript output. 4948 ;; to three decimals to cut down some on the size of the PostScript output.
4702 ;; XEmacs will have to make do with %s (princ) for floats. 4949 ;; XEmacs will have to make do with %s (princ) for floats.
4703 4950
4704 (defvar ps-float-format (if (eq ps-print-emacs-type 'emacs) 4951 (defvar ps-float-format (if (featurep 'xemacs)
4705 "%0.3f " ; emacs 4952 "%s " ; xemacs
4706 "%s ")) ; xemacs 4953 "%0.3f ")) ; emacs
4707 4954
4708 4955
4709 (defun ps-float-format (value &optional default) 4956 (defun ps-float-format (value &optional default)
4710 (let ((literal (or value default))) 4957 (let ((literal (or value default)))
4711 (cond ((null literal) 4958 (cond ((null literal)
4755 "PrintPageWidth 2 div") 5002 "PrintPageWidth 2 div")
4756 (ps-float-format (nth 2 image) ; y position 5003 (ps-float-format (nth 2 image) ; y position
4757 "PrintHeight 2 div BottomMargin add") 5004 "PrintHeight 2 div BottomMargin add")
4758 "\nBeginBackImage\n") 5005 "\nBeginBackImage\n")
4759 (ps-insert-file image-file) 5006 (ps-insert-file image-file)
4760 ;; coordinate adjustment to centralize image 5007 ;; coordinate adjustment to center image
4761 ;; around x and y position 5008 ;; around x and y position
4762 (let ((box (ps-get-boundingbox))) 5009 (let ((box (ps-get-boundingbox)))
4763 (save-excursion 5010 (save-excursion
4764 (set-buffer ps-spool-buffer) 5011 (set-buffer ps-spool-buffer)
4765 (save-excursion 5012 (save-excursion
5276 (and ps-n-up-on (setq tumble (not tumble))) 5523 (and ps-n-up-on (setq tumble (not tumble)))
5277 (ps-output 5524 (ps-output
5278 ps-adobe-tag 5525 ps-adobe-tag
5279 "%%Title: " (buffer-name) ; Take job name from name of 5526 "%%Title: " (buffer-name) ; Take job name from name of
5280 ; first buffer printed 5527 ; first buffer printed
5281 "\n%%Creator: " (user-full-name) 5528 "\n%%Creator: ps-print v" ps-print-version
5282 " (using ps-print v" ps-print-version 5529 "\n%%For: " (user-full-name)
5283 ")\n%%CreationDate: " (format-time-string "%T %b %d %Y") 5530 "\n%%CreationDate: " (format-time-string "%T %b %d %Y")
5284 "\n%%Orientation: " 5531 "\n%%Orientation: "
5285 (if ps-landscape-mode "Landscape" "Portrait") 5532 (if ps-landscape-mode "Landscape" "Portrait")
5286 "\n%%DocumentNeededResources: font Times-Roman Times-Italic\n%%+ font " 5533 "\n%%DocumentNeededResources: font Times-Roman Times-Italic\n%%+ font "
5287 (mapconcat 'identity 5534 (mapconcat 'identity
5288 (ps-remove-duplicates 5535 (ps-remove-duplicates
5289 (append (ps-fonts 'ps-font-for-text) 5536 (append (ps-fonts 'ps-font-for-text)
5290 (list (ps-font 'ps-font-for-header 'normal) 5537 (list (ps-font 'ps-font-for-header 'normal)
5291 (ps-font 'ps-font-for-header 'bold)))) 5538 (ps-font 'ps-font-for-header 'bold)
5539 (ps-font 'ps-font-for-footer 'normal)
5540 (ps-font 'ps-font-for-footer 'bold))))
5292 "\n%%+ font ") 5541 "\n%%+ font ")
5542 "\n%%DocumentSuppliedResources: procset PSPrintUserDefinedPrologue-" (user-login-name) " 0 0"
5293 "\n%%DocumentMedia: " (ps-page-dimensions-get-media dimensions) 5543 "\n%%DocumentMedia: " (ps-page-dimensions-get-media dimensions)
5294 (format " %d" (round (ps-page-dimensions-get-width dimensions))) 5544 (format " %d" (round (ps-page-dimensions-get-width dimensions)))
5295 (format " %d" (round (ps-page-dimensions-get-height dimensions))) 5545 (format " %d" (round (ps-page-dimensions-get-height dimensions)))
5296 " 0 () ()\n%%PageOrder: Ascend\n%%Pages: (atend)\n%%Requirements:" 5546 " 0 () ()\n%%PageOrder: Ascend\n%%Pages: (atend)\n%%Requirements:"
5297 (if ps-spool-duplex 5547 (if ps-spool-duplex
5307 (format "/ErrorMessage %s def\n\n" 5557 (format "/ErrorMessage %s def\n\n"
5308 (or (cdr (assoc ps-error-handler-message 5558 (or (cdr (assoc ps-error-handler-message
5309 ps-error-handler-alist)) 5559 ps-error-handler-alist))
5310 1)) ; send to paper 5560 1)) ; send to paper
5311 ps-print-prologue-0 5561 ps-print-prologue-0
5312 "\n%%BeginProcSet: UserDefinedPrologue\n\n") 5562 "\n%%BeginResource: procset PSPrintUserDefinedPrologue-" (user-login-name) " 0 0\n\n")
5313 5563
5314 (ps-insert-string ps-user-defined-prologue) 5564 (ps-insert-string ps-user-defined-prologue)
5315 5565
5316 (ps-output "\n%%EndProcSet\n\n") 5566 (ps-output "\n%%EndResource\n\n")
5317 5567
5318 (ps-output-boolean "LandscapeMode " 5568 (ps-output-boolean "LandscapeMode "
5319 (or ps-landscape-mode 5569 (or ps-landscape-mode
5320 (eq (ps-n-up-landscape n-up) 'pag))) 5570 (eq (ps-n-up-landscape n-up) 'pag)))
5321 (ps-output-boolean "UpsideDown " ps-print-upside-down) 5571 (ps-output-boolean "UpsideDown " ps-print-upside-down)
5383 (format "def\n/ZebraHeight %d def\n" 5633 (format "def\n/ZebraHeight %d def\n"
5384 ps-zebra-stripe-height) 5634 ps-zebra-stripe-height)
5385 "/ZebraColor " 5635 "/ZebraColor "
5386 (ps-format-color ps-zebra-color 0.95) 5636 (ps-format-color ps-zebra-color 0.95)
5387 "def\n/BackgroundColor " 5637 "def\n/BackgroundColor "
5388 (ps-format-color 5638 (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 " 5639 "def\n/UseSetpagedevice "
5394 (if (eq ps-spool-config 'setpagedevice) 5640 (if (eq ps-spool-config 'setpagedevice)
5395 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse" 5641 "/setpagedevice where{pop languagelevel 2 eq}{false}ifelse"
5396 "false") 5642 "false")
5397 " def\n\n/PageWidth " 5643 " def\n\n/PageWidth "
5421 (ps-background-text) 5667 (ps-background-text)
5422 (ps-background-image) 5668 (ps-background-image)
5423 (setq ps-background-all-pages (nreverse ps-background-all-pages) 5669 (setq ps-background-all-pages (nreverse ps-background-all-pages)
5424 ps-background-pages (nreverse ps-background-pages)) 5670 ps-background-pages (nreverse ps-background-pages))
5425 5671
5426 (ps-output "\n" ps-print-prologue-1) 5672 (ps-output "\n" ps-print-prologue-1
5427 5673 "\n/printGlobalBackground{\n")
5428 (ps-output "\n/printGlobalBackground{\n")
5429 (mapcar 'ps-output ps-background-all-pages) 5674 (mapcar 'ps-output ps-background-all-pages)
5430 (ps-output "}def\n/printLocalBackground{\n}def\n") 5675 (ps-output
5431 5676 "}def\n/printLocalBackground{\n}def\n"
5432 ;; Header/line number fonts 5677 "\n%%EndProlog\n\n%%BeginSetup\n"
5433 (ps-output (format "/h0 %s(%s)cvn DefFont\n" ; /h0 14/Helvetica-Bold DefFont 5678 "\n%%IncludeResource: font Times-Roman"
5434 ps-header-title-font-size-internal 5679 "\n%%IncludeResource: font Times-Italic"
5435 (ps-font 'ps-font-for-header 'bold)) 5680 "\n%%IncludeResource: font "
5436 (format "/h1 %s(%s)cvn DefFont\n" ; /h1 12/Helvetica DefFont 5681 (mapconcat 'identity
5437 ps-header-font-size-internal 5682 (ps-remove-duplicates
5438 (ps-font 'ps-font-for-header 'normal)) 5683 (append (ps-fonts 'ps-font-for-text)
5439 (format "/L0 %s(%s)cvn DefFont\n" ; /L0 6/Times-Italic DefFont 5684 (list (ps-font 'ps-font-for-header 'normal)
5440 (ps-get-font-size 'ps-line-number-font-size) 5685 (ps-font 'ps-font-for-header 'bold)
5441 ps-line-number-font) 5686 (ps-font 'ps-font-for-footer 'normal)
5442 (format "/H0 %s(%s)cvn DefFont\n" ; /H0 12/Helvetica DefFont 5687 (ps-font 'ps-font-for-footer 'bold))))
5443 ps-footer-font-size-internal 5688 "\n%%IncludeResource: font ")
5444 (ps-font 'ps-font-for-footer 'normal)) 5689 ;; Header/line number fonts
5445 "\n\n% ---- These lines must be kept together because... 5690 (format "\n/h0 %s(%s)cvn DefFont\n" ; /h0 14/Helvetica-Bold DefFont
5691 ps-header-title-font-size-internal
5692 (ps-font 'ps-font-for-header 'bold))
5693 (format "/h1 %s(%s)cvn DefFont\n" ; /h1 12/Helvetica DefFont
5694 ps-header-font-size-internal
5695 (ps-font 'ps-font-for-header 'normal))
5696 (format "/L0 %s(%s)cvn DefFont\n" ; /L0 6/Times-Italic DefFont
5697 (ps-get-font-size 'ps-line-number-font-size)
5698 ps-line-number-font)
5699 (format "/H0 %s(%s)cvn DefFont\n" ; /H0 12/Helvetica DefFont
5700 ps-footer-font-size-internal
5701 (ps-font 'ps-font-for-footer 'normal))
5702 "\n\n% ---- These lines must be kept together because...
5446 5703
5447 /h0 F 5704 /h0 F
5448 /HeaderTitleLineHeight FontHeight def 5705 /HeaderTitleLineHeight FontHeight def
5449 5706
5450 /h1 F 5707 /h1 F
5470 5727
5471 (let ((font-entry (cdr (assq ps-font-family ps-font-info-database)))) 5728 (let ((font-entry (cdr (assq ps-font-family ps-font-info-database))))
5472 (ps-output (format "/SpaceWidthRatio %f def\n" 5729 (ps-output (format "/SpaceWidthRatio %f def\n"
5473 (/ (ps-lookup 'space-width) (ps-lookup 'size))))) 5730 (/ (ps-lookup 'space-width) (ps-lookup 'size)))))
5474 5731
5475 (ps-output "\n%%EndProlog\n\n%%BeginSetup\n")
5476 (unless (eq ps-spool-config 'lpr-switches) 5732 (unless (eq ps-spool-config 'lpr-switches)
5477 (ps-output "\n%%BeginFeature: *Duplex " 5733 (ps-output "\n%%BeginFeature: *Duplex "
5478 (ps-boolean-capitalized ps-spool-duplex) 5734 (ps-boolean-capitalized ps-spool-duplex)
5479 " *Tumble " 5735 " *Tumble "
5480 (ps-boolean-capitalized tumble) 5736 (ps-boolean-capitalized tumble)
5571 5827
5572 (defun ps-get-font-size (font-sym) 5828 (defun ps-get-font-size (font-sym)
5573 (ps-get-size (symbol-value font-sym) "font size" font-sym)) 5829 (ps-get-size (symbol-value font-sym) "font size" font-sym))
5574 5830
5575 5831
5576 (defsubst ps-rgb-color (color default) 5832 (defun ps-rgb-color (color default)
5577 (cond ((and color (listp color)) color) 5833 (cond ((and color (listp color) (= (length color) 3)
5834 (let ((cl color)
5835 (ok t) e)
5836 (while (and ok cl)
5837 (setq e (car cl)
5838 cl (cdr cl)
5839 ok (and (floatp e) (<= 0.0 e) (<= e 1.0))))
5840 ok))
5841 color)
5842 ((and (floatp color) (<= 0.0 color) (<= color 1.0))
5843 (list color color color))
5578 ((stringp color) (ps-color-scale color)) 5844 ((stringp color) (ps-color-scale color))
5579 ((numberp color) (list color color color))
5580 (t (list default default default)) 5845 (t (list default default default))
5581 )) 5846 ))
5582 5847
5583 5848
5584 (defun ps-begin-job () 5849 (defun ps-begin-job ()
5648 ((eq ps-print-control-characters 'control-8-bit) 5913 ((eq ps-print-control-characters 'control-8-bit)
5649 (string-as-unibyte "[\000-\037\177-\237]")) 5914 (string-as-unibyte "[\000-\037\177-\237]"))
5650 ((eq ps-print-control-characters 'control) 5915 ((eq ps-print-control-characters 'control)
5651 "[\000-\037\177]") 5916 "[\000-\037\177]")
5652 (t "[\t\n\f]")) 5917 (t "[\t\n\f]"))
5918 ps-default-background (ps-rgb-color
5919 (if (eq ps-default-bg t)
5920 (ps-face-background-name 'default)
5921 ps-default-bg)
5922 1.0)
5653 ps-default-foreground (ps-rgb-color 5923 ps-default-foreground (ps-rgb-color
5654 (if (eq ps-default-fg t) 5924 (if (eq ps-default-fg t)
5655 (ps-face-foreground-name 'default) 5925 (ps-face-foreground-name 'default)
5656 ps-default-fg) 5926 ps-default-fg)
5657 0.0) 5927 0.0)
5663 ps-color-p (and ps-print-color-p (ps-color-device)) 5933 ps-color-p (and ps-print-color-p (ps-color-device))
5664 ps-print-color-scale (if ps-color-p 5934 ps-print-color-scale (if ps-color-p
5665 (float (car (ps-color-values "white"))) 5935 (float (car (ps-color-values "white")))
5666 1.0)) 5936 1.0))
5667 ;; initialize page dimensions 5937 ;; initialize page dimensions
5668 (ps-get-page-dimensions)) 5938 (ps-get-page-dimensions)
5939 ;; final check
5940 (and ps-color-p
5941 (equal ps-default-background ps-default-foreground)
5942 (error
5943 (concat
5944 "`ps-default-fg' and `ps-default-bg' have the same color.\n"
5945 "Text won't appear on page. Please, check these variables."))))
5669 5946
5670 5947
5671 (defun ps-page-number () 5948 (defun ps-page-number ()
5672 (if ps-print-only-one-header 5949 (if ps-print-only-one-header
5673 (1+ (/ (1- ps-page-column) ps-number-of-columns)) 5950 (1+ (/ (1- ps-page-column) ps-number-of-columns))
5682 (ps-end-page) 5959 (ps-end-page)
5683 (ps-flush-output) 5960 (ps-flush-output)
5684 (ps-begin-page)) 5961 (ps-begin-page))
5685 5962
5686 5963
5964 (defun ps-end-sheet ()
5965 (and ps-print-page-p (> ps-page-sheet 0)
5966 (ps-output "EndSheet\n")))
5967
5968
5687 (defun ps-header-sheet () 5969 (defun ps-header-sheet ()
5688 ;; Print only when a new sheet begins. 5970 ;; Print only when a new sheet begins.
5689 (and ps-print-page-p (> ps-page-sheet 0) 5971 (ps-end-sheet)
5690 (ps-output "EndSheet\n"))
5691 (setq ps-page-sheet (1+ ps-page-sheet)) 5972 (setq ps-page-sheet (1+ ps-page-sheet))
5692 (when (ps-print-sheet-p) 5973 (when (ps-print-sheet-p)
5693 (setq ps-page-order (1+ ps-page-order)) 5974 (setq ps-page-order (1+ ps-page-order))
5694 (ps-output (if ps-n-up-on 5975 (ps-output (if ps-n-up-on
5695 (format "\n%%%%Page: (%d \\(%d\\)) %d\n" 5976 (format "\n%%%%Page: (%d \\(%d\\)) %d\n"
5735 6016
5736 (ps-output (format "/LineNumber %d def\n" ps-showline-count) 6017 (ps-output (format "/LineNumber %d def\n" ps-showline-count)
5737 (format "/PageNumber %d def\n" (ps-page-number))) 6018 (format "/PageNumber %d def\n" (ps-page-number)))
5738 6019
5739 (when ps-print-header 6020 (when ps-print-header
5740 (ps-generate-header "HeaderLinesLeft" "/h0" "/h1" ps-left-header) 6021 (ps-generate-header "HeaderLinesLeft" "/h0" "/h1"
5741 (ps-generate-header "HeaderLinesRight" "/h0" "/h1" ps-right-header) 6022 (or ps-lh-cache ps-left-header))
5742 (ps-output (format "%d SetHeaderLines\n" ps-header-lines))) 6023 (ps-generate-header "HeaderLinesRight" "/h0" "/h1"
6024 (or ps-rh-cache ps-right-header))
6025 (ps-output (format "%d SetHeaderLines\n" ps-header-lines))
6026 (setq ps-lh-cache nil
6027 ps-rh-cache nil))
5743 6028
5744 (when ps-print-footer 6029 (when ps-print-footer
5745 (ps-generate-header "FooterLinesLeft" "/H0" "/H0" ps-left-footer) 6030 (ps-generate-header "FooterLinesLeft" "/H0" "/H0"
5746 (ps-generate-header "FooterLinesRight" "/H0" "/H0" ps-right-footer) 6031 (or ps-lf-cache ps-left-footer))
5747 (ps-output (format "%d SetFooterLines\n" ps-footer-lines))) 6032 (ps-generate-header "FooterLinesRight" "/H0" "/H0"
6033 (or ps-rf-cache ps-right-footer))
6034 (ps-output (format "%d SetFooterLines\n" ps-footer-lines))
6035 (setq ps-lf-cache nil
6036 ps-rf-cache nil))
5748 6037
5749 (ps-output (number-to-string ps-lines-printed) " BeginPage\n") 6038 (ps-output (number-to-string ps-lines-printed) " BeginPage\n")
5750 (ps-set-font ps-current-font) 6039 (ps-set-font ps-current-font)
5751 (ps-set-bg ps-current-bg) 6040 (ps-set-bg ps-current-bg)
5752 (ps-set-color ps-current-color) 6041 (ps-set-color ps-current-color)
5864 (ps-plot 'ps-basic-plot-str 0 (length string) string)) 6153 (ps-plot 'ps-basic-plot-str 0 (length string) string))
5865 6154
5866 6155
5867 (defvar ps-current-effect 0) 6156 (defvar ps-current-effect 0)
5868 6157
6158 (defvar ps-print-translation-table
6159 (let ((tbl (make-char-table 'translation-table nil)))
6160 (if (and (boundp 'ucs-mule-8859-to-mule-unicode)
6161 (char-table-p ucs-mule-8859-to-mule-unicode))
6162 (map-char-table
6163 #'(lambda (k v)
6164 (if (and v (eq (char-charset v) 'latin-iso8859-1) (/= k v))
6165 (aset tbl k v)))
6166 ucs-mule-8859-to-mule-unicode))
6167 tbl)
6168 "Translation table for PostScript printing.
6169 The default value is a table that translates non-Latin-1 Latin characters
6170 to the equivalent Latin-1 characters.")
5869 6171
5870 (defun ps-plot-region (from to font &optional fg-color bg-color effects) 6172 (defun ps-plot-region (from to font &optional fg-color bg-color effects)
5871 (or (equal font ps-current-font) 6173 (or (equal font ps-current-font)
5872 (ps-set-font font)) 6174 (ps-set-font font))
5873 6175
5954 6256
5955 (composition ; a composite sequence 6257 (composition ; a composite sequence
5956 (ps-plot 'ps-mule-plot-composition match-point (point) bg-color)) 6258 (ps-plot 'ps-mule-plot-composition match-point (point) bg-color))
5957 6259
5958 ((> match 255) ; a multi-byte character 6260 ((> match 255) ; a multi-byte character
6261 (setq match (or (aref ps-print-translation-table match) match))
5959 (let* ((charset (char-charset match)) 6262 (let* ((charset (char-charset match))
5960 (composition (ps-e-find-composition match-point to)) 6263 (composition (ps-e-find-composition match-point to))
5961 (stop (if (nth 2 composition) (car composition) to))) 6264 (stop (if (nth 2 composition) (car composition) to)))
5962 (or (eq charset 'composition) 6265 (or (eq charset 'composition)
5963 (while (and (< (point) stop) (eq (charset-after) charset)) 6266 (while (and (< (point) stop)
6267 (let ((ch (following-char)))
6268 (setq ch
6269 (or (aref ps-print-translation-table ch)
6270 ch))
6271 (eq (char-charset ch) charset)))
5964 (forward-char 1))) 6272 (forward-char 1)))
5965 (ps-plot 'ps-mule-plot-string match-point (point) bg-color))) 6273 (ps-plot 'ps-mule-plot-string match-point (point) bg-color)))
5966 ; characters from ^@ to ^_ and 6274 ; characters from ^@ to ^_ and
5967 (t ; characters from 127 to 255 6275 (t ; characters from 127 to 255
5968 (ps-control-character match))) 6276 (ps-control-character match)))
6166 (ps-face-foreground-name face) 6474 (ps-face-foreground-name face)
6167 (ps-face-background-name face)))) 6475 (ps-face-background-name face))))
6168 6476
6169 6477
6170 ;; to avoid compilation gripes 6478 ;; to avoid compilation gripes
6479 (defalias 'ps-jitify 'jit-lock-fontify-now)
6480 (defalias 'ps-lazify 'lazy-lock-fontify-region)
6481
6482
6483 ;; to avoid compilation gripes
6171 (defun ps-print-ensure-fontified (start end) 6484 (defun ps-print-ensure-fontified (start end)
6172 (cond 6485 (cond ((and (boundp 'jit-lock-mode) (symbol-value 'jit-lock-mode))
6173 ((and (boundp 'jit-lock-mode) (symbol-value 'jit-lock-mode)) 6486 (ps-jitify start end))
6174 (defalias 'ps-jitify 'jit-lock-fontify-now) ; avoid compilation gripes 6487 ((and (boundp 'lazy-lock-mode) (symbol-value 'lazy-lock-mode))
6175 (ps-jitify start end)) 6488 (ps-lazify start end))))
6176 ((and (boundp 'lazy-lock-mode) (symbol-value 'lazy-lock-mode))
6177 (defalias 'ps-lazify 'lazy-lock-fontify-region) ; avoid compilation gripes
6178 (ps-lazify start end))))
6179 6489
6180 6490
6181 (defun ps-generate-postscript-with-faces (from to) 6491 (defun ps-generate-postscript-with-faces (from to)
6182 ;; Some initialization... 6492 ;; Some initialization...
6183 (setq ps-current-effect 0) 6493 (setq ps-current-effect 0)
6199 (narrow-to-region from to) 6509 (narrow-to-region from to)
6200 (ps-print-ensure-fontified from to) 6510 (ps-print-ensure-fontified from to)
6201 (let ((face 'default) 6511 (let ((face 'default)
6202 (position to)) 6512 (position to))
6203 (cond 6513 (cond
6204 ((eq ps-print-emacs-type 'xemacs) 6514 ((featurep 'xemacs) ; xemacs
6205 ;; Build the list of extents... 6515 ;; Build the list of extents...
6206 (let ((a (cons 'dummy nil)) 6516 (let ((a (cons 'dummy nil))
6207 record type extent extent-list) 6517 record type extent extent-list)
6208 (ps-x-map-extents 'ps-mapper nil from to a) 6518 (ps-x-map-extents 'ps-mapper nil from to a)
6209 (setq a (sort (cdr a) 'car-less-than-car) 6519 (setq a (sort (cdr a) 'car-less-than-car)
6243 (ps-x-extent-face (car extent-list)) 6553 (ps-x-extent-face (car extent-list))
6244 'default) 6554 'default)
6245 from position 6555 from position
6246 a (cdr a))))) 6556 a (cdr a)))))
6247 6557
6248 ((eq ps-print-emacs-type 'emacs) 6558 (t ; emacs
6249 (let ((property-change from) 6559 (let ((property-change from)
6250 (overlay-change from) 6560 (overlay-change from)
6251 (save-buffer-invisibility-spec buffer-invisibility-spec) 6561 (save-buffer-invisibility-spec buffer-invisibility-spec)
6252 (buffer-invisibility-spec nil) 6562 (buffer-invisibility-spec nil)
6253 before-string after-string) 6563 before-string after-string)
6381 6691
6382 (and ps-razzle-dazzle (message "Formatting...done")))))) 6692 (and ps-razzle-dazzle (message "Formatting...done"))))))
6383 6693
6384 6694
6385 (defun ps-end-job (needs-begin-file) 6695 (defun ps-end-job (needs-begin-file)
6386 (let ((previous-print ps-print-page-p) 6696 (let ((ps-print-page-p t))
6387 (ps-print-page-p t))
6388 (ps-flush-output) 6697 (ps-flush-output)
6389 (save-excursion 6698 (save-excursion
6390 (let ((pages-per-sheet (mod ps-page-printed ps-n-up-printing)) 6699 (let ((pages-per-sheet (mod ps-page-printed ps-n-up-printing))
6391 (total-lines (cdr ps-printing-region)) 6700 (total-lines (cdr ps-printing-region))
6392 (total-pages (ps-page-number))) 6701 (total-pages (ps-page-number)))
6409 (ps-output "/PrintHeader false def\n/ColumnIndex 0 def\n" 6718 (ps-output "/PrintHeader false def\n/ColumnIndex 0 def\n"
6410 "/PrintLineNumber false def\n" 6719 "/PrintLineNumber false def\n"
6411 (number-to-string ps-lines-printed) " BeginPage\n") 6720 (number-to-string ps-lines-printed) " BeginPage\n")
6412 (ps-end-page))) 6721 (ps-end-page)))
6413 ;; Set end of PostScript file 6722 ;; Set end of PostScript file
6414 (and previous-print 6723 (ps-end-sheet)
6415 (ps-output "EndSheet\n"))
6416 (ps-output "\n%%Trailer\n%%Pages: " 6724 (ps-output "\n%%Trailer\n%%Pages: "
6417 (number-to-string 6725 (number-to-string
6418 (if (and needs-begin-file 6726 (if (and needs-begin-file
6419 ps-banner-page-when-duplexing) 6727 ps-banner-page-when-duplexing)
6420 (1+ ps-page-order) 6728 (1+ ps-page-order)
6490 (t (list list)))) 6798 (t (list list))))
6491 6799
6492 (defun ps-kill-emacs-check () 6800 (defun ps-kill-emacs-check ()
6493 (let (ps-buffer) 6801 (let (ps-buffer)
6494 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) 6802 (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
6803 (buffer-name ps-buffer) ; check if it's not killed
6495 (buffer-modified-p ps-buffer) 6804 (buffer-modified-p ps-buffer)
6496 (y-or-n-p "Unprinted PostScript waiting; print now? ") 6805 (y-or-n-p "Unprinted PostScript waiting; print now? ")
6497 (ps-despool)) 6806 (ps-despool))
6498 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) 6807 (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
6808 (buffer-name ps-buffer) ; check if it's not killed
6499 (buffer-modified-p ps-buffer) 6809 (buffer-modified-p ps-buffer)
6500 (not (yes-or-no-p "Unprinted PostScript waiting; exit anyway? ")) 6810 (not (yes-or-no-p "Unprinted PostScript waiting; exit anyway? "))
6501 (error "Unprinted PostScript")))) 6811 (error "Unprinted PostScript"))))
6502 6812
6503 (cond ((fboundp 'add-hook) 6813 (cond ((fboundp 'add-hook)
6518 6828
6519 ;; WARNING!!! The following code is *sample* code only. 6829 ;; WARNING!!! The following code is *sample* code only.
6520 ;; Don't use it unless you understand what it does! 6830 ;; Don't use it unless you understand what it does!
6521 6831
6522 (defmacro ps-prsc () 6832 (defmacro ps-prsc ()
6523 `(if (eq ps-print-emacs-type 'emacs) [f22] 'f22)) 6833 `(if (featurep 'xemacs) 'f22 [f22]))
6524 (defmacro ps-c-prsc () 6834 (defmacro ps-c-prsc ()
6525 `(if (eq ps-print-emacs-type 'emacs) [C-f22] '(control f22))) 6835 `(if (featurep 'xemacs) '(control f22) [C-f22]))
6526 (defmacro ps-s-prsc () 6836 (defmacro ps-s-prsc ()
6527 `(if (eq ps-print-emacs-type 'emacs) [S-f22] '(shift f22))) 6837 `(if (featurep 'xemacs) '(shift f22) [S-f22]))
6528 6838
6529 ;; A hook to bind to `rmail-mode-hook' to locally bind prsc and set the 6839 ;; A hook to bind to `rmail-mode-hook' to locally bind prsc and set the
6530 ;; `ps-left-headers' specially for mail messages. 6840 ;; `ps-left-headers' specially for mail messages.
6531 (defun ps-rmail-mode-hook () 6841 (defun ps-rmail-mode-hook ()
6532 (local-set-key (ps-prsc) 'ps-rmail-print-message-from-summary) 6842 (local-set-key (ps-prsc) 'ps-rmail-print-message-from-summary)
6754 7064
6755 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7065 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6756 7066
6757 (provide 'ps-print) 7067 (provide 'ps-print)
6758 7068
7069 ;;; arch-tag: fb06a585-1112-4206-885d-a57d95d50579
6759 ;;; ps-print.el ends here 7070 ;;; ps-print.el ends here