comparison lisp/ps-print.el @ 29494:112a7f01b499

XEmacs compatibility. Doc fix. Can select page size with/without giving an error if PostScript printer doesn't have this kind of page size. Zebra Stripe continues or restarts on next page. Manual/automatic paper feeding. Switch or not the header. (ps-print-version): New version number (5.2.2). (ps-windows-system): Include emx as a Windows system. (ps-setup, ps-begin-file, ps-color-values, ps-screen-to-bit-face) (ps-generate-postscript-with-faces, ps-generate-postscript-with-faces) (ps-background-text): Code fix. (ps-error-handler-message, ps-user-defined-prologue) (ps-print-prologue-header, ps-printer-name) (ps-print-control-characters, ps-n-up-filling, ps-zebra-color) (ps-line-number-step, ps-spool-config, ps-default-fg, ps-default-bg) (ps-use-face-background): Customization fix. (ps-n-up-database): Data fix. (ps-warn-paper-type, ps-zebra-stripe-follow, ps-manual-feed) (ps-switch-header): New vars. (ps-xemacs-color-name, ps-face-foreground-name) (ps-face-background-name, ps-boolean-constant): New funs.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 07 Jun 2000 15:34:55 +0000
parents b6e33b095c08
children 80ae67b2a291
comparison
equal deleted inserted replaced
29493:0345c6ffb8b4 29494:112a7f01b499
7 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> 7 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br>
8 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) 8 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
9 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) 9 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
10 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> 10 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
11 ;; Keywords: wp, print, PostScript 11 ;; Keywords: wp, print, PostScript
12 ;; Time-stamp: <2000/05/12 19:56:11 vinicius> 12 ;; Time-stamp: <2000/06/05 14:40:03 vinicius>
13 ;; Version: 5.2.1 13 ;; Version: 5.2.2
14 14
15 (defconst ps-print-version "5.2.1" 15 (defconst ps-print-version "5.2.2"
16 "ps-print.el, v 5.2.1 <2000/05/12 vinicius> 16 "ps-print.el, v 5.2.2 <2000/06/05 vinicius>
17 17
18 Vinicius's last change version -- this file may have been edited as part of 18 Vinicius's last change version -- this file may have been edited as part of
19 Emacs without changes to the version number. When reporting bugs, please also 19 Emacs without changes to the version number. When reporting bugs, please also
20 report the version of Emacs, if any, that ps-print was distributed with. 20 report the version of Emacs, if any, that ps-print was distributed with.
21 21
193 ;; The variable `ps-print-region-function' specifies a function to print the 193 ;; The variable `ps-print-region-function' specifies a function to print the
194 ;; region on a PostScript printer. 194 ;; region on a PostScript printer.
195 ;; See definition of `call-process-region' for calling conventions. The fourth 195 ;; See definition of `call-process-region' for calling conventions. The fourth
196 ;; and the sixth arguments are both nil. 196 ;; and the sixth arguments are both nil.
197 ;; 197 ;;
198 ;; The variable `ps-manual-feed' indicates if the printer will manually feed
199 ;; paper. If it's nil, automatic feeding takes place. If it's non-nil, manual
200 ;; feeding takes place. The default is nil (automatic feeding).
201 ;;
198 ;; If you're using Emacs for Windows 95/98/NT or MS-DOS, don't forget to 202 ;; If you're using Emacs for Windows 95/98/NT or MS-DOS, don't forget to
199 ;; customize the following variables: `ps-printer-name', `ps-lpr-command', 203 ;; customize the following variables: `ps-printer-name', `ps-lpr-command',
200 ;; `ps-lpr-switches' and `ps-spool-config'. See these variables documentation 204 ;; `ps-lpr-switches' and `ps-spool-config'. See these variables documentation
201 ;; in the code or by typing, for example, C-h v ps-printer-name RET. 205 ;; in the code or by typing, for example, C-h v ps-printer-name RET.
202 ;; 206 ;;
210 ;; 214 ;;
211 ;; The variable `ps-paper-type' determines the size of paper ps-print formats 215 ;; The variable `ps-paper-type' determines the size of paper ps-print formats
212 ;; for; it should contain one of the symbols: `a4' `a3' `letter' `legal' 216 ;; for; it should contain one of the symbols: `a4' `a3' `letter' `legal'
213 ;; `letter-small' `tabloid' `ledger' `statement' `executive' `a4small' `b4' 217 ;; `letter-small' `tabloid' `ledger' `statement' `executive' `a4small' `b4'
214 ;; `b5'. 218 ;; `b5'.
219 ;;
220 ;; If variable `ps-warn-paper-type' is nil, it's *not* given an error if
221 ;; PostScript printer doesn't have a paper with the size indicated by
222 ;; `ps-paper-type', instead it uses the default paper size. If variable
223 ;; `ps-warn-paper-type' is non-nil, it's given an error if PostScript printer
224 ;; doesn't have a paper with the size indicated by `ps-paper-type'. It's used
225 ;; when `ps-spool-config' is set to `setpagedevice' (see section Duplex
226 ;; Printers). The default value is non-nil (it gives an error).
215 ;; 227 ;;
216 ;; The variable `ps-landscape-mode' determines the orientation of the printing 228 ;; The variable `ps-landscape-mode' determines the orientation of the printing
217 ;; on the page: nil means `portrait' mode, non-nil means `landscape' mode. 229 ;; on the page: nil means `portrait' mode, non-nil means `landscape' mode.
218 ;; There is no oblique mode yet, though this is easy to do in ps. 230 ;; There is no oblique mode yet, though this is easy to do in ps.
219 ;; 231 ;;
304 ;; set `ps-print-header-frame' to nil. 316 ;; set `ps-print-header-frame' to nil.
305 ;; 317 ;;
306 ;; To print only one header at the top of each page, 318 ;; To print only one header at the top of each page,
307 ;; set `ps-print-only-one-header' to t. 319 ;; set `ps-print-only-one-header' to t.
308 ;; 320 ;;
321 ;; To switch headers, set `ps-switch-header' to:
322 ;;
323 ;; nil Never switch headers.
324 ;;
325 ;; t Always switch headers.
326 ;;
327 ;; duplex Switch headers only when duplexing is on, that is, when
328 ;; `ps-spool-duplex' is non-nil (see Duplex Printers).
329 ;;
330 ;; Any other value is treated as t. The default value is `duplex'.
331 ;;
309 ;; The font family and size of text in the header are determined 332 ;; The font family and size of text in the header are determined
310 ;; by the variables `ps-header-font-family', `ps-header-font-size' and 333 ;; by the variables `ps-header-font-family', `ps-header-font-size' and
311 ;; `ps-header-title-font-size' (see below). 334 ;; `ps-header-title-font-size' (see below).
312 ;; 335 ;;
313 ;; The variable `ps-header-line-pad' determines the portion of a header 336 ;; The variable `ps-header-line-pad' determines the portion of a header
314 ;; title line height to insert between the header frame and the text 337 ;; title line height to insert between the header frame and the text
315 ;; it contains, both in the vertical and horizontal directions: 338 ;; it contains, both in the vertical and horizontal directions:
316 ;; .5 means half a line. 339 ;; .5 means half a line.
317 340 ;;
318 ;; Page numbers are printed in `n/m' format, indicating page n of m pages; 341 ;; Page numbers are printed in `n/m' format, indicating page n of m pages;
319 ;; to omit the total page count and just print the page number, 342 ;; to omit the total page count and just print the page number,
320 ;; set `ps-show-n-of-n' to nil. 343 ;; set `ps-show-n-of-n' to nil.
321 ;; 344 ;;
322 ;; The amount of information in the header can be changed by changing 345 ;; The amount of information in the header can be changed by changing
677 ;; The variable `ps-zebra-color' controls the zebra stripes gray scale or RGB 700 ;; The variable `ps-zebra-color' controls the zebra stripes gray scale or RGB
678 ;; color. It should be a float number between 0.0 (black color) and 1.0 (white 701 ;; color. It should be a float number between 0.0 (black color) and 1.0 (white
679 ;; color), a string which is a color name, or a list of 3 numbers which 702 ;; color), a string which is a color name, or a list of 3 numbers which
680 ;; corresponds to the Red Green Blue color scale. 703 ;; corresponds to the Red Green Blue color scale.
681 ;; The default is 0.95 (or "gray95", or '(0.95 0.95 0.95)). 704 ;; The default is 0.95 (or "gray95", or '(0.95 0.95 0.95)).
705 ;;
706 ;; The variable `ps-zebra-stripe-follow' specifies if zebra stripe should
707 ;; continue on next page or restart on each page. If `ps-zebra-stripe-follow'
708 ;; is nil, zebra stripe is restarted on each page. If `ps-zebra-stripe-follow'
709 ;; is non-nil, zebra stripe continues on next page. Visually, we have:
710 ;;
711 ;; `ps-zebra-stripe-follow' `ps-zebra-stripe-follow'
712 ;; is nil is non-nil
713 ;; Current Page ------------------------ ------------------------
714 ;; 1 XXXXXXXXXXXXXXXXXXXXX 1 XXXXXXXXXXXXXXXXXXXXX
715 ;; 2 XXXXXXXXXXXXXXXXXXXXX 2 XXXXXXXXXXXXXXXXXXXXX
716 ;; 3 XXXXXXXXXXXXXXXXXXXXX 3 XXXXXXXXXXXXXXXXXXXXX
717 ;; 4 4
718 ;; 5 5
719 ;; 6 6
720 ;; 7 XXXXXXXXXXXXXXXXXXXXX 7 XXXXXXXXXXXXXXXXXXXXX
721 ;; 8 XXXXXXXXXXXXXXXXXXXXX 8 XXXXXXXXXXXXXXXXXXXXX
722 ;; ------------------------ ------------------------
723 ;; Next Page ------------------------ ------------------------
724 ;; 9 XXXXXXXXXXXXXXXXXXXXX 9 XXXXXXXXXXXXXXXXXXXXX
725 ;; 10 XXXXXXXXXXXXXXXXXXXXX 10
726 ;; 11 XXXXXXXXXXXXXXXXXXXXX 11
727 ;; 12 12
728 ;; 13 13 XXXXXXXXXXXXXXXXXXXXX
729 ;; 14 14 XXXXXXXXXXXXXXXXXXXXX
730 ;; 15 XXXXXXXXXXXXXXXXXXXXX 15 XXXXXXXXXXXXXXXXXXXXX
731 ;; 16 XXXXXXXXXXXXXXXXXXXXX 16
732 ;; ------------------------ ------------------------
682 ;; 733 ;;
683 ;; See also section How Ps-Print Has A Text And/Or Image On Background. 734 ;; See also section How Ps-Print Has A Text And/Or Image On Background.
684 ;; 735 ;;
685 ;; 736 ;;
686 ;; Hooks 737 ;; Hooks
1132 ;; suggestion for `ps-postscript-code-directory' variable. 1183 ;; suggestion for `ps-postscript-code-directory' variable.
1133 ;; 1184 ;;
1134 ;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript 1185 ;; Thanks to David X Callaway <dxc@xprt.net> for helping debugging PostScript
1135 ;; level 1 compatibility. 1186 ;; level 1 compatibility.
1136 ;; 1187 ;;
1137 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for upside-down 1188 ;; Thanks to Colin Marquardt <colin.marquardt@usa.alcatel.com> for upside-down,
1138 ;; and line number step suggestions. 1189 ;; line number step, line number start and zebra stripe follow suggestions, and
1190 ;; for XEmacs beta-tests.
1139 ;; 1191 ;;
1140 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript 1192 ;; Thanks to Klaus Berndl <klaus.berndl@sdm.de> for user defined PostScript
1141 ;; prologue code suggestion. 1193 ;; prologue code suggestion.
1142 ;; 1194 ;;
1143 ;; Thanks to Kein'ichi Handa <handa@etl.go.jp> for multi-byte buffer handling. 1195 ;; Thanks to Kein'ichi Handa <handa@etl.go.jp> for multi-byte buffer handling.
1228 (beginning-of-line) 1280 (beginning-of-line)
1229 (point)))) 1281 (point))))
1230 1282
1231 1283
1232 (defconst ps-windows-system 1284 (defconst ps-windows-system
1233 (memq system-type '(win32 w32 mswindows ms-dos windows-nt))) 1285 (memq system-type '(emx win32 w32 mswindows ms-dos windows-nt)))
1234 (defconst ps-lp-system 1286 (defconst ps-lp-system
1235 (memq system-type '(usq-unix-v dgux hpux irix))) 1287 (memq system-type '(usq-unix-v dgux hpux irix)))
1236 1288
1237 1289
1238 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1290 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1343 1395
1344 `paper-and-system' catch the error, print on paper the error message and 1396 `paper-and-system' catch the error, print on paper the error message and
1345 send back the error message to printing system. 1397 send back the error message to printing system.
1346 1398
1347 Any other value is treated as `paper'." 1399 Any other value is treated as `paper'."
1348 :type '(choice :tag "Error Handler Message" 1400 :type '(choice :menu-tag "Error Handler Message"
1401 :tag "Error Handler Message"
1349 (const none) (const paper) 1402 (const none) (const paper)
1350 (const system) (const paper-and-system)) 1403 (const system) (const paper-and-system))
1351 :group 'ps-print-miscellany) 1404 :group 'ps-print-miscellany)
1352 1405
1353 (defcustom ps-user-defined-prologue nil 1406 (defcustom ps-user-defined-prologue nil
1369 handles this in a suitable way. 1422 handles this in a suitable way.
1370 1423
1371 For more information about PostScript, see: 1424 For more information about PostScript, see:
1372 PostScript Language Reference Manual (2nd edition) 1425 PostScript Language Reference Manual (2nd edition)
1373 Adobe Systems Incorporated" 1426 Adobe Systems Incorporated"
1374 :type '(choice :tag "User Defined Prologue" 1427 :type '(choice :menu-tag "User Defined Prologue"
1428 :tag "User Defined Prologue"
1375 (const :tag "none" nil) string symbol) 1429 (const :tag "none" nil) string symbol)
1376 :group 'ps-print-miscellany) 1430 :group 'ps-print-miscellany)
1377 1431
1378 (defcustom ps-print-prologue-header nil 1432 (defcustom ps-print-prologue-header nil
1379 "*PostScript prologue header comments besides that ps-print generates. 1433 "*PostScript prologue header comments besides that ps-print generates.
1397 1451
1398 For more information about PostScript document comments, see: 1452 For more information about PostScript document comments, see:
1399 PostScript Language Reference Manual (2nd edition) 1453 PostScript Language Reference Manual (2nd edition)
1400 Adobe Systems Incorporated 1454 Adobe Systems Incorporated
1401 Appendix G: Document Structuring Conventions -- Version 3.0" 1455 Appendix G: Document Structuring Conventions -- Version 3.0"
1402 :type '(choice :tag "Prologue Header" 1456 :type '(choice :menu-tag "Prologue Header"
1457 :tag "Prologue Header"
1403 (const :tag "none" nil) string symbol) 1458 (const :tag "none" nil) string symbol)
1404 :group 'ps-print-miscellany) 1459 :group 'ps-print-miscellany)
1405 1460
1406 (defcustom ps-printer-name (and (boundp 'printer-name) 1461 (defcustom ps-printer-name (and (boundp 'printer-name)
1407 printer-name) 1462 printer-name)
1420 You can also set it to a name of a file, in which case the output gets 1475 You can also set it to a name of a file, in which case the output gets
1421 appended to that file. \(Note that `ps-print' package already has 1476 appended to that file. \(Note that `ps-print' package already has
1422 facilities for printing to a file, so you might as well use them instead 1477 facilities for printing to a file, so you might as well use them instead
1423 of changing the setting of this variable.\) If you want to silently 1478 of changing the setting of this variable.\) If you want to silently
1424 discard the printed output, set this to \"NUL\"." 1479 discard the printed output, set this to \"NUL\"."
1425 :type '(choice :tag "Printer Name" 1480 :type '(choice :menu-tag "Printer Name"
1481 :tag "Printer Name"
1482 (const :tag "Same as printer-name" nil)
1426 (file :tag "Print to file") 1483 (file :tag "Print to file")
1427 (string :tag "Pipe to ps-lpr-command") 1484 (string :tag "Pipe to ps-lpr-command"))
1428 (const :tag "Same as printer-name" nil))
1429 :group 'ps-print-printer) 1485 :group 'ps-print-printer)
1430 1486
1431 (defcustom ps-lpr-command lpr-command 1487 (defcustom ps-lpr-command lpr-command
1432 "*Name of program for printing a PostScript file. 1488 "*Name of program for printing a PostScript file.
1433 1489
1450 (defcustom ps-print-region-function nil 1506 (defcustom ps-print-region-function nil
1451 "*Specify a function to print the region on a PostScript printer. 1507 "*Specify a function to print the region on a PostScript printer.
1452 See definition of `call-process-region' for calling conventions. The fourth and 1508 See definition of `call-process-region' for calling conventions. The fourth and
1453 the sixth arguments are both nil." 1509 the sixth arguments are both nil."
1454 :type 'function 1510 :type 'function
1511 :group 'ps-print-printer)
1512
1513 (defcustom ps-manual-feed nil
1514 "*Non-nil means the printer will manually feed paper.
1515
1516 If it's nil, automatic feeding takes place."
1517 :type 'boolean
1455 :group 'ps-print-printer) 1518 :group 'ps-print-printer)
1456 1519
1457 ;;; Page layout 1520 ;;; Page layout
1458 1521
1459 ;; All page dimensions are in PostScript points. 1522 ;; All page dimensions are in PostScript points.
1507 nil 1570 nil
1508 (widget-put wid :error "Unknown paper size") 1571 (widget-put wid :error "Unknown paper size")
1509 wid))) 1572 wid)))
1510 :group 'ps-print-page) 1573 :group 'ps-print-page)
1511 1574
1575 (defcustom ps-warn-paper-type t
1576 "*Non-nil means give an error if paper size is not equal to `ps-paper-type'.
1577
1578 It's used when `ps-spool-config' is set to `setpagedevice'."
1579 :type 'boolean
1580 :group 'ps-print-page)
1581
1512 (defcustom ps-landscape-mode nil 1582 (defcustom ps-landscape-mode nil
1513 "*Non-nil means print in landscape mode." 1583 "*Non-nil means print in landscape mode."
1514 :type 'boolean 1584 :type 'boolean
1515 :group 'ps-print-page) 1585 :group 'ps-print-page)
1516 1586
1542 1612
1543 nil No ASCII encoding. Any character is printed according the 1613 nil No ASCII encoding. Any character is printed according the
1544 current font. 1614 current font.
1545 1615
1546 Any other value is treated as nil." 1616 Any other value is treated as nil."
1547 :type '(choice :tag "Control Char" 1617 :type '(choice :menu-tag "Control Char"
1618 :tag "Control Char"
1548 (const 8-bit) (const control-8-bit) 1619 (const 8-bit) (const control-8-bit)
1549 (const control) (const :tag "nil" nil)) 1620 (const control) (const :tag "nil" nil))
1550 :group 'ps-print-miscellany) 1621 :group 'ps-print-miscellany)
1551 1622
1552 (defcustom ps-n-up-printing 1 1623 (defcustom ps-n-up-printing 1
1595 `top-right' 10 7 4 1 `bottom-right' 12 9 6 3 1666 `top-right' 10 7 4 1 `bottom-right' 12 9 6 3
1596 11 8 5 2 11 8 5 2 1667 11 8 5 2 11 8 5 2
1597 12 9 6 3 10 7 4 1 1668 12 9 6 3 10 7 4 1
1598 1669
1599 Any other value is treated as `left-top'." 1670 Any other value is treated as `left-top'."
1600 :type '(choice :tag "N-Up Filling" 1671 :type '(choice :menu-tag "N-Up Filling"
1672 :tag "N-Up Filling"
1601 (const left-top) (const left-bottom) 1673 (const left-top) (const left-bottom)
1602 (const right-top) (const right-bottom) 1674 (const right-top) (const right-bottom)
1603 (const top-left) (const bottom-left) 1675 (const top-left) (const bottom-left)
1604 (const top-right) (const bottom-right)) 1676 (const top-right) (const bottom-right))
1605 :group 'ps-print-n-up) 1677 :group 'ps-print-n-up)
1622 :group 'ps-print-zebra) 1694 :group 'ps-print-zebra)
1623 1695
1624 (defcustom ps-zebra-color 0.95 1696 (defcustom ps-zebra-color 0.95
1625 "*Zebra stripe gray scale or RGB color. 1697 "*Zebra stripe gray scale or RGB color.
1626 See also documentation for `ps-zebra-stripes' and `ps-zebra-stripe-height'." 1698 See also documentation for `ps-zebra-stripes' and `ps-zebra-stripe-height'."
1627 :type '(choice :tag "Zebra Gray/Color" 1699 :type '(choice :menu-tag "Zebra Gray/Color"
1700 :tag "Zebra Gray/Color"
1628 (number :tag "Gray Scale" :value 0.95) 1701 (number :tag "Gray Scale" :value 0.95)
1629 (string :tag "Color Name" :value "gray95") 1702 (string :tag "Color Name" :value "gray95")
1630 (list :tag "RGB Color" :value (0.95 0.95 0.95) 1703 (list :tag "RGB Color" :value (0.95 0.95 0.95)
1631 (number :tag "Red") 1704 (number :tag "Red")
1632 (number :tag "Green") 1705 (number :tag "Green")
1633 (number :tag "Blue"))) 1706 (number :tag "Blue")))
1634 :group 'ps-print-zebra) 1707 :group 'ps-print-zebra)
1635 1708
1709 (defcustom ps-zebra-stripe-follow nil
1710 "*Non-nil means zebra stripe continues on next page.
1711
1712 If `ps-zebra-stripe-follow' is nil, zebra stripe is restarted on each page.
1713 If `ps-zebra-stripe-follow' is non-nil, zebra stripe continues on next page.
1714
1715 Visually, we have:
1716
1717 `ps-zebra-stripe-follow' `ps-zebra-stripe-follow'
1718 is nil is non-nil
1719 Current Page ------------------------ ------------------------
1720 1 XXXXXXXXXXXXXXXXXXXXX 1 XXXXXXXXXXXXXXXXXXXXX
1721 2 XXXXXXXXXXXXXXXXXXXXX 2 XXXXXXXXXXXXXXXXXXXXX
1722 3 XXXXXXXXXXXXXXXXXXXXX 3 XXXXXXXXXXXXXXXXXXXXX
1723 4 4
1724 5 5
1725 6 6
1726 7 XXXXXXXXXXXXXXXXXXXXX 7 XXXXXXXXXXXXXXXXXXXXX
1727 8 XXXXXXXXXXXXXXXXXXXXX 8 XXXXXXXXXXXXXXXXXXXXX
1728 ------------------------ ------------------------
1729 Next Page ------------------------ ------------------------
1730 9 XXXXXXXXXXXXXXXXXXXXX 9 XXXXXXXXXXXXXXXXXXXXX
1731 10 XXXXXXXXXXXXXXXXXXXXX 10
1732 11 XXXXXXXXXXXXXXXXXXXXX 11
1733 12 12
1734 13 13 XXXXXXXXXXXXXXXXXXXXX
1735 14 14 XXXXXXXXXXXXXXXXXXXXX
1736 15 XXXXXXXXXXXXXXXXXXXXX 15 XXXXXXXXXXXXXXXXXXXXX
1737 16 XXXXXXXXXXXXXXXXXXXXX 16
1738 ------------------------ ------------------------"
1739 :type 'boolean
1740 :group 'ps-print-zebra)
1741
1636 (defcustom ps-line-number nil 1742 (defcustom ps-line-number nil
1637 "*Non-nil means print line number." 1743 "*Non-nil means print line number."
1638 :type 'boolean 1744 :type 'boolean
1639 :group 'ps-print-miscellany) 1745 :group 'ps-print-miscellany)
1640 1746
1659 1765
1660 `zebra' specifies that only the line number of the first line in a zebra 1766 `zebra' specifies that only the line number of the first line in a zebra
1661 stripe is to be printed. 1767 stripe is to be printed.
1662 1768
1663 Any other value is treated as `zebra'." 1769 Any other value is treated as `zebra'."
1664 :type '(choice :tag "Line Number Step" 1770 :type '(choice :menu-tag "Line Number Step"
1771 :tag "Line Number Step"
1665 (integer :tag "Step Interval") 1772 (integer :tag "Step Interval")
1666 (const :tag "Synchronize Zebra" zebra)) 1773 (const :tag "Synchronize Zebra" zebra))
1667 :group 'ps-print-miscellany) 1774 :group 'ps-print-miscellany)
1668 1775
1669 (defcustom ps-line-number-start 1 1776 (defcustom ps-line-number-start 1
1877 (defcustom ps-header-lines 2 1984 (defcustom ps-header-lines 2
1878 "*Number of lines to display in page header, when generating PostScript." 1985 "*Number of lines to display in page header, when generating PostScript."
1879 :type 'integer 1986 :type 'integer
1880 :group 'ps-print-headers) 1987 :group 'ps-print-headers)
1881 1988
1989 (defcustom ps-switch-header 'duplex
1990 "*Specify if headers are switched or not.
1991
1992 Valid values are:
1993
1994 nil Never switch headers.
1995
1996 t Always switch headers.
1997
1998 duplex Switch headers only when duplexing is on, that is, when
1999 `ps-spool-duplex' is non-nil.
2000
2001 Any other value is treated as t."
2002 :type '(choice :menu-tag "Switch Header"
2003 :tag "Switch Header"
2004 (const :tag "Never Switch" nil)
2005 (const :tag "Always Switch" t)
2006 (const :tag "Switch When Duplexing" duplex))
2007 :group 'ps-print-headers)
2008
1882 (defcustom ps-show-n-of-n t 2009 (defcustom ps-show-n-of-n t
1883 "*Non-nil means show page numbers as N/M, meaning page N of M. 2010 "*Non-nil means show page numbers as N/M, meaning page N of M.
1884 NOTE: page numbers are displayed as part of headers, 2011 NOTE: page numbers are displayed as part of headers,
1885 see variable `ps-print-header'." 2012 see variable `ps-print-header'."
1886 :type 'boolean 2013 :type 'boolean
1913 Besides all that, if your printer does not have the paper size 2040 Besides all that, if your printer does not have the paper size
1914 specified by setpagedevice, your printing will be aborted. 2041 specified by setpagedevice, your printing will be aborted.
1915 So, if you need to use setpagedevice, set `ps-spool-config' to 2042 So, if you need to use setpagedevice, set `ps-spool-config' to
1916 `setpagedevice', generate a test file and send it to your printer; if 2043 `setpagedevice', generate a test file and send it to your printer; if
1917 the printed file isn't ok, set `ps-spool-config' to nil." 2044 the printed file isn't ok, set `ps-spool-config' to nil."
1918 :type '(choice :tag "Spool Config" 2045 :type '(choice :menu-tag "Spool Config"
2046 :tag "Spool Config"
1919 (const lpr-switches) (const setpagedevice) 2047 (const lpr-switches) (const setpagedevice)
1920 (const :tag "nil" nil)) 2048 (const :tag "nil" nil))
1921 :group 'ps-print-headers) 2049 :group 'ps-print-headers)
1922 2050
1923 (defcustom ps-spool-duplex nil ; Not many people have duplex printers, 2051 (defcustom ps-spool-duplex nil ; Not many people have duplex printers,
2130 :type 'boolean 2258 :type 'boolean
2131 :group 'ps-print-color) 2259 :group 'ps-print-color)
2132 2260
2133 (defcustom ps-default-fg '(0.0 0.0 0.0) 2261 (defcustom ps-default-fg '(0.0 0.0 0.0)
2134 "*RGB values of the default foreground color. Defaults to black." 2262 "*RGB values of the default foreground color. Defaults to black."
2135 :type '(choice :tag "Default Foreground Gray/Color" 2263 :type '(choice :menu-tag "Default Foreground Gray/Color"
2264 :tag "Default Foreground Gray/Color"
2136 (number :tag "Gray Scale" :value 0.0) 2265 (number :tag "Gray Scale" :value 0.0)
2137 (string :tag "Color Name" :value "black") 2266 (string :tag "Color Name" :value "black")
2138 (list :tag "RGB Color" :value (0.0 0.0 0.0) 2267 (list :tag "RGB Color" :value (0.0 0.0 0.0)
2139 (number :tag "Red") 2268 (number :tag "Red")
2140 (number :tag "Green") 2269 (number :tag "Green")
2141 (number :tag "Blue"))) 2270 (number :tag "Blue")))
2142 :group 'ps-print-color) 2271 :group 'ps-print-color)
2143 2272
2144 (defcustom ps-default-bg '(1.0 1.0 1.0) 2273 (defcustom ps-default-bg '(1.0 1.0 1.0)
2145 "*RGB values of the default background color. Defaults to white." 2274 "*RGB values of the default background color. Defaults to white."
2146 :type '(choice :tag "Default Background Gray/Color" 2275 :type '(choice :menu-tag "Default Background Gray/Color"
2276 :tag "Default Background Gray/Color"
2147 (number :tag "Gray Scale" :value 1.0) 2277 (number :tag "Gray Scale" :value 1.0)
2148 (string :tag "Color Name" :value "white") 2278 (string :tag "Color Name" :value "white")
2149 (list :tag "RGB Color" :value (1.0 1.0 1.0) 2279 (list :tag "RGB Color" :value (1.0 1.0 1.0)
2150 (number :tag "Red") 2280 (number :tag "Red")
2151 (number :tag "Green") 2281 (number :tag "Green")
2201 t always use face background color. 2331 t always use face background color.
2202 nil never use face background color. 2332 nil never use face background color.
2203 (face...) list of faces whose background color will be used. 2333 (face...) list of faces whose background color will be used.
2204 2334
2205 Any other value will be treated as t." 2335 Any other value will be treated as t."
2206 :type '(choice :tag "Use Face Background" 2336 :type '(choice :menu-tag "Use Face Background"
2337 :tag "Use Face Background"
2207 (const :tag "Always Use Face Background" t) 2338 (const :tag "Always Use Face Background" t)
2208 (const :tag "Never Use Face Background" nil) 2339 (const :tag "Never Use Face Background" nil)
2209 (repeat :menu-tag "Face Background List" 2340 (repeat :menu-tag "Face Background List"
2210 :tag "Face Background List" 2341 :tag "Face Background List"
2211 face)) 2342 face))
2283 :type 'boolean 2414 :type 'boolean
2284 :group 'ps-print-headers) 2415 :group 'ps-print-headers)
2285 2416
2286 (defcustom ps-postscript-code-directory 2417 (defcustom ps-postscript-code-directory
2287 (or (and (fboundp 'locate-data-directory) ; xemacs 2418 (or (and (fboundp 'locate-data-directory) ; xemacs
2288 (locate-data-directory "ps-print")) 2419 (locate-data-directory "ps-print"))
2289 data-directory) ; emacs 2420 data-directory) ; emacs
2290 "*Directory where it's located the PostScript prologue file used by ps-print. 2421 "*Directory where it's located the PostScript prologue file used by ps-print.
2291 By default, this directory is the same as in the variable `data-directory'." 2422 By default, this directory is the same as in the variable `data-directory'."
2292 :type 'directory 2423 :type 'directory
2293 :group 'ps-print-miscellany) 2424 :group 'ps-print-miscellany)
2434 ;;;###autoload 2565 ;;;###autoload
2435 (defun ps-setup () 2566 (defun ps-setup ()
2436 "Return the current PostScript-generation setup." 2567 "Return the current PostScript-generation setup."
2437 (format 2568 (format
2438 " 2569 "
2570 ;;; ps-print version %s
2439 \(setq ps-print-color-p %s 2571 \(setq ps-print-color-p %s
2440 ps-lpr-command %S 2572 ps-lpr-command %S
2441 ps-lpr-switches %s 2573 ps-lpr-switches %s
2442 ps-printer-name %S 2574 ps-printer-name %S
2443 ps-print-region-function %s 2575 ps-print-region-function %s
2576 ps-manual-feed %S
2444 2577
2445 ps-paper-type %s 2578 ps-paper-type %s
2579 ps-warn-paper-type %s
2446 ps-landscape-mode %s 2580 ps-landscape-mode %s
2447 ps-print-upside-down %s 2581 ps-print-upside-down %s
2448 ps-number-of-columns %s 2582 ps-number-of-columns %s
2449 2583
2450 ps-zebra-stripes %s 2584 ps-zebra-stripes %s
2451 ps-zebra-stripe-height %s 2585 ps-zebra-stripe-height %s
2586 ps-zebra-stripe-follow %S
2452 ps-zebra-color %s 2587 ps-zebra-color %s
2453 ps-line-number %s 2588 ps-line-number %s
2454 ps-line-number-step %s 2589 ps-line-number-step %s
2455 ps-line-number-start %S 2590 ps-line-number-start %S
2456 2591
2477 ps-header-offset %s 2612 ps-header-offset %s
2478 ps-header-line-pad %s 2613 ps-header-line-pad %s
2479 ps-print-header %s 2614 ps-print-header %s
2480 ps-print-only-one-header %s 2615 ps-print-only-one-header %s
2481 ps-print-header-frame %s 2616 ps-print-header-frame %s
2617 ps-switch-header %s
2482 ps-header-lines %s 2618 ps-header-lines %s
2483 ps-show-n-of-n %s 2619 ps-show-n-of-n %s
2484 ps-spool-config %s 2620 ps-spool-config %s
2485 ps-spool-duplex %s 2621 ps-spool-duplex %s
2486 ps-spool-tumble %s 2622 ps-spool-tumble %s
2487 ps-banner-page-when-duplexing %s 2623 ps-banner-page-when-duplexing %s
2488 2624
2489 ps-n-up-printing %s 2625 ps-n-up-printing %s
2490 ps-n-up-margin %s 2626 ps-n-up-margin %s
2491 ps-n-up-border-p %s 2627 ps-n-up-border-p %s
2492 ps-n-up-filling %s 2628 ps-n-up-filling %s
2493 2629
2494 ps-multibyte-buffer %s 2630 ps-multibyte-buffer %s
2495 ps-font-family %s 2631 ps-font-family %s
2496 ps-font-size %s 2632 ps-font-size %s
2497 ps-header-font-family %s 2633 ps-header-font-family %s
2498 ps-header-font-size %s 2634 ps-header-font-size %s
2499 ps-header-title-font-size %s) 2635 ps-header-title-font-size %s)
2500 " 2636 "
2637 ps-print-version
2501 ps-print-color-p 2638 ps-print-color-p
2502 ps-lpr-command 2639 ps-lpr-command
2503 (ps-print-quote ps-lpr-switches) 2640 (ps-print-quote ps-lpr-switches)
2504 ps-printer-name 2641 ps-printer-name
2505 (ps-print-quote ps-print-region-function) 2642 (ps-print-quote ps-print-region-function)
2643 ps-manual-feed
2506 (ps-print-quote ps-paper-type) 2644 (ps-print-quote ps-paper-type)
2645 ps-warn-paper-type
2507 ps-landscape-mode 2646 ps-landscape-mode
2508 ps-print-upside-down 2647 ps-print-upside-down
2509 ps-number-of-columns 2648 ps-number-of-columns
2510 ps-zebra-stripes 2649 ps-zebra-stripes
2511 ps-zebra-stripe-height 2650 ps-zebra-stripe-height
2651 ps-zebra-stripe-follow
2512 (ps-print-quote ps-zebra-color) 2652 (ps-print-quote ps-zebra-color)
2513 ps-line-number 2653 ps-line-number
2514 (ps-print-quote ps-line-number-step) 2654 (ps-print-quote ps-line-number-step)
2515 ps-line-number-start 2655 ps-line-number-start
2516 (ps-print-quote ps-default-fg) 2656 (ps-print-quote ps-default-fg)
2530 ps-header-offset 2670 ps-header-offset
2531 ps-header-line-pad 2671 ps-header-line-pad
2532 ps-print-header 2672 ps-print-header
2533 ps-print-only-one-header 2673 ps-print-only-one-header
2534 ps-print-header-frame 2674 ps-print-header-frame
2675 (ps-print-quote ps-switch-header)
2535 ps-header-lines 2676 ps-header-lines
2536 ps-show-n-of-n 2677 ps-show-n-of-n
2537 (ps-print-quote ps-spool-config) 2678 (ps-print-quote ps-spool-config)
2538 ps-spool-duplex 2679 ps-spool-duplex
2539 ps-spool-tumble 2680 ps-spool-tumble
3390 (format "/%s " (or (nth 3 text) "Times-Roman")) ; font name 3531 (format "/%s " (or (nth 3 text) "Times-Roman")) ; font name
3391 (ps-float-format (nth 6 text) 3532 (ps-float-format (nth 6 text)
3392 "PrintHeight PrintPageWidth atan") ; rotation 3533 "PrintHeight PrintPageWidth atan") ; rotation
3393 (ps-float-format (nth 5 text) 0.85) ; gray 3534 (ps-float-format (nth 5 text) 0.85) ; gray
3394 (ps-float-format (nth 1 text) "0") ; x position 3535 (ps-float-format (nth 1 text) "0") ; x position
3395 (ps-float-format (nth 2 text) "BottomMargin") ; y position 3536 (ps-float-format (nth 2 text) "0") ; y position
3396 "\nShowBackText} def\n") 3537 "\nShowBackText} def\n")
3397 (ps-background-pages (nthcdr 7 text) ; page list 3538 (ps-background-pages (nthcdr 7 text) ; page list
3398 (format "ShowBackText-%d\n" 3539 (format "ShowBackText-%d\n"
3399 ps-background-text-count))) 3540 ps-background-text-count)))
3400 ps-print-background-text)) 3541 ps-print-background-text))
3528 (81 nil 9 9 0) 3669 (81 nil 9 9 0)
3529 (90 nil 10 9 1) 3670 (90 nil 10 9 1)
3530 (100 nil 10 10 0)) 3671 (100 nil 10 10 0))
3531 (letter 3672 (letter
3532 (1 nil 1 1 0) 3673 (1 nil 1 1 0)
3674 (2 t 1 2 0) ; adjusted by PostScript code
3533 (4 nil 2 2 0) 3675 (4 nil 2 2 0)
3534 (6 t 2 3 0) 3676 (6 t 2 3 0)
3535 (9 nil 3 3 0) 3677 (9 nil 3 3 0)
3536 (12 nil 4 3 1) 3678 (12 nil 4 3 1)
3537 (16 nil 4 4 0) 3679 (16 nil 4 4 0)
3570 (81 nil 9 9 0) 3712 (81 nil 9 9 0)
3571 (90 nil 10 9 1) 3713 (90 nil 10 9 1)
3572 (100 nil 10 10 0)) 3714 (100 nil 10 10 0))
3573 (letter-small 3715 (letter-small
3574 (1 nil 1 1 0) 3716 (1 nil 1 1 0)
3717 (2 t 1 2 0) ; adjusted by PostScript code
3575 (4 nil 2 2 0) 3718 (4 nil 2 2 0)
3576 (6 t 2 3 0) 3719 (6 t 2 3 0)
3577 (9 nil 3 3 0) 3720 (9 nil 3 3 0)
3578 (12 t 3 4 1) 3721 (12 t 3 4 1)
3579 (15 t 3 5 0) 3722 (15 t 3 5 0)
3665 (81 nil 9 9 0) 3808 (81 nil 9 9 0)
3666 (90 nil 10 9 1) 3809 (90 nil 10 9 1)
3667 (100 nil 10 10 0)) 3810 (100 nil 10 10 0))
3668 (executive 3811 (executive
3669 (1 nil 1 1 0) 3812 (1 nil 1 1 0)
3813 (2 t 1 2 0) ; adjusted by PostScript code
3670 (4 nil 2 2 0) 3814 (4 nil 2 2 0)
3671 (6 t 2 3 0) 3815 (6 t 2 3 0)
3672 (9 nil 3 3 0) 3816 (9 nil 3 3 0)
3673 (12 nil 4 3 1) 3817 (12 nil 4 3 1)
3674 (16 nil 4 4 0) 3818 (16 nil 4 4 0)
3946 "\n%%DocumentMedia: " (ps-page-dimensions-get-media dimensions) 4090 "\n%%DocumentMedia: " (ps-page-dimensions-get-media dimensions)
3947 (format " %d" (round (ps-page-dimensions-get-width dimensions))) 4091 (format " %d" (round (ps-page-dimensions-get-width dimensions)))
3948 (format " %d" (round (ps-page-dimensions-get-height dimensions))) 4092 (format " %d" (round (ps-page-dimensions-get-height dimensions)))
3949 " 0 () ()\n%%PageOrder: Ascend\n%%Pages: (atend)\n%%Requirements:" 4093 " 0 () ()\n%%PageOrder: Ascend\n%%Pages: (atend)\n%%Requirements:"
3950 (if ps-spool-duplex 4094 (if ps-spool-duplex
3951 (format " duplex%s" (if tumble "(tumble)\n" "\n")) 4095 (if tumble " duplex(tumble)\n" " duplex\n")
3952 "\n")) 4096 "\n"))
3953 4097
3954 (ps-insert-string ps-print-prologue-header) 4098 (ps-insert-string ps-print-prologue-header)
3955 4099
3956 (ps-output "%%EndComments\n\n%%BeginPrologue\n\n" 4100 (ps-output "%%EndComments\n%%BeginDefaults\n%%PageMedia: "
4101 (ps-page-dimensions-get-media dimensions)
4102 "\n%%EndDefaults\n\n%%BeginPrologue\n\n"
3957 "/languagelevel where{pop}{/languagelevel 1 def}ifelse\n" 4103 "/languagelevel where{pop}{/languagelevel 1 def}ifelse\n"
3958 (format "/ErrorMessage %s def\n\n" 4104 (format "/ErrorMessage %s def\n\n"
3959 (or (cdr (assoc ps-error-handler-message 4105 (or (cdr (assoc ps-error-handler-message
3960 ps-error-handler-alist)) 4106 ps-error-handler-alist))
3961 1)) ; send to paper 4107 1)) ; send to paper
3990 (format "/HeaderPad %s def\n" ps-header-pad)) 4136 (format "/HeaderPad %s def\n" ps-header-pad))
3991 4137
3992 (ps-output-boolean "PrintHeader " ps-print-header) 4138 (ps-output-boolean "PrintHeader " ps-print-header)
3993 (ps-output-boolean "PrintOnlyOneHeader" ps-print-only-one-header) 4139 (ps-output-boolean "PrintOnlyOneHeader" ps-print-only-one-header)
3994 (ps-output-boolean "PrintHeaderFrame " ps-print-header-frame) 4140 (ps-output-boolean "PrintHeaderFrame " ps-print-header-frame)
4141 (ps-output-boolean "SwitchHeader " (if (eq ps-switch-header 'duplex)
4142 ps-spool-duplex
4143 ps-switch-header))
3995 (ps-output-boolean "ShowNofN " ps-show-n-of-n) 4144 (ps-output-boolean "ShowNofN " ps-show-n-of-n)
3996 (ps-output-boolean "DuplexValue " ps-spool-duplex) 4145 (ps-output-boolean "DuplexValue " ps-spool-duplex)
3997 (ps-output-boolean "TumbleValue " tumble) 4146 (ps-output-boolean "TumbleValue " tumble)
3998 4147
3999 (let ((line-height (ps-line-height 'ps-font-for-text))) 4148 (let ((line-height (ps-line-height 'ps-font-for-text)))
4001 (format "/LinesPerColumn %d def\n" 4150 (format "/LinesPerColumn %d def\n"
4002 (round (/ (+ ps-print-height 4151 (round (/ (+ ps-print-height
4003 (* line-height 0.45)) 4152 (* line-height 0.45))
4004 line-height))))) 4153 line-height)))))
4005 4154
4155 (ps-output-boolean "WarnPaperSize " ps-warn-paper-type)
4006 (ps-output-boolean "Zebra " ps-zebra-stripes) 4156 (ps-output-boolean "Zebra " ps-zebra-stripes)
4157 (ps-output-boolean "ZebraFollow " ps-zebra-stripe-follow)
4007 (ps-output-boolean "PrintLineNumber " ps-line-number) 4158 (ps-output-boolean "PrintLineNumber " ps-line-number)
4008 (ps-output-boolean "SyncLineZebra " (not (integerp ps-line-number-step))) 4159 (ps-output-boolean "SyncLineZebra " (not (integerp ps-line-number-step)))
4009 (ps-output (format "/PrintLineStep %d def\n" 4160 (ps-output (format "/PrintLineStep %d def\n"
4010 (if (integerp ps-line-number-step) 4161 (if (integerp ps-line-number-step)
4011 ps-line-number-step 4162 ps-line-number-step
4087 " *Tumble " 4238 " *Tumble "
4088 (ps-boolean-capitalized tumble) 4239 (ps-boolean-capitalized tumble)
4089 "\n\n" 4240 "\n\n"
4090 ps-print-duplex-feature 4241 ps-print-duplex-feature
4091 "\n%%EndFeature\n"))) 4242 "\n%%EndFeature\n")))
4092 (ps-output "\n/Lines 0 def\n/PageCount 0 def\n\nBeginDoc\n%%EndSetup\n") 4243 (ps-output "\n%%BeginFeature: *ManualFeed "
4244 (ps-boolean-capitalized ps-manual-feed)
4245 "\nBMark /ManualFeed "
4246 (ps-boolean-constant ps-manual-feed)
4247 " EMark setpagedevice\n%%EndFeature\n"
4248 "\n/Lines 0 def\n/PageCount 0 def\n\nBeginDoc\n%%EndSetup\n")
4093 (and ps-banner-page-when-duplexing 4249 (and ps-banner-page-when-duplexing
4094 (ps-output "\n%%Page: banner 0\nsave showpage restore\n"))) 4250 (ps-output "\n%%Page: banner 0\nsave showpage restore\n")))
4095 4251
4096 4252
4097 (defun ps-format-color (color &optional default) 4253 (defun ps-format-color (color &optional default)
4116 (ps-output str)))) 4272 (ps-output str))))
4117 4273
4118 4274
4119 (defun ps-boolean-capitalized (bool) 4275 (defun ps-boolean-capitalized (bool)
4120 (if bool "True" "False")) 4276 (if bool "True" "False"))
4277
4278
4279 (defun ps-boolean-constant (bool)
4280 (if bool "true" "false"))
4121 4281
4122 4282
4123 (defun ps-header-dirpart () 4283 (defun ps-header-dirpart ()
4124 (let ((fname (buffer-file-name))) 4284 (let ((fname (buffer-file-name)))
4125 (if fname 4285 (if fname
4535 ;; Scale 16-bit X-COLOR-VALUE to PostScript color value in [0, 1] interval. 4695 ;; Scale 16-bit X-COLOR-VALUE to PostScript color value in [0, 1] interval.
4536 (mapcar #'(lambda (value) (/ value ps-print-color-scale)) 4696 (mapcar #'(lambda (value) (/ value ps-print-color-scale))
4537 (ps-color-values color))) 4697 (ps-color-values color)))
4538 4698
4539 4699
4700 (defun ps-xemacs-color-name (color)
4701 (if (color-specifier-p color)
4702 (color-name color)
4703 color))
4704
4705
4540 (cond ((eq ps-print-emacs-type 'emacs) ; emacs 4706 (cond ((eq ps-print-emacs-type 'emacs) ; emacs
4541 4707
4542 (defun ps-color-values (x-color) 4708 (defun ps-color-values (x-color)
4543 (if (fboundp 'x-color-values) 4709 (if (fboundp 'x-color-values)
4544 (x-color-values x-color) 4710 (x-color-values x-color)
4546 ) 4712 )
4547 ; xemacs 4713 ; xemacs
4548 ; lucid 4714 ; lucid
4549 (t ; epoch 4715 (t ; epoch
4550 (defun ps-color-values (x-color) 4716 (defun ps-color-values (x-color)
4551 (let ((the-color (if (color-specifier-p x-color) 4717 (let ((color (ps-xemacs-color-name x-color)))
4552 (color-name x-color)
4553 x-color)))
4554 (cond 4718 (cond
4555 ((fboundp 'x-color-values) 4719 ((fboundp 'x-color-values)
4556 (x-color-values the-color)) 4720 (x-color-values color))
4557 ((and (fboundp 'color-instance-rgb-components) 4721 ((and (fboundp 'color-instance-rgb-components)
4558 (ps-color-device)) 4722 (ps-color-device))
4559 (color-instance-rgb-components 4723 (color-instance-rgb-components
4560 (if (color-instance-p x-color) 4724 (if (color-instance-p x-color)
4561 x-color 4725 x-color
4562 (make-color-instance the-color)))) 4726 (make-color-instance color))))
4563 (t 4727 (t
4564 (error "No available function to determine X color values."))))) 4728 (error "No available function to determine X color values.")))))
4565 )) 4729 ))
4566 4730
4567 4731
4657 (and kind-spec (string-match kind-regex kind-spec)))) 4821 (and kind-spec (string-match kind-regex kind-spec))))
4658 4822
4659 4823
4660 (cond ((eq ps-print-emacs-type 'emacs) ; emacs 4824 (cond ((eq ps-print-emacs-type 'emacs) ; emacs
4661 4825
4826 (defalias 'ps-face-foreground-name 'face-foreground)
4827 (defalias 'ps-face-background-name 'face-background)
4828
4662 (defun ps-face-bold-p (face) 4829 (defun ps-face-bold-p (face)
4663 (or (face-bold-p face) 4830 (or (face-bold-p face)
4664 (memq face ps-bold-faces))) 4831 (memq face ps-bold-faces)))
4665 4832
4666 (defun ps-face-italic-p (face) 4833 (defun ps-face-italic-p (face)
4668 (memq face ps-italic-faces))) 4835 (memq face ps-italic-faces)))
4669 ) 4836 )
4670 ; xemacs 4837 ; xemacs
4671 ; lucid 4838 ; lucid
4672 (t ; epoch 4839 (t ; epoch
4840 (defun ps-face-foreground-name (face)
4841 (ps-xemacs-color-name (face-foreground face)))
4842
4843 (defun ps-face-background-name (face)
4844 (ps-xemacs-color-name (face-background face)))
4845
4673 (defun ps-face-bold-p (face) 4846 (defun ps-face-bold-p (face)
4674 (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold") 4847 (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold")
4675 (memq face ps-bold-faces))) ; Kludge-compatible 4848 (memq face ps-bold-faces))) ; Kludge-compatible
4676 4849
4677 (defun ps-face-italic-p (face) 4850 (defun ps-face-italic-p (face)
4736 (defun ps-screen-to-bit-face (face) 4909 (defun ps-screen-to-bit-face (face)
4737 (cons face 4910 (cons face
4738 (vector (logior (if (ps-face-bold-p face) 1 0) ; bold 4911 (vector (logior (if (ps-face-bold-p face) 1 0) ; bold
4739 (if (ps-face-italic-p face) 2 0) ; italic 4912 (if (ps-face-italic-p face) 2 0) ; italic
4740 (if (ps-face-underlined-p face) 4 0)) ; underline 4913 (if (ps-face-underlined-p face) 4 0)) ; underline
4741 (face-foreground face) 4914 (ps-face-foreground-name face)
4742 (face-background face)))) 4915 (ps-face-background-name face))))
4743 4916
4744 4917
4745 (cond ((not (eq ps-print-emacs-type 'emacs)) 4918 (cond ((not (eq ps-print-emacs-type 'emacs))
4746 ; xemacs 4919 ; xemacs
4747 ; lucid 4920 ; lucid
4763 (defun ps-generate-postscript-with-faces (from to) 4936 (defun ps-generate-postscript-with-faces (from to)
4764 ;; Some initialization... 4937 ;; Some initialization...
4765 (setq ps-current-effect 0) 4938 (setq ps-current-effect 0)
4766 4939
4767 ;; Build the reference lists of faces if necessary. 4940 ;; Build the reference lists of faces if necessary.
4768 (if (or ps-always-build-face-reference 4941 (when (or ps-always-build-face-reference
4769 ps-build-face-reference) 4942 ps-build-face-reference)
4770 (progn 4943 (message "Collecting face information...")
4771 (message "Collecting face information...") 4944 (ps-build-reference-face-lists))
4772 (ps-build-reference-face-lists)))
4773 ;; Generate some PostScript. 4945 ;; Generate some PostScript.
4774 (save-restriction 4946 (save-restriction
4775 (narrow-to-region from to) 4947 (narrow-to-region from to)
4776 (ps-print-ensure-fontified from to) 4948 (ps-print-ensure-fontified from to)
4777 (let ((face 'default) 4949 (let ((face 'default)
4778 (position to)) 4950 (position to))
4779 (cond 4951 (cond
4780 ((or (eq ps-print-emacs-type 'lucid) 4952 ((memq ps-print-emacs-type '(xemacs lucid))
4781 (eq ps-print-emacs-type 'xemacs))
4782 ;; Build the list of extents... 4953 ;; Build the list of extents...
4783 (let ((a (cons 'dummy nil)) 4954 (let ((a (cons 'dummy nil))
4784 record type extent extent-list) 4955 record type extent extent-list)
4785 (map-extents 'ps-mapper nil from to a) 4956 (map-extents 'ps-mapper nil from to a)
4786 (setq a (sort (cdr a) 'car-less-than-car) 4957 (setq a (sort (cdr a) 'car-less-than-car)