annotate lisp/packages/ps-print.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; ps-print.el --- Jim's Pretty-Good PostScript Generator for Emacs 19.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: Jim Thompson <thompson@wg2.waii.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: print, PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; LCD Archive Entry:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; ps-print|James C. Thompson|thompson@wg2.waii.com|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; Jim's Pretty-Good PostScript Generator for Emacs 19 (ps-print)|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; 26-Feb-1994|2.8|~/packages/ps-print.el|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; Baseline-version: 2.8. (Jim's last change version -- this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; file may have been edited as part of Emacs without changes to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; version number. When reporting bugs, please also report the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; version of Emacs, if any, that ps-print was distributed with.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; Synched up with: FSF 19.30.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; About ps-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; --------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; This package provides printing of Emacs buffers on PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; printers; the buffer's bold and italic text attributes are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; preserved in the printer output. Ps-print is intended for use with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; Emacs 19 or Lucid Emacs, together with a fontifying package such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; font-lock or hilit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; Using ps-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; --------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; The Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; Ps-print provides eight commands for generating PostScript images
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; of Emacs buffers:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; ps-print-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; ps-print-buffer-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; ps-print-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;; ps-print-region-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;; ps-spool-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; ps-spool-buffer-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;; ps-spool-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; ps-spool-region-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;; These commands all perform essentially the same function: they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; generate PostScript images suitable for printing on a PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;; printer or displaying with GhostScript. These commands are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; collectively referred to as "ps-print- commands".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;; The word "print" or "spool" in the command name determines when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;; PostScript image is sent to the printer:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;; print - The PostScript image is immediately sent to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;; printer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; spool - The PostScript image is saved temporarily in an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;; Emacs buffer. Many images may be spooled locally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;; before printing them. To send the spooled images
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;; to the printer, use the command ps-despool.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;; The spooling mechanism was designed for printing lots of small
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;; files (mail messages or netnews articles) to save paper that would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;; otherwise be wasted on banner pages, and to make it easier to find
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; your output at the printer (it's easier to pick up one 50-page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; printout than to find 50 single-page printouts).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;; Ps-print has a hook in the kill-emacs-hooks so that you won't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; accidently quit from Emacs while you have unprinted PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;; waiting in the spool buffer. If you do attempt to exit with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ;; spooled PostScript, you'll be asked if you want to print it, and if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;; you decline, you'll be asked to confirm the exit; this is modeled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;; on the confirmation that Emacs uses for modified buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ;; The word "buffer" or "region" in the command name determines how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;; much of the buffer is printed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;; buffer - Print the entire buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ;; region - Print just the current region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ;; The -with-faces suffix on the command name means that the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ;; will include font, color, and underline information in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ;; PostScript image, so the printed image can look as pretty as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ;; buffer. The ps-print- commands without the -with-faces suffix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;; don't include font, color, or underline information; images printed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;; with these commands aren't as pretty, but are faster to generate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;; Two ps-print- command examples:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;; ps-print-buffer - print the entire buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;; without font, color, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;; underline information, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; send it immediately to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;; printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;; ps-spool-region-with-faces - print just the current region;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;; include font, color, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; underline information, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; spool the image in Emacs to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;; send to the printer later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;; Invoking Ps-Print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;; To print your buffer, type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;; M-x ps-print-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; or substitute one of the other seven ps-print- commands. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;; command will generate the PostScript image and print or spool it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;; specified. By giving the command a prefix argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; C-u M-x ps-print-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; it will save the PostScript image to a file instead of sending it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;; to the printer; you will be prompted for the name of the file to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ;; save the image to. The prefix argument is ignored by the commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;; that spool their images, but you may save the spooled images to a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;; file by giving a prefix argument to ps-despool:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; C-u M-x ps-despool
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; When invoked this way, ps-despool will prompt you for the name of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ;; the file to save to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;; Any of the ps-print- commands can be bound to keys; I recommend
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;; binding ps-spool-buffer-with-faces, ps-spool-region-with-faces, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;; ps-despool. Here are the bindings I use on my Sun 4 keyboard:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;; (global-set-key 'f22 'ps-spool-buffer-with-faces) ;f22 is prsc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;; (global-set-key '(shift f22) 'ps-spool-region-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;; (global-set-key '(control f22) 'ps-despool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;; The Printer Interface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;; The variables ps-lpr-command and ps-lpr-switches determine what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;; command is used to send the PostScript images to the printer, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; what arguments to give the command. These are analogous to lpr-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; command and lpr-switches.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; NOTE: ps-lpr-command and ps-lpr-switches take their initial values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;; from the variables lpr-command and lpr-switches. If you have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; lpr-command set to invoke a pretty-printer such as enscript,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; then ps-print won't work properly. ps-lpr-command must name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; a program that does not format the files it prints.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;; How Ps-Print Deals With Fonts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;; The ps-print-*-with-faces commands attempt to determine which faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;; should be printed in bold or italic, but their guesses aren't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;; always right. For example, you might want to map colors into faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;; so that blue faces print in bold, and red faces in italic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; It is possible to force ps-print to consider specific faces bold or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; italic, no matter what font they are displayed in, by setting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; variables ps-bold-faces and ps-italic-faces. These variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;; contain lists of faces that ps-print should consider bold or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; italic; to set them, put code like the following into your .emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; file:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; (setq ps-bold-faces '(my-blue-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; (setq ps-italic-faces '(my-red-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; Faces like bold-italic that are both bold and italic should go in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; *both* lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;; Ps-print does not attempt to guess the sizes of fonts; all text is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;; rendered using the Courier font family, in 10 point size. To
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; change the font family, change the variables ps-font, ps-font-bold,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; ps-font-italic, and ps-font-bold-italic; fixed-pitch fonts work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;; best, but are not required. To change the font size, change the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;; variable ps-font-size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;; If you change the font family or size, you MUST also change the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;; variables ps-line-height, ps-avg-char-width, and ps-space-width, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;; ps-print cannot correctly place line and page breaks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; Ps-print keeps internal lists of which fonts are bold and which are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;; italic; these lists are built the first time you invoke ps-print.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; For the sake of efficiency, the lists are built only once; the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;; lists are referred in later invokations of ps-print.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;; Because these lists are built only once, it's possible for them to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; get out of sync, if a face changes, or if new faces are added. To
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;; get the lists back in sync, you can set the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; ps-build-face-reference to t, and the lists will be rebuilt the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ;; next time ps-print is invoked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;; How Ps-Print Deals With Color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ;; Ps-print detects faces with foreground and background colors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; defined and embeds color information in the PostScript image. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; default foreground and background colors are defined by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; variables ps-default-fg and ps-default-bg. On black-and-white
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;; printers, colors are displayed in grayscale. To turn off color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; output, set ps-print-color-p to nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; Headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; Ps-print can print headers at the top of each page; the default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;; headers contain the following four items: on the left, the name of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;; the buffer and, if the buffer is visiting a file, the file's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; directory; on the right, the page number and date of printing. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; default headers look something like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;; ps-print.el 1/21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ;; /home/jct/emacs-lisp/ps/new 94/12/31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;; When printing on duplex printers, left and right are reversed so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; that the page numbers are toward the outside.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;; Headers are configurable. To turn them off completely, set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; ps-print-header to nil. To turn off the header's gaudy framing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ;; box, set ps-print-header-frame to nil. Page numbers are printed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; "n/m" format, indicating page n of m pages; to omit the total page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;; count and just print the page number, set ps-show-n-of-n to nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; The amount of information in the header can be changed by changing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;; the number of lines. To show less, set ps-header-lines to 1, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;; the header will show only the buffer name and page number. To show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;; more, set ps-header-lines to 3, and the header will show the time of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;; printing below the date.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; To change the content of the headers, change the variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;; ps-left-header and ps-right-header. These variables are lists,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;; specifying top-to-bottom the text to display on the left or right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ;; side of the header. Each element of the list should be a string or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; a symbol. Strings are inserted directly into the PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ;; arrays, and should contain the PostScript string delimiters '(' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;; ')'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ;; Symbols in the header format lists can either represent functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ;; or variables. Functions are called, and should return a string to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;; show in the header. Variables should contain strings to display in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;; the header. In either case, function or variable, the PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;; strings delimeters are added by ps-print, and should not be part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;; the returned value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;; Here's an example: say we want the left header to display the text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;; Moe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;; Larry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;; Curly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;; where we have a function to return "Moe"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;; (defun moe-func ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;; "Moe")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;; a variable specifying "Larry"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 ;; (setq larry-var "Larry")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;; and a literal for "Curly". Here's how ps-left-header should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;; set:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;; (setq ps-left-header (list 'moe-func 'larry-var "(Curly)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;; Note that Curly has the PostScript string delimiters inside his
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;; quotes -- those aren't misplaced lisp delimiters! Without them,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;; PostScript would attempt to call the undefined function Curly,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; which would result in a PostScript error. Since most printers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ;; don't report PostScript errors except by aborting the print job,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 ;; this kind of error can be hard to track down. Consider yourself
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 ;; warned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;; Duplex Printers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;; If you have a duplex-capable printer (one that prints both sides of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;; the paper), set ps-spool-duplex to t. Ps-print will insert blank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ;; pages to make sure each buffer starts on the correct side of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ;; paper. Don't forget to set ps-lpr-switches to select duplex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ;; printing for your printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 ;; Paper Size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 ;; The variable ps-paper-type determines the size of paper ps-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 ;; formats for; it should contain one of the symbols ps-letter,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 ;; ps-legal, or ps-a4. The default is ps-letter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; Installing ps-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 ;; -------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;; 1. Place ps-print.el somewhere in your load-path and byte-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; it. You can ignore all byte-compiler warnings; they are the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;; result of multi-Emacs support. This step is necessary only if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ;; you're installing your own ps-print; if ps-print came with your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 ;; copy of Emacs, this been done already.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;; 2. Place in your .emacs file the line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 ;; (require 'ps-print)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 ;; to load ps-print. Or you may cause any of the ps-print commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 ;; to be autoloaded with an autoload command such as:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 ;; (autoload 'ps-print-buffer "ps-print"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ;; "Generate and print a PostScript image of the buffer..." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 ;; 3. Make sure that the variables ps-lpr-command and ps-lpr-switches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 ;; contain appropriate values for your system; see the usage notes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 ;; below and the documentation of these variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ;; New since version 1.5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 ;; ---------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 ;; Color output capability.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 ;; Automatic detection of font attributes (bold, italic).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 ;; Configurable headers with page numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 ;; Slightly faster.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ;; Support for different paper sizes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 ;; Better conformance to PostScript Document Structure Conventions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;; Known bugs and limitations of ps-print:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; --------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;; Although color printing will work in XEmacs 19.12, it doesn't work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;; well; in particular, bold or italic fonts don't print in the right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ;; background color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ;; Invisible properties aren't correctly ignored in XEmacs 19.12.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 ;; Automatic font-attribute detection doesn't work well, especially
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 ;; with hilit19 and older versions of get-create-face. Users having
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 ;; problems with auto-font detection should use the lists ps-italic-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 ;; faces and ps-bold-faces and/or turn off automatic detection by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ;; setting ps-auto-font-detect to nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ;; Automatic font-attribute detection doesn't work with XEmacs 19.12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 ;; in tty mode; use the lists ps-italic-faces and ps-bold-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ;; instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ;; Still too slow; could use some hand-optimization.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ;; ASCII Control characters other than tab, linefeed and pagefeed are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ;; not handled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ;; Default background color isn't working.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 ;; Faces are always treated as opaque.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ;; Epoch and Emacs 18 not supported. At all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;; Features to add:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 ;; ---------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ;; 2-up and 4-up capability.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ;; Line numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;; Wide-print (landscape) capability.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 ;; Acknowledgements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ;; ----------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 ;; Thanks to Kevin Rodgers <kevinr@ihs.com> for adding support for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ;; color and the invisible property.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ;; Thanks to Avishai Yacobi, avishaiy@mcil.comm.mot.com, for writing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ;; the initial port to Emacs 19. His code is no longer part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;; ps-print, but his work is still appreciated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ;; Thanks to Remi Houdaille and Michel Train, michel@metasoft.fdn.org,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;; for adding underline support. Their code also is no longer part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ;; ps-print, but their efforts are not forgotten.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ;; Thanks also to all of you who mailed code to add features to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ;; ps-print; although I didn't use your code, I still appreciate your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;; sharing it with me.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;; Thanks to all who mailed comments, encouragement, and criticism.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 ;; Thanks also to all who responded to my survey; I had too many
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;; responses to reply to them all, but I greatly appreciate your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ;; interest.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ;; Jim
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (defconst ps-print-version "2.8"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 "ps-print.el,v 2.8 1995/05/04 12:06:10 jct Exp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 Jim's last change version -- this file may have been edited as part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 Emacs without changes to the version number. When reporting bugs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 please also report the version of Emacs, if any, that ps-print was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 distributed with.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 Please send all bug fixes and enhancements to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 Jim Thompson <thompson@wg2.waii.com>.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 ;; User Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (defvar ps-lpr-command lpr-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 "*The shell command for printing a PostScript file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (defvar ps-lpr-switches lpr-switches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 "*A list of extra switches to pass to `ps-lpr-command'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (defvar ps-spool-duplex nil ; Not many people have duplex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 ; printers, so default to nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 "*Non-nil indicates spooling is for a two-sided printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 For a duplex printer, the `ps-spool-*' commands will insert blank pages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 as needed between print jobs so that the next buffer printed will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 start on the right page. Also, if headers are turned on, the headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 will be reversed on duplex printers so that the page numbers fall to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 the left on even-numbered pages.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (defvar ps-paper-type 'ps-letter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 "*Specifies the size of paper to format for. Should be one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 `ps-letter', `ps-legal', or `ps-a4'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (defvar ps-print-header t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 "*Non-nil means print a header at the top of each page.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 By default, the header displays the buffer name, page number, and, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 the buffer is visiting a file, the file's directory. Headers are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 customizable by changing variables `ps-header-left' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 `ps-header-right'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (defvar ps-print-header-frame t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 "*Non-nil means draw a gaudy frame around the header.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (defvar ps-show-n-of-n t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 "*Non-nil means show page numbers as N/M, meaning page N of M.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 Note: page numbers are displayed as part of headers, see variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 `ps-print-headers'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (defvar ps-print-color-p (and (or (fboundp 'x-color-values) ; fsf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (fboundp 'color-instance-rgb-components))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 ; xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (fboundp 'float))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 ; Printing color requires both floating point and x-color-values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 "*If non-nil, print the buffer's text in color.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (defvar ps-default-fg '(0.0 0.0 0.0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 "*RGB values of the default foreground color. Defaults to black.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (defvar ps-default-bg '(1.0 1.0 1.0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 "*RGB values of the default background color. Defaults to white.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (defvar ps-font-size 10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 "*Font size, in points, for generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (defvar ps-font "Courier"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 "*Font family name for ordinary text, when generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (defvar ps-font-bold "Courier-Bold"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 "*Font family name for bold text, when generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (defvar ps-font-italic "Courier-Oblique"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 "*Font family name for italic text, when generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (defvar ps-font-bold-italic "Courier-BoldOblique"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 "*Font family name for bold italic text, when generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (defvar ps-avg-char-width (if (fboundp 'float) 5.6 6)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 "*The average width, in points, of a character, for generating Postscript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 This is the value that ps-print uses to determine the length,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 x-dimension, of the text it has printed, and thus affects the point at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 which long lines wrap around. If you change the font or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 font size, you will probably have to adjust this value to match.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (defvar ps-space-width (if (fboundp 'float) 5.6 6)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 "*The width of a space character, for generating Postscript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 This value is used in expanding tab characters.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (defvar ps-line-height (if (fboundp 'float) 11.29 11)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 "*The height of a line, for generating Postscript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 This is the value that ps-print uses to determine the height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 y-dimension, of the lines of text it has printed, and thus affects the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 point at which page-breaks are placed. If you change the font or font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 size, you will probably have to adjust this value to match. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 line-height is *not* the same as the point size of the font.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (defvar ps-auto-font-detect t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 "*Non-nil means automatically detect bold/italic face attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 nil means rely solely on the lists `ps-bold-faces', `ps-italic-faces',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 and `ps-underlined-faces'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (defvar ps-bold-faces '()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 "*A list of the \(non-bold\) faces that should be printed in bold font.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 This applies to generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (defvar ps-italic-faces '()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 "*A list of the \(non-italic\) faces that should be printed in italic font.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 This applies to generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (defvar ps-underlined-faces '()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 "*A list of the \(non-underlined\) faces that should be printed underlined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 This applies to generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (defvar ps-header-lines 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 "*Number of lines to display in page header, when generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (make-variable-buffer-local 'ps-header-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (defvar ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (list 'ps-get-buffer-name 'ps-header-dirpart)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 "*The items to display on the right part of the page header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 This applies to generating Postscript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 The value should be a list of strings and symbols, each representing an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 entry in the PostScript array HeaderLinesLeft.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 Strings are inserted unchanged into the array; those representing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 PostScript string literals should be delimited with PostScript string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 delimiters '(' and ')'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 For symbols with bound functions, the function is called and should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 return a string to be inserted into the array. For symbols with bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 values, the value should be a string to be inserted into the array.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 In either case, function or variable, the string value has PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 string delimiters added to it.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (make-variable-buffer-local 'ps-left-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (defvar ps-right-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (list "/pagenumberstring load" 'time-stamp-yy/mm/dd 'time-stamp-hh:mm:ss)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 "*The items to display on the left part of the page header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 This applies to generating Postscript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 See the variable `ps-left-header' for a description of the format of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 this variable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (make-variable-buffer-local 'ps-right-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (defvar ps-razzle-dazzle t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 "*Non-nil means report progress while formatting buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (defvar ps-adobe-tag "%!PS-Adobe-1.0\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 "*Contains the header line identifying the output as PostScript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 By default, `ps-adobe-tag' contains the standard identifier. Some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 printers require slightly different versions of this line.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (defvar ps-build-face-reference t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 "*Non-nil means build the reference face lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 Ps-print sets this value to nil after it builds its internal reference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 lists of bold and italic faces. By settings its value back to t, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 can force ps-print to rebuild the lists the next time you invoke one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 of the ...-with-faces commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 You should set this value back to t after you change the attributes of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 any face, or create new faces. Most users shouldn't have to worry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 about its setting, though.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (defvar ps-always-build-face-reference nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 "*Non-nil means always rebuild the reference face lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 If this variable is non-nil, ps-print will rebuild its internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 reference lists of bold and italic faces *every* time one of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 -with-faces commands is called. Most users shouldn't need to set this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 variable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 ;; User commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (defun ps-print-buffer (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 "Generate and print a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 When called with a numeric prefix argument (C-u), prompts the user for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 the name of a file to save the PostScript image in, instead of sending
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 it to the printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 More specifically, the FILENAME argument is treated as follows: if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 is nil, send the image to the printer. If FILENAME is a string, save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 the PostScript image in a file with that name. If FILENAME is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 number, prompt the user for the name of the file to save in."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (interactive (list (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 'ps-generate-postscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (defun ps-print-buffer-with-faces (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 "Generate and print a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 Like `ps-print-buffer', but includes font, color, and underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 information in the generated image."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (interactive (list (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 'ps-generate-postscript-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (defun ps-print-region (from to &optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 "Generate and print a PostScript image of the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 Like `ps-print-buffer', but prints just the current region."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 'ps-generate-postscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (defun ps-print-region-with-faces (from to &optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 "Generate and print a PostScript image of the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 Like `ps-print-region', but includes font, color, and underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 information in the generated image."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 'ps-generate-postscript-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (defun ps-spool-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 "Generate and spool a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 Like `ps-print-buffer' except that the PostScript image is saved in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 local buffer to be sent to the printer later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 'ps-generate-postscript))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (defun ps-spool-buffer-with-faces ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 "Generate and spool a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 Like `ps-spool-buffer', but includes font, color, and underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 information in the generated image.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 'ps-generate-postscript-with-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 (defun ps-spool-region (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 "Generate a PostScript image of the region and spool locally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 Like `ps-spool-buffer', but spools just the current region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 'ps-generate-postscript))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (defun ps-spool-region-with-faces (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 "Generate a PostScript image of the region and spool locally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 Like `ps-spool-region', but includes font, color, and underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 information in the generated image.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 'ps-generate-postscript-with-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (defun ps-despool (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 "Send the spooled PostScript to the printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 When called with a numeric prefix argument (C-u), prompt the user for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 the name of a file to save the spooled PostScript in, instead of sending
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 it to the printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 More specifically, the FILENAME argument is treated as follows: if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 is nil, send the image to the printer. If FILENAME is a string, save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 the PostScript image in a file with that name. If FILENAME is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 number, prompt the user for the name of the file to save in."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (interactive (list (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 ;; Utility functions and variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (defvar ps-print-emacs-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (cond ((string-match "XEmacs" emacs-version) 'xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 ((string-match "Lucid" emacs-version) 'lucid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 ((string-match "Epoch" emacs-version) 'epoch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (t 'emacs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (if (or (eq ps-print-emacs-type 'lucid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (eq ps-print-emacs-type 'xemacs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (if (< emacs-minor-version 12)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (setq ps-print-color-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (require 'faces)) ; face-font, face-underline-p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 ; x-font-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (defun xemacs-color-device ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (if (and (eq ps-print-emacs-type 'xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (>= emacs-minor-version 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (eq (device-class) 'color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (require 'time-stamp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (defvar ps-print-prologue "% ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 % If the ISOLatin1Encoding vector isn't known, define it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 /ISOLatin1Encoding where { pop } {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 % Define the ISO Latin-1 encoding vector.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 % The first half is the same as the standard encoding,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 % except for minus instead of hyphen at code 055.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 /ISOLatin1Encoding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 StandardEncoding 0 45 getinterval aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 /minus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 StandardEncoding 46 82 getinterval aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 %*** NOTE: the following are missing in the Adobe documentation,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 %*** but appear in the displayed table:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 %*** macron at 0225, dieresis at 0230, cedilla at 0233, space at 0240.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 % \20x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 % \24x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 /space /exclamdown /cent /sterling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 /currency /yen /brokenbar /section
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 /dieresis /copyright /ordfeminine /guillemotleft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 /logicalnot /hyphen /registered /macron
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 /degree /plusminus /twosuperior /threesuperior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 /acute /mu /paragraph /periodcentered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 /cedilla /onesuperior /ordmasculine /guillemotright
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 /onequarter /onehalf /threequarters /questiondown
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 % \30x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 /Agrave /Aacute /Acircumflex /Atilde
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 /Adieresis /Aring /AE /Ccedilla
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 /Egrave /Eacute /Ecircumflex /Edieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 /Igrave /Iacute /Icircumflex /Idieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 /Eth /Ntilde /Ograve /Oacute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 /Ocircumflex /Otilde /Odieresis /multiply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 /Oslash /Ugrave /Uacute /Ucircumflex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 /Udieresis /Yacute /Thorn /germandbls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 % \34x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 /agrave /aacute /acircumflex /atilde
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 /adieresis /aring /ae /ccedilla
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 /egrave /eacute /ecircumflex /edieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 /igrave /iacute /icircumflex /idieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 /eth /ntilde /ograve /oacute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 /ocircumflex /otilde /odieresis /divide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 /oslash /ugrave /uacute /ucircumflex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 /udieresis /yacute /thorn /ydieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 256 packedarray def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 } ifelse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 /reencodeFontISO { %def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 dup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 length 5 add dict % Make a new font (a new dict
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 % the same size as the old
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 % one) with room for our new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 % symbols.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 begin % Make the new font the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 % current dictionary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 { 1 index /FID ne
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 { def } { pop pop } ifelse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 } forall % Copy each of the symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 % from the old dictionary to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 % the new except for the font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 % ID.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 /Encoding ISOLatin1Encoding def % Override the encoding with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 % the ISOLatin1 encoding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 % Use the font's bounding box to determine the ascent, descent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 % and overall height; don't forget that these values have to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 % transformed using the font's matrix.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 FontBBox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 FontMatrix transform /Ascent exch def pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 FontMatrix transform /Descent exch def pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 /FontHeight Ascent Descent sub def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 % Define these in case they're not in the FontInfo (also, here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 % they're easier to get to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 /UnderlinePosition 1 def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 /UnderlineThickness 1 def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 % Get the underline position and thickness if they're defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 currentdict /FontInfo known {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 FontInfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 dup /UnderlinePosition known {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 dup /UnderlinePosition get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 0 exch FontMatrix transform exch pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 /UnderlinePosition exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 dup /UnderlineThickness known {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 /UnderlineThickness get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 0 exch FontMatrix transform exch pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 /UnderlineThickness exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 currentdict % Leave the new font on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 % stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 end % Stop using the font as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 % current dictionary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 definefont % Put the font into the font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 % dictionary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 pop % Discard the returned font.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 } bind def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 /Font {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 findfont exch scalefont reencodeFontISO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 /F { % Font select
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 findfont
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 dup /Ascent get /Ascent exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 dup /Descent get /Descent exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 dup /FontHeight get /FontHeight exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 dup /UnderlinePosition get /UnderlinePosition exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 dup /UnderlineThickness get /UnderlineThickness exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 setfont
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 /FG /setrgbcolor load def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 /bg false def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 /BG {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 dup /bg exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 { mark 4 1 roll ] /bgcolor exch def } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 /dobackground { % width --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 currentpoint
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 newpath
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 0 Ascent rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 dup 0 rlineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 0 Descent Ascent sub rlineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 neg 0 rlineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 closepath
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 bgcolor aload pop setrgbcolor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 fill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 /dobackgroundstring { % string --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 stringwidth pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 dobackground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 /dounderline { % fromx fromy --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 currentpoint
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 UnderlineThickness setlinewidth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 4 2 roll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 UnderlinePosition add moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 UnderlinePosition add lineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 stroke
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 /eolbg {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 currentpoint pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 PrintWidth LeftMargin add exch sub dobackground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 /eolul {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 currentpoint exch pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 PrintWidth LeftMargin add exch dounderline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 /SL { % Soft Linefeed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 bg { eolbg } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 ul { eolul } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 currentpoint LineHeight sub LeftMargin exch moveto pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 /HL /SL load def % Hard Linefeed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 /sp1 { currentpoint 3 -1 roll } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 % Some debug
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 /dcp { currentpoint exch 40 string cvs print (, ) print = } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 /dp { print 2 copy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 exch 40 string cvs print (, ) print = } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 /S {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 bg { dup dobackgroundstring } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 ul { sp1 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 ul { dounderline } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 /W {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 ul { sp1 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ( ) stringwidth % Get the width of a space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 pop % Discard the Y component
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 mul % Multiply the width of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 % space by the number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 % spaces to plot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 bg { dup dobackground } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 0 rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 ul { dounderline } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 /BeginDSCPage {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 /vmstate save def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 /BeginPage {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 PrintHeader {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 PrintHeaderFrame { HeaderFrame } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 HeaderText
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 LeftMargin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 BottomMargin PrintHeight add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 moveto % move to where printing will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 % start.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 /EndPage {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 bg { eolbg } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 ul { eolul } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 showpage % Spit out a page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 /EndDSCPage {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 vmstate restore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 /ul false def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 /UL { /ul exch def } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 /h0 14 /Helvetica-Bold Font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 /h1 12 /Helvetica Font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 /h1 F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 /HeaderLineHeight FontHeight def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 /HeaderDescent Descent def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 /HeaderPad 2 def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 /SetHeaderLines {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 /HeaderOffset TopMargin 2 div def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 /HeaderLines exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 /HeaderHeight HeaderLines HeaderLineHeight mul HeaderPad 2 mul add def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 /PrintHeight PrintHeight HeaderHeight sub def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 /HeaderFrameStart {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 LeftMargin BottomMargin PrintHeight add HeaderOffset add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 /HeaderFramePath {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 PrintWidth 0 rlineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 0 HeaderHeight rlineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 PrintWidth neg 0 rlineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 0 HeaderHeight neg rlineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 /HeaderFrame {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 0.4 setlinewidth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 HeaderFrameStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 1 -1 rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 HeaderFramePath
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 0 setgray fill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 HeaderFrameStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 HeaderFramePath
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 gsave 0.9 setgray fill grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 gsave 0 setgray stroke grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 /HeaderStart {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 HeaderFrameStart
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 exch HeaderPad add exch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 HeaderLineHeight HeaderLines 1 sub mul add HeaderDescent sub HeaderPad add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 /strcat {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 dup length 3 -1 roll dup length dup 4 -1 roll add string dup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 0 5 -1 roll putinterval
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 dup 4 2 roll exch putinterval
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 /pagenumberstring {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 PageNumber 32 string cvs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 ShowNofN {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (/) strcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 PageCount 32 string cvs strcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 /HeaderText {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 HeaderStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 HeaderLinesRight HeaderLinesLeft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 Duplex PageNumber 1 and 0 eq and { exch } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 exch F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 dup xcheck { exec } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 0 HeaderLineHeight neg rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 } forall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 HeaderStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 exch F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 dup xcheck { exec } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 dup stringwidth pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 PrintWidth exch sub HeaderPad 2 mul sub 0 rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 0 HeaderLineHeight neg rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 } forall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 /ReportFontInfo {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 2 copy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 /t0 3 1 roll Font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 /t0 F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 /lh FontHeight def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 /sw ( ) stringwidth pop def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 /aw (01234567890abcdefghijklmnopqrstuvwxyz) dup length exch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 stringwidth pop exch div def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 /t1 12 /Helvetica-Oblique Font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 /t1 F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 72 72 moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (For ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 128 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 ( ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 32 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 ( point, the line height is ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 lh 32 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (, the space width is ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 sw 32 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (,) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 0 FontHeight neg rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (and a crude estimate of average character width is ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 aw 32 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (.) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 showpage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 % 10 /Courier ReportFontInfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 ;; Start Editing Here:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (defvar ps-source-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (defvar ps-spool-buffer-name "*PostScript*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (defvar ps-spool-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (defvar ps-output-head nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (defvar ps-output-tail nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (defvar ps-page-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (defvar ps-showpage-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (defvar ps-current-font 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (defvar ps-current-underline-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (defvar ps-default-color (if ps-print-color-p ps-default-fg)) ; black
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (defvar ps-current-color ps-default-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (defvar ps-current-bg nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 (defvar ps-razchunk 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (defvar ps-color-format (if (eq ps-print-emacs-type 'emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 ;;Emacs understands the %f format; we'll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 ;;use it to limit color RGB values to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 ;;three decimals to cut down some on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 ;;size of the PostScript output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 "%0.3f %0.3f %0.3f"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 ;; Lucid emacsen will have to make do with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 ;; %s (princ) for floats.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 "%s %s %s"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 ;; These values determine how much print-height to deduct when headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 ;; are turned on. This is a pretty clumsy way of handling it, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 ;; it'll do for now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (defvar ps-header-title-line-height (if (fboundp 'float) 16.0 16));Helvetica 14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (defvar ps-header-line-height (if (fboundp 'float) 13.7 14));Helvetica 12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (defvar ps-header-pad 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 ;; LetterSmall 7.68 inch 10.16 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 ;; Tabloid 11.0 inch 17.0 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 ;; Ledger 17.0 inch 11.0 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 ;; Statement 5.5 inch 8.5 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 ;; Executive 7.5 inch 10.0 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 ;; A3 11.69 inch 16.5 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 ;; A4Small 7.47 inch 10.85 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 ;; B4 10.125 inch 14.33 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 ;; B5 7.16 inch 10.125 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 ;; All page dimensions are in PostScript points.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (defvar ps-left-margin 72) ; 1 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (defvar ps-right-margin 72) ; 1 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (defvar ps-bottom-margin 36) ; 1/2 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (defvar ps-top-margin 72) ; 1 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 ;; Letter 8.5 inch x 11.0 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (defvar ps-letter-page-height 792) ; 11 inches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (defvar ps-letter-page-width 612) ; 8.5 inches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 ;; Legal 8.5 inch x 14.0 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (defvar ps-legal-page-height 1008) ; 14.0 inches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (defvar ps-legal-page-width 612) ; 8.5 inches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 ;; A4 8.26 inch x 11.69 inch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (defvar ps-a4-page-height 842) ; 11.69 inches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (defvar ps-a4-page-width 595) ; 8.26 inches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (defvar ps-pages-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (list (list 'ps-letter ps-letter-page-width ps-letter-page-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (list 'ps-legal ps-legal-page-width ps-legal-page-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (list 'ps-a4 ps-a4-page-width ps-a4-page-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 ;; Define some constants to index into the page lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 (defvar ps-page-width-i 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 (defvar ps-page-height-i 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (defvar ps-page-dimensions nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 (defvar ps-print-width nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 (defvar ps-print-height nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 (defvar ps-height-remaining)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 (defvar ps-width-remaining)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (defvar ps-ref-bold-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 (defvar ps-ref-italic-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 (defvar ps-ref-underlined-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 ;; Internal functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (defun ps-get-page-dimensions ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 (setq ps-page-dimensions (assq ps-paper-type ps-pages-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (let ((ps-page-width (nth ps-page-width-i ps-page-dimensions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 (ps-page-height (nth ps-page-height-i ps-page-dimensions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (setq ps-print-height (- ps-page-height ps-top-margin ps-bottom-margin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (setq ps-print-width (- ps-page-width ps-left-margin ps-right-margin))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (defun ps-print-preprint (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (if (and filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 (or (numberp filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 (listp filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (let* ((name (concat (buffer-name) ".ps"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 (prompt (format "Save PostScript to file: (default %s) "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (read-file-name prompt default-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 name nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 ;; The following functions implement a simple list-buffering scheme so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 ;; that ps-print doesn't have to repeatedly switch between buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 ;; while spooling. The functions ps-output and ps-output-string build
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 ;; up the lists; the function ps-flush-output takes the lists and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 ;; insert its contents into the spool buffer (*PostScript*).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 (defun ps-output-string-prim (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 (insert "(") ;insert start-string delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 (save-excursion ;insert string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (insert string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 ;; Find and quote special characters as necessary for PS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 (while (re-search-forward "[()\\]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (insert "\\")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (insert ")")) ;insert end-string delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (defun ps-init-output-queue ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (setq ps-output-head (list ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 (setq ps-output-tail ps-output-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 (defun ps-output (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 (setcdr ps-output-tail args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 (while (cdr ps-output-tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 (setq ps-output-tail (cdr ps-output-tail))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (defun ps-output-string (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 (ps-output t string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (defun ps-flush-output ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (while ps-output-head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (let ((it (car ps-output-head)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 (if (not (eq t it))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (insert it)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (setq ps-output-head (cdr ps-output-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (ps-output-string-prim (car ps-output-head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (setq ps-output-head (cdr ps-output-head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (ps-init-output-queue))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (defun ps-insert-file (fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 ;; Check to see that the file exists and is readable; if not, throw
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 ;; and error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (if (not (file-readable-p fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (error "Could not read file `%s'" fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (insert-file fname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 ;; These functions insert the arrays that define the contents of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 ;; headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (defun ps-generate-header-line (fonttag &optional content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (ps-output " [ " fonttag " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 ;; Literal strings should be output as is -- the string must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 ;; contain its own PS string delimiters, '(' and ')', if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 ((stringp content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 (ps-output content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 ;; Functions are called -- they should return strings; they will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 ;; inserted as strings and the PS string delimiters added.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 ((and (symbolp content) (fboundp content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (ps-output-string (funcall content)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 ;; Variables will have their contents inserted. They should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 ;; contain strings, and will be inserted as strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 ((and (symbolp content) (boundp content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (ps-output-string (symbol-value content)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 ;; Anything else will get turned into an empty string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (ps-output-string "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (ps-output " ]\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (defun ps-generate-header (name contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (ps-output "/" name " [\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (if (> ps-header-lines 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 (let ((count 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (ps-generate-header-line "/h0" (car contents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 (while (and (< count ps-header-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (setq contents (cdr contents)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (ps-generate-header-line "/h1" (car contents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 (setq count (+ count 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (ps-output "] def\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (defun ps-output-boolean (name bool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 (ps-output (format "/%s %s def\n" name (if bool "true" "false"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (defun ps-begin-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 (setq ps-showpage-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 (ps-output ps-adobe-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 (ps-output "%%Title: " (buffer-name) "\n") ;Take job name from name of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 ;first buffer printed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 (ps-output "%%Creator: " (user-full-name) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 (ps-output "%%CreationDate: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 (time-stamp-hh:mm:ss) " " (time-stamp-mon-dd-yyyy) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (ps-output "%% DocumentFonts: Helvetica Helvetica-Bold "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 ps-font " " ps-font-bold " " ps-font-italic " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 ps-font-bold-italic "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 (ps-output "%%Pages: (atend)\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 (ps-output "%%EndComments\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (ps-output-boolean "Duplex" ps-spool-duplex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 (ps-output-boolean "PrintHeader" ps-print-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 (ps-output-boolean "PrintHeaderFrame" ps-print-header-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 (ps-output-boolean "ShowNofN" ps-show-n-of-n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (ps-output (format "/LeftMargin %d def\n" ps-left-margin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 (ps-output (format "/RightMargin %d def\n" ps-right-margin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (ps-output (format "/BottomMargin %d def\n" ps-bottom-margin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (ps-output (format "/TopMargin %d def\n" ps-top-margin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 (ps-get-page-dimensions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (ps-output (format "/PrintWidth %d def\n" ps-print-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 (ps-output (format "/PrintHeight %d def\n" ps-print-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 (ps-output (format "/LineHeight %s def\n" ps-line-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 (ps-output ps-print-prologue)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (ps-output (format "/f0 %d /%s Font\n" ps-font-size ps-font))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (ps-output (format "/f1 %d /%s Font\n" ps-font-size ps-font-bold))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (ps-output (format "/f2 %d /%s Font\n" ps-font-size ps-font-italic))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 (ps-output (format "/f3 %d /%s Font\n" ps-font-size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 ps-font-bold-italic))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (ps-output "%%EndPrologue\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 (defun ps-header-dirpart ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 (let ((fname (buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 (if fname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 (if (string-equal (buffer-name) (file-name-nondirectory fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 (file-name-directory fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 (defun ps-get-buffer-name ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 ;; Indulge me this little easter egg:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 (if (string= (buffer-name) "ps-print.el")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 "Hey, Cool! It's ps-print.el!!!"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (defun ps-begin-job ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (setq ps-page-count 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (defun ps-end-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (ps-output "%%Trailer\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 (ps-output "%%Pages: " (format "%d\n" ps-showpage-count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (defun ps-next-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 (ps-end-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (ps-begin-page))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (defun ps-begin-page (&optional dummypage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (ps-get-page-dimensions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (setq ps-width-remaining ps-print-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (setq ps-height-remaining ps-print-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 ;; If headers are turned on, deduct the height of the header from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 ;; the print height remaining. Clumsy clumsy clumsy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (if ps-print-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 (setq ps-height-remaining
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 (- ps-height-remaining
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 ps-header-title-line-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (* ps-header-line-height (- ps-header-lines 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 (* 2 ps-header-pad))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (setq ps-page-count (+ ps-page-count 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 (ps-output "\n%%Page: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 (format "%d %d\n" ps-page-count (+ 1 ps-showpage-count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (ps-output "BeginDSCPage\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 (ps-output (format "/PageNumber %d def\n" ps-page-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 (ps-output "/PageCount 0 def\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 (if ps-print-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 (ps-generate-header "HeaderLinesLeft" ps-left-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 (ps-generate-header "HeaderLinesRight" ps-right-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (ps-output (format "%d SetHeaderLines\n" ps-header-lines))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (ps-output "BeginPage\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (ps-set-font ps-current-font)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (ps-set-bg ps-current-bg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 (ps-set-color ps-current-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 (ps-set-underline ps-current-underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 (defun ps-end-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (setq ps-showpage-count (+ 1 ps-showpage-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 (ps-output "EndPage\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (ps-output "EndDSCPage\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (defun ps-dummy-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (setq ps-showpage-count (+ 1 ps-showpage-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (ps-output "%%Page: " (format "- %d\n" ps-showpage-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 "BeginDSCPage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 /PrintHeader false def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 BeginPage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 EndPage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 EndDSCPage\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 (defun ps-next-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 (if (< ps-height-remaining ps-line-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 (ps-next-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 (setq ps-width-remaining ps-print-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 (setq ps-height-remaining (- ps-height-remaining ps-line-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 (ps-hard-lf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 (defun ps-continue-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 (if (< ps-height-remaining ps-line-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 (ps-next-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 (setq ps-width-remaining ps-print-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 (setq ps-height-remaining (- ps-height-remaining ps-line-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 (ps-soft-lf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 (defun ps-hard-lf ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 (ps-output "HL\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 (defun ps-soft-lf ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 (ps-output "SL\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 (defun ps-find-wrappoint (from to char-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (let ((avail (truncate (/ ps-width-remaining char-width)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (todo (- to from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 (if (< todo avail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 (cons to (* todo char-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (cons (+ from avail) ps-width-remaining))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 (defun ps-basic-plot-string (from to &optional bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (let* ((wrappoint (ps-find-wrappoint from to ps-avg-char-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 (to (car wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 (string (buffer-substring from to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 (ps-output-string string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 (ps-output " S\n") ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 (defun ps-basic-plot-whitespace (from to &optional bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 (let* ((wrappoint (ps-find-wrappoint from to ps-space-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 (to (car wrappoint)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 (ps-output (format "%d W\n" (- to from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 (defun ps-plot (plotfunc from to &optional bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 (while (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 (let* ((wrappoint (funcall plotfunc from to bg-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 (plotted-to (car wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 (plotted-width (cdr wrappoint)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 (setq from plotted-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 (setq ps-width-remaining (- ps-width-remaining plotted-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 (if (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 (ps-continue-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 (let* ((q-todo (- (point-max) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 (q-done (- (point) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (chunkfrac (/ q-todo 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 (chunksize (if (> chunkfrac 1000) 1000 chunkfrac)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 (if (> (- q-done ps-razchunk) chunksize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 (let (foo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (setq ps-razchunk q-done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 (setq foo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 (if (< q-todo 100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 (/ (* 100 q-done) q-todo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 (/ q-done (/ q-todo 100))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 (message "Formatting...%d%%" foo))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 (defun ps-set-font (font)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 (setq ps-current-font font)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 (ps-output (format "/f%d F\n" ps-current-font)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 (defvar ps-print-color-scale nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 (defun ps-set-bg (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 (if (setq ps-current-bg color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 (ps-output (format ps-color-format (nth 0 color) (nth 1 color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 (nth 2 color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 " true BG\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 (ps-output "false BG\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (defun ps-set-color (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 (if (setq ps-current-color color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 (setq ps-current-color ps-default-fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 (ps-output (format ps-color-format (nth 0 ps-current-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 (nth 1 ps-current-color) (nth 2 ps-current-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 " FG\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (defun ps-set-underline (underline-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (ps-output (if underline-p "true" "false") " UL\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (setq ps-current-underline-p underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 (defun ps-plot-region (from to font fg-color &optional bg-color underline-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 (if (not (equal font ps-current-font))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 (ps-set-font font))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ;; Specify a foreground color only if one's specified and it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 ;; different than the current.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 (if (not (equal fg-color ps-current-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (ps-set-color fg-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 (if (not (equal bg-color ps-current-bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 (ps-set-bg bg-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 ;; Toggle underlining if different.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (if (not (equal underline-p ps-current-underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 (ps-set-underline underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 ;; Starting at the beginning of the specified region...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 (goto-char from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 ;; ...break the region up into chunks separated by tabs, linefeeds,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 ;; and pagefeeds, and plot each chunk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 (while (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 (if (re-search-forward "[\t\n\f]" to t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 (let ((match (char-after (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 ((= match ?\t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 (let ((linestart
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 (save-excursion (beginning-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 (ps-plot 'ps-basic-plot-string from (- (point) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 (setq from (+ linestart (current-column)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 (if (re-search-forward "[ \t]+" to t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 (ps-plot 'ps-basic-plot-whitespace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 from (+ linestart (current-column))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 bg-color))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 ((= match ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 (ps-plot 'ps-basic-plot-string from (- (point) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 (ps-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 ((= match ?\f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 (ps-plot 'ps-basic-plot-string from (- (point) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 (ps-next-page)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 (setq from (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 (ps-plot 'ps-basic-plot-string from to bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 (setq from to)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 (defun ps-color-value (x-color-value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 ;; Scale 16-bit X-COLOR-VALUE to PostScript color value in [0, 1] interval.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 (/ x-color-value ps-print-color-scale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 (defun ps-color-values (x-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 (cond ((fboundp 'x-color-values)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 (x-color-values x-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 ((and (fboundp 'color-instance-rgb-components)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 (xemacs-color-device))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 (color-instance-rgb-components
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 (if (color-instance-p x-color) x-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 (if (color-specifier-p x-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 (make-color-instance (color-name x-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 (make-color-instance x-color)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 (t (error "No available function to determine X color values."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 (defun ps-face-attributes (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 (let ((differs (face-differs-from-default-p face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 (list (memq face ps-ref-bold-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 (memq face ps-ref-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 (memq face ps-ref-underlined-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 (and differs (face-foreground face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 (and differs (face-background face)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 (defun ps-face-attribute-list (face-or-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 (if (listp face-or-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 (let (bold-p italic-p underline-p foreground background face-attr face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 (while face-or-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 (setq face (car face-or-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 (setq face-attr (ps-face-attributes face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 (setq bold-p (or bold-p (nth 0 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 (setq italic-p (or italic-p (nth 1 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 (setq underline-p (or underline-p (nth 2 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 (if foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (setq foreground (nth 3 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 (if background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (setq background (nth 4 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 (setq face-or-list (cdr face-or-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 (list bold-p italic-p underline-p foreground background))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 (ps-face-attributes face-or-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 (defun ps-plot-with-face (from to face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 (if face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 (let* ((face-attr (ps-face-attribute-list face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 (bold-p (nth 0 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 (italic-p (nth 1 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 (underline-p (nth 2 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 (foreground (nth 3 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 (background (nth 4 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 (fg-color (if (and ps-print-color-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 (xemacs-color-device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 foreground)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 (mapcar 'ps-color-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 (ps-color-values foreground))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 ps-default-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 (bg-color (if (and ps-print-color-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 (xemacs-color-device)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 background)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 (mapcar 'ps-color-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 (ps-color-values background)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 (ps-plot-region from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 (cond ((and bold-p italic-p) 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 (italic-p 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 (bold-p 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 (t 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 ; (or fg-color '(0.0 0.0 0.0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 fg-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 bg-color underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 (goto-char to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 (defun ps-emacs-face-kind-p (face kind kind-regex kind-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 (let ((frame-font (face-font face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 (face-defaults (face-font face t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 ;; Check FACE defaults:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 (and (listp face-defaults)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 (memq kind face-defaults))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 ;; Check the user's preferences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 (memq face kind-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 (defun ps-xemacs-face-kind-p (face kind kind-regex kind-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 (let* ((frame-font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 (or (face-font-instance face) (face-font-instance 'default)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (kind-cons (and frame-font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 (assq kind (font-instance-properties frame-font))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 (kind-spec (cdr-safe kind-cons))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 (case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 (or (and kind-spec (string-match kind-regex kind-spec))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 ;; Kludge-compatible:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 (memq face kind-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 (defun ps-face-bold-p (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 (if (eq ps-print-emacs-type 'emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 (ps-emacs-face-kind-p face 'bold "-\\(bold\\|demibold\\)-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 ps-bold-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 ps-bold-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 (defun ps-face-italic-p (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 (if (eq ps-print-emacs-type 'emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 (ps-emacs-face-kind-p face 'italic "-[io]-" ps-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o" ps-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 (ps-xemacs-face-kind-p face 'SLANT "i\\|o" ps-italic-faces))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 (defun ps-face-underlined-p (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 (or (face-underline-p face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 (memq face ps-underlined-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 ;; Ensure that face-list is fbound.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 (or (fboundp 'face-list) (defalias 'face-list 'list-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 (defun ps-build-reference-face-lists ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 (if ps-auto-font-detect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 (let ((faces (face-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 (setq ps-ref-bold-faces nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 ps-ref-italic-faces nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 ps-ref-underlined-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 (while faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 (setq the-face (car faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 (if (ps-face-italic-p the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (setq ps-ref-italic-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 (cons the-face ps-ref-italic-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 (if (ps-face-bold-p the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 (setq ps-ref-bold-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 (cons the-face ps-ref-bold-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 (if (ps-face-underlined-p the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 (setq ps-ref-underlined-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 (cons the-face ps-ref-underlined-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 (setq faces (cdr faces))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 (setq ps-ref-bold-faces ps-bold-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 (setq ps-ref-italic-faces ps-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 (setq ps-ref-underlined-faces ps-underlined-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 (setq ps-build-face-reference nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 (defun ps-mapper (extent list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 (nconc list (list (list (extent-start-position extent) 'push extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 (list (extent-end-position extent) 'pull extent)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 (defun ps-sorter (a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 (< (car a) (car b)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 (defun ps-extent-sorter (a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 (< (extent-priority a) (extent-priority b)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 (defun ps-print-ensure-fontified (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 (if (and (boundp 'lazy-lock-mode) lazy-lock-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 (if (fboundp 'lazy-lock-fontify-region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 (lazy-lock-fontify-region start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 (lazy-lock-fontify-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 (defun ps-generate-postscript-with-faces (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 ;; Build the reference lists of faces if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 (if (or ps-always-build-face-reference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 ps-build-face-reference)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 (message "Collecting face information...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 (ps-build-reference-face-lists)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 ;; Set the color scale. We do it here instead of in the defvar so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 ;; that ps-print can be dumped into emacs. This expression can't be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 ;; evaluated at dump-time because X isn't initialized.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 (setq ps-print-color-scale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 (if (and ps-print-color-p (xemacs-color-device))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 (float (car (ps-color-values "white")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 1.0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 ;; Generate some PostScript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 (narrow-to-region from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (let ((face 'default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 (position to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 (ps-print-ensure-fontified from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 (cond ((or (eq ps-print-emacs-type 'lucid) (eq ps-print-emacs-type 'xemacs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 ;; Build the list of extents...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 (let ((a (cons 'dummy nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 record type extent extent-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 (map-extents 'ps-mapper nil from to a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 (setq a (cdr a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 (setq a (sort a 'ps-sorter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 (setq extent-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 ;; Loop through the extents...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 (while a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 (setq record (car a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 (setq position (car record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 (setq record (cdr record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 (setq type (car record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 (setq record (cdr record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 (setq extent (car record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 ;; Plot up to this record.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 ;; XEmacs 19.12: for some reason, we're getting into a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 ;; situation in which some of the records have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 ;; positions less than 'from'. Since we've narrowed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 ;; the buffer, this'll generate errors. This is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 ;; hack, but don't call ps-plot-with-face unless from >
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 ;; point-min.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 (if (and (>= from (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 (<= position (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 (ps-plot-with-face from position face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 ((eq type 'push)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 (if (extent-face extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 (setq extent-list (sort (cons extent extent-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 'ps-extent-sorter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 ((eq type 'pull)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (setq extent-list (sort (delq extent extent-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 'ps-extent-sorter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 (setq face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 (if extent-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 (extent-face (car extent-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 'default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 (setq from position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (setq a (cdr a)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 ((eq ps-print-emacs-type 'emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 (let ((property-change from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 (overlay-change from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (while (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 (if (< property-change to) ; Don't search for property change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 ; unless previous search succeeded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 (setq property-change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 (next-property-change from nil to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 (if (< overlay-change to) ; Don't search for overlay change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 ; unless previous search succeeded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 (setq overlay-change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 (min (next-overlay-change from) to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 (setq position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (min property-change overlay-change))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 (setq face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 (cond ((get-text-property from 'invisible) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 ((get-text-property from 'face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 (t 'default)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 (let ((overlays (overlays-at from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (face-priority -1)) ; text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 (while overlays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 (let* ((overlay (car overlays))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 (overlay-face (overlay-get overlay 'face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 (overlay-invisible (overlay-get overlay 'invisible))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 (overlay-priority (or (overlay-get overlay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 'priority)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (if (and (or overlay-invisible overlay-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (> overlay-priority face-priority))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (setq face (cond (overlay-invisible nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 ((and face overlay-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 face-priority overlay-priority)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 (setq overlays (cdr overlays))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 ;; Plot up to this record.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 (ps-plot-with-face from position face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 (setq from position)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 (ps-plot-with-face from to face))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (defun ps-generate-postscript (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (ps-plot-region from to 0 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 (defun ps-generate (buffer from to genfunc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 (let ((from (min to from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 (to (max to from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 (narrow-to-region from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 (message "Formatting...%d%%" (setq ps-razchunk 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 (setq ps-source-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (setq ps-spool-buffer (get-buffer-create ps-spool-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 (ps-init-output-queue)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 (let (safe-marker completed-safely needs-begin-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 ;; Get a marker and make it point to the current end of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 ;; buffer, If an error occurs, we'll delete everything from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 ;; the end of this marker onwards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 (setq safe-marker (make-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (set-marker safe-marker (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 (if (looking-at (regexp-quote "%!PS-Adobe-1.0"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 (setq needs-begin-file t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 (set-buffer ps-source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 (if needs-begin-file (ps-begin-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 (ps-begin-job)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 (ps-begin-page))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 (set-buffer ps-source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 (funcall genfunc from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 (ps-end-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 (if (and ps-spool-duplex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 (= (mod ps-page-count 2) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 (ps-dummy-page))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 ;; Back to the PS output buffer to set the page count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 (while (re-search-backward "^/PageCount 0 def$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (replace-match (format "/PageCount %d def" ps-page-count) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 ;; Setting this variable tells the unwind form that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 ;; the postscript was generated without error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 (setq completed-safely t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 ;; Unwind form: If some bad mojo ocurred while generating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 ;; postscript, delete all the postscript that was generated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 ;; This protects the previously spooled files from getting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 ;; corrupted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 (if (and (markerp safe-marker) (not completed-safely))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 (delete-region (marker-position safe-marker) (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 (message "Formatting...done")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 (defun ps-do-despool (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 (if (or (not (boundp 'ps-spool-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 (not ps-spool-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 (message "No spooled PostScript to print")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 (ps-end-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 (if filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 (message "Saving..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 (setq filename (expand-file-name filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 (write-region (point-min) (point-max) filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 (message "Wrote %s" filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 ;; Else, spool to the printer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 (message "Printing..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 (apply 'call-process-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 (point-min) (point-max) ps-lpr-command nil 0 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 ps-lpr-switches))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 (message "Printing...done")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 (kill-buffer ps-spool-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 (defun ps-kill-emacs-check ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 (let (ps-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 (if (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 (buffer-modified-p ps-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 (if (y-or-n-p "Unprinted PostScript waiting; print now? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 (ps-despool)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 (if (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 (buffer-modified-p ps-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 (if (yes-or-no-p "Unprinted PostScript waiting; exit anyway? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 (error "Unprinted PostScript")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 (if (fboundp 'add-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 (add-hook 'kill-emacs-hook 'ps-kill-emacs-check)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 (if kill-emacs-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 (message "Won't override existing kill-emacs-hook")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 (setq kill-emacs-hook 'ps-kill-emacs-check)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 ;;; Sample Setup Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 ;; This stuff is for anybody that's brave enough to look this far,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 ;; and able to figure out how to use it. It isn't really part of ps-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 ;; print, but I'll leave it here in hopes it might be useful:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 ;; WARNING!!! The following code is *sample* code only. Don't use it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 ;; unless you understand what it does!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 (defmacro ps-prsc () (list 'if (list 'eq 'ps-print-emacs-type ''emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 [f22] ''f22))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 (defmacro ps-c-prsc () (list 'if (list 'eq 'ps-print-emacs-type ''emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 [C-f22]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 ''(control f22)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 (defmacro ps-s-prsc () (list 'if (list 'eq 'ps-print-emacs-type ''emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 [S-f22]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 ''(shift f22)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 ;; Look in an article or mail message for the Subject: line. To be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 ;; placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 (defun ps-article-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 (if (re-search-forward "^Subject:[ \t]+\\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 "Subject ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 ;; Look in an article or mail message for the From: line. Sorta-kinda
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 ;; understands RFC-822 addresses and can pull the real name out where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 ;; it's provided. To be placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 (defun ps-article-author ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 (if (re-search-forward "^From:[ \t]+\\(.*\\)$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 (let ((fromstring (buffer-substring (match-beginning 1) (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 ;; Try first to match addresses that look like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 ;; thompson@wg2.waii.com (Jim Thompson)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 ((string-match ".*[ \t]+(\\(.*\\))" fromstring)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 (substring fromstring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 ;; Next try to match addresses that look like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 ;; Jim Thompson <thompson@wg2.waii.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 ((string-match "\\(.*\\)[ \t]+<.*>" fromstring)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 (substring fromstring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 ;; Couldn't find a real name -- show the address instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 (t fromstring)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 "From ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 ;; A hook to bind to gnus-Article-prepare-hook. This will set the ps-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 ;; left-headers specially for gnus articles. Unfortunately, gnus-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 ;; article-mode-hook is called only once, the first time the *Article*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 ;; buffer enters that mode, so it would only work for the first time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 ;; we ran gnus. The second time, this hook wouldn't get set up. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 ;; only alternative is gnus-article-prepare-hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 (defun ps-gnus-article-prepare-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 (setq ps-header-lines 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 (setq ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 ;; The left headers will display the article's subject, its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 ;; author, and the newsgroup it was in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 (list 'ps-article-subject 'ps-article-author 'gnus-newsgroup-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 ;; A hook to bind to vm-mode-hook to locally bind prsc and set the ps-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 ;; left-headers specially for mail messages. This header setup would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 ;; also work, I think, for RMAIL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 (defun ps-vm-mode-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 (local-set-key (ps-prsc) 'ps-vm-print-message-from-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 (setq ps-header-lines 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 (setq ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 ;; The left headers will display the message's subject, its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 ;; author, and the name of the folder it was in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 (list 'ps-article-subject 'ps-article-author 'buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 ;; Every now and then I forget to switch from the *Summary* buffer to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 ;; the *Article* before hitting prsc, and a nicely formatted list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 ;; article subjects shows up at the printer. This function, bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 ;; prsc for the gnus *Summary* buffer means I don't have to switch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 ;; buffers first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 (defun ps-gnus-print-article-from-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 (if (get-buffer "*Article*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 (set-buffer "*Article*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 (ps-spool-buffer-with-faces))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 ;; See ps-gnus-print-article-from-summary. This function does the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 ;; same thing for vm.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 (defun ps-vm-print-message-from-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 (if vm-mail-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 (set-buffer vm-mail-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 (ps-spool-buffer-with-faces))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 ;; A hook to bind to bind to gnus-summary-setup-buffer to locally bind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 ;; prsc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 (defun ps-gnus-summary-setup ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 (local-set-key (ps-prsc) 'ps-gnus-print-article-from-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 ;; Look in an article or mail message for the Subject: line. To be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 ;; placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 (defun ps-info-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 (if (re-search-forward "File:[ \t]+\\([^, \t\n]*\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 "File ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 ;; Look in an article or mail message for the Subject: line. To be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 ;; placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 (defun ps-info-node ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 (if (re-search-forward "Node:[ \t]+\\([^,\t\n]*\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 "Node ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 (defun ps-info-mode-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 (setq ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 ;; The left headers will display the node name and file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 (list 'ps-info-node 'ps-info-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 ;; WARNING! The following function is a *sample* only, and is *not*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 ;; meant to be used as a whole unless you understand what the effects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 ;; will be! (In fact, this is a copy if my setup for ps-print -- I'd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 ;; be very surprised if it was useful to *anybody*, without
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 ;; modification.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 (defun ps-jts-ps-setup ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 (global-set-key (ps-prsc) 'ps-spool-buffer-with-faces) ;f22 is prsc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 (global-set-key (ps-s-prsc) 'ps-spool-region-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 (global-set-key (ps-c-prsc) 'ps-despool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 (add-hook 'gnus-article-prepare-hook 'ps-gnus-article-prepare-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 (add-hook 'gnus-summary-mode-hook 'ps-gnus-summary-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 (add-hook 'vm-mode-hook 'ps-vm-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 (add-hook 'vm-mode-hooks 'ps-vm-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 (add-hook 'Info-mode-hook 'ps-info-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 (setq ps-spool-duplex t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 (setq ps-print-color-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 (setq ps-lpr-command "lpr")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 (setq ps-lpr-switches '("-Jjct,duplex_long")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 (provide 'ps-print)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 ;;; ps-print.el ends here