Mercurial > emacs
comparison lisp/ps-print.el @ 37286:7e15b73c8c20
Footers implementation. Doc Fix.
(ps-print-version): New version number (6.5.1).
(ps-header-frame-alist): New customization var for header frame
properties.
(ps-line-number-color): New customization var for line number color.
(ps-footer-offset, ps-footer-line-pad, ps-print-footer)
(ps-print-footer-frame, ps-footer-frame-alist, ps-footer-lines)
(ps-footer-font-family, ps-footer-font-size, ps-left-footer)
(ps-right-footer): New customization vars for footers.
(ps-footer-pad, ps-footer-font-size-internal): New internal vars for
footers.
(ps-setup, ps-get-page-dimensions, ps-generate-header-line)
(ps-generate-header, ps-begin-file, ps-begin-job, ps-begin-page): Code
fix.
(ps-prologue-file): Indentation fix.
(ps-print-quote): Fun eliminated.
(ps-value, ps-get, ps-put, ps-del): New funs for alist handling.
(ps-output-frame-properties): New fun.
(ps-fonts, ps-font-number, ps-rgb-color, ps-end-page, ps-next-page)
(ps-skip-newline): Replace defun by defsubst.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 10 Apr 2001 11:32:08 +0000 |
parents | 18c2d3c6096d |
children | ba96560d3f9e |
comparison
equal
deleted
inserted
replaced
37285:b1c7f74b00f0 | 37286:7e15b73c8c20 |
---|---|
8 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> | 8 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
9 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 9 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
10 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 10 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
11 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> | 11 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
12 ;; Keywords: wp, print, PostScript | 12 ;; Keywords: wp, print, PostScript |
13 ;; Time-stamp: <2001/03/23 21:27:46 Vinicius> | 13 ;; Time-stamp: <2001/04/07 13:41:03 Vinicius> |
14 ;; Version: 6.5 | 14 ;; Version: 6.5.1 |
15 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ | 15 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
16 | 16 |
17 (defconst ps-print-version "6.5" | 17 (defconst ps-print-version "6.5.1" |
18 "ps-print.el, v 6.5 <2001/03/23 vinicius> | 18 "ps-print.el, v 6.5.1 <2001/04/07 vinicius> |
19 | 19 |
20 Vinicius's last change version -- this file may have been edited as part of | 20 Vinicius's last change version -- this file may have been edited as part of |
21 Emacs without changes to the version number. When reporting bugs, please also | 21 Emacs without changes to the version number. When reporting bugs, please also |
22 report the version of Emacs, if any, that ps-print was distributed with. | 22 report the version of Emacs, if any, that ps-print was distributed with. |
23 | 23 |
25 Vinicius Jose Latorre <vinicius@cpqd.com.br>. | 25 Vinicius Jose Latorre <vinicius@cpqd.com.br>. |
26 ") | 26 ") |
27 | 27 |
28 ;; This file is part of GNU Emacs. | 28 ;; This file is part of GNU Emacs. |
29 | 29 |
30 ;; GNU Emacs is free software; you can redistribute it and/or modify | 30 ;; GNU Emacs is free software; you can redistribute it and/or modify it under |
31 ;; it under the terms of the GNU General Public License as published by | 31 ;; the terms of the GNU General Public License as published by the Free |
32 ;; the Free Software Foundation; either version 2, or (at your option) | 32 ;; Software Foundation; either version 2, or (at your option) any later |
33 ;; any later version. | 33 ;; version. |
34 | 34 |
35 ;; GNU Emacs is distributed in the hope that it will be useful, | 35 ;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY |
36 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 36 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
37 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 37 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
38 ;; GNU General Public License for more details. | 38 ;; details. |
39 | 39 |
40 ;; You should have received a copy of the GNU General Public License | 40 ;; You should have received a copy of the GNU General Public License along with |
41 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 41 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software |
42 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 42 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
43 ;; Boston, MA 02111-1307, USA. | |
44 | 43 |
45 ;;; Commentary: | 44 ;;; Commentary: |
46 | 45 |
47 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 46 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
48 ;; | 47 ;; |
49 ;; About ps-print | 48 ;; About ps-print |
50 ;; -------------- | 49 ;; -------------- |
51 ;; | 50 ;; |
52 ;; This package provides printing of Emacs buffers on PostScript printers; | 51 ;; This package provides printing of Emacs buffers on PostScript printers; the |
53 ;; the buffer's bold and italic text attributes are preserved in the printer | 52 ;; buffer's bold and italic text attributes are preserved in the printer |
54 ;; output. ps-print is intended for use with Emacs or Lucid Emacs, together | 53 ;; output. ps-print is intended for use with Emacs or Lucid Emacs, together |
55 ;; with a fontifying package such as font-lock or hilit. | 54 ;; with a fontifying package such as font-lock or hilit. |
56 ;; | 55 ;; |
57 ;; ps-print uses the same face attributes defined through font-lock or hilit | 56 ;; ps-print uses the same face attributes defined through font-lock or hilit to |
58 ;; to print a PostScript file, but some faces are better seeing on the screen | 57 ;; print a PostScript file, but some faces are better seeing on the screen than |
59 ;; than on paper, specially when you have a black/white PostScript printer. | 58 ;; on paper, specially when you have a black/white PostScript printer. |
60 ;; | 59 ;; |
61 ;; ps-print allows a remap of face to another one that it is better to print, | 60 ;; ps-print allows a remap of face to another one that it is better to print, |
62 ;; for example, the face font-lock-comment-face (if you are using font-lock) | 61 ;; for example, the face font-lock-comment-face (if you are using font-lock) |
63 ;; could have bold or italic attribute when printing, besides foreground color. | 62 ;; could have bold or italic attribute when printing, besides foreground color. |
64 ;; This remap improves printing look (see How Ps-Print Maps Faces). | 63 ;; This remap improves printing look (see How Ps-Print Maps Faces). |
65 ;; | 64 ;; |
66 ;; | 65 ;; |
67 ;; Using ps-print | 66 ;; Using ps-print |
68 ;; -------------- | 67 ;; -------------- |
69 ;; | 68 ;; |
70 ;; ps-print provides eight commands for generating PostScript images | 69 ;; ps-print provides eight commands for generating PostScript images of Emacs |
71 ;; of Emacs buffers: | 70 ;; buffers: |
72 ;; | 71 ;; |
73 ;; ps-print-buffer | 72 ;; ps-print-buffer |
74 ;; ps-print-buffer-with-faces | 73 ;; ps-print-buffer-with-faces |
75 ;; ps-print-region | 74 ;; ps-print-region |
76 ;; ps-print-region-with-faces | 75 ;; ps-print-region-with-faces |
77 ;; ps-spool-buffer | 76 ;; ps-spool-buffer |
78 ;; ps-spool-buffer-with-faces | 77 ;; ps-spool-buffer-with-faces |
79 ;; ps-spool-region | 78 ;; ps-spool-region |
80 ;; ps-spool-region-with-faces | 79 ;; ps-spool-region-with-faces |
81 ;; | 80 ;; |
82 ;; These commands all perform essentially the same function: they | 81 ;; These commands all perform essentially the same function: they generate |
83 ;; generate PostScript images suitable for printing on a PostScript | 82 ;; PostScript images suitable for printing on a PostScript printer or |
84 ;; printer or displaying with GhostScript. These commands are | 83 ;; displaying with GhostScript. These commands are collectively referred to as |
85 ;; collectively referred to as "ps-print- commands". | 84 ;; "ps-print- commands". |
86 ;; | 85 ;; |
87 ;; The word "print" or "spool" in the command name determines when the | 86 ;; The word "print" or "spool" in the command name determines when the |
88 ;; PostScript image is sent to the printer: | 87 ;; PostScript image is sent to the printer: |
89 ;; | 88 ;; |
90 ;; print - The PostScript image is immediately sent to the | 89 ;; print - The PostScript image is immediately sent to the printer; |
91 ;; printer; | 90 ;; |
92 ;; | 91 ;; spool - The PostScript image is saved temporarily in an Emacs |
93 ;; spool - The PostScript image is saved temporarily in an | 92 ;; buffer. Many images may be spooled locally before |
94 ;; Emacs buffer. Many images may be spooled locally | 93 ;; printing them. To send the spooled images to the |
95 ;; before printing them. To send the spooled images | 94 ;; printer, use the command `ps-despool'. |
96 ;; to the printer, use the command `ps-despool'. | 95 ;; |
97 ;; | 96 ;; The spooling mechanism was designed for printing lots of small files (mail |
98 ;; The spooling mechanism was designed for printing lots of small | 97 ;; messages or netnews articles) to save paper that would otherwise be wasted |
99 ;; files (mail messages or netnews articles) to save paper that would | 98 ;; on banner pages, and to make it easier to find your output at the printer |
100 ;; otherwise be wasted on banner pages, and to make it easier to find | 99 ;; (it's easier to pick up one 50-page printout than to find 50 single-page |
101 ;; your output at the printer (it's easier to pick up one 50-page | 100 ;; printouts). |
102 ;; printout than to find 50 single-page printouts). | 101 ;; |
103 ;; | 102 ;; ps-print has a hook in the `kill-emacs-hook' so that you won't accidentally |
104 ;; ps-print has a hook in the `kill-emacs-hook' so that you won't | 103 ;; quit from Emacs while you have unprinted PostScript waiting in the spool |
105 ;; accidentally quit from Emacs while you have unprinted PostScript | 104 ;; buffer. If you do attempt to exit with spooled PostScript, you'll be asked |
106 ;; waiting in the spool buffer. If you do attempt to exit with | 105 ;; if you want to print it, and if you decline, you'll be asked to confirm the |
107 ;; spooled PostScript, you'll be asked if you want to print it, and if | 106 ;; exit; this is modeled on the confirmation that Emacs uses for modified |
108 ;; you decline, you'll be asked to confirm the exit; this is modeled | 107 ;; buffers. |
109 ;; on the confirmation that Emacs uses for modified buffers. | 108 ;; |
110 ;; | 109 ;; The word "buffer" or "region" in the command name determines how much of the |
111 ;; The word "buffer" or "region" in the command name determines how | 110 ;; buffer is printed: |
112 ;; much of the buffer is printed: | |
113 ;; | 111 ;; |
114 ;; buffer - Print the entire buffer. | 112 ;; buffer - Print the entire buffer. |
115 ;; | 113 ;; |
116 ;; region - Print just the current region. | 114 ;; region - Print just the current region. |
117 ;; | 115 ;; |
118 ;; The -with-faces suffix on the command name means that the command | 116 ;; The -with-faces suffix on the command name means that the command will |
119 ;; will include font, color, and underline information in the | 117 ;; include font, color, and underline information in the PostScript image, so |
120 ;; PostScript image, so the printed image can look as pretty as the | 118 ;; the printed image can look as pretty as the buffer. The ps-print- commands |
121 ;; buffer. The ps-print- commands without the -with-faces suffix | 119 ;; without the -with-faces suffix don't include font, color, or underline |
122 ;; don't include font, color, or underline information; images printed | 120 ;; information; images printed with these commands aren't as pretty, but are |
123 ;; with these commands aren't as pretty, but are faster to generate. | 121 ;; faster to generate. |
124 ;; | 122 ;; |
125 ;; Two ps-print- command examples: | 123 ;; Two ps-print- command examples: |
126 ;; | 124 ;; |
127 ;; ps-print-buffer - print the entire buffer, | 125 ;; ps-print-buffer - print the entire buffer, without font, |
128 ;; without font, color, or | 126 ;; color, or underline information, and |
129 ;; underline information, and | 127 ;; send it immediately to the printer. |
130 ;; send it immediately to the | 128 ;; |
131 ;; printer. | 129 ;; ps-spool-region-with-faces - print just the current region; include |
132 ;; | 130 ;; font, color, and underline information, |
133 ;; ps-spool-region-with-faces - print just the current region; | 131 ;; and spool the image in Emacs to send to |
134 ;; include font, color, and | 132 ;; the printer later. |
135 ;; underline information, and | |
136 ;; spool the image in Emacs to | |
137 ;; send to the printer later. | |
138 ;; | 133 ;; |
139 ;; | 134 ;; |
140 ;; Invoking Ps-Print | 135 ;; Invoking Ps-Print |
141 ;; ----------------- | 136 ;; ----------------- |
142 ;; | 137 ;; |
143 ;; To print your buffer, type | 138 ;; To print your buffer, type |
144 ;; | 139 ;; |
145 ;; M-x ps-print-buffer | 140 ;; M-x ps-print-buffer |
146 ;; | 141 ;; |
147 ;; or substitute one of the other seven ps-print- commands. The | 142 ;; or substitute one of the other seven ps-print- commands. The command will |
148 ;; command will generate the PostScript image and print or spool it as | 143 ;; generate the PostScript image and print or spool it as specified. By giving |
149 ;; specified. By giving the command a prefix argument | 144 ;; the command a prefix argument |
150 ;; | 145 ;; |
151 ;; C-u M-x ps-print-buffer | 146 ;; C-u M-x ps-print-buffer |
152 ;; | 147 ;; |
153 ;; it will save the PostScript image to a file instead of sending it | 148 ;; it will save the PostScript image to a file instead of sending it to the |
154 ;; to the printer; you will be prompted for the name of the file to | 149 ;; printer; you will be prompted for the name of the file to save the image to. |
155 ;; save the image to. The prefix argument is ignored by the commands | 150 ;; The prefix argument is ignored by the commands that spool their images, but |
156 ;; that spool their images, but you may save the spooled images to a | 151 ;; you may save the spooled images to a file by giving a prefix argument to |
157 ;; file by giving a prefix argument to `ps-despool': | 152 ;; `ps-despool': |
158 ;; | 153 ;; |
159 ;; C-u M-x ps-despool | 154 ;; C-u M-x ps-despool |
160 ;; | 155 ;; |
161 ;; When invoked this way, `ps-despool' will prompt you for the name of | 156 ;; When invoked this way, `ps-despool' will prompt you for the name of the file |
162 ;; the file to save to. | 157 ;; to save to. |
163 ;; | 158 ;; |
164 ;; Any of the `ps-print-' commands can be bound to keys; I recommend | 159 ;; Any of the `ps-print-' commands can be bound to keys; I recommend binding |
165 ;; binding `ps-spool-buffer-with-faces', `ps-spool-region-with-faces', | 160 ;; `ps-spool-buffer-with-faces', `ps-spool-region-with-faces', and |
166 ;; and `ps-despool'. Here are the bindings I use on my Sun 4 keyboard: | 161 ;; `ps-despool'. Here are the bindings I use on my Sun 4 keyboard: |
167 ;; | 162 ;; |
168 ;; (global-set-key 'f22 'ps-spool-buffer-with-faces) ;f22 is prsc | 163 ;; (global-set-key 'f22 'ps-spool-buffer-with-faces) ;f22 is prsc |
169 ;; (global-set-key '(shift f22) 'ps-spool-region-with-faces) | 164 ;; (global-set-key '(shift f22) 'ps-spool-region-with-faces) |
170 ;; (global-set-key '(control f22) 'ps-despool) | 165 ;; (global-set-key '(control f22) 'ps-despool) |
171 ;; | 166 ;; |
172 ;; | 167 ;; |
173 ;; The Printer Interface | 168 ;; The Printer Interface |
174 ;; --------------------- | 169 ;; --------------------- |
175 ;; | 170 ;; |
176 ;; The variables `ps-lpr-command' and `ps-lpr-switches' determine what | 171 ;; The variables `ps-lpr-command' and `ps-lpr-switches' determine what command |
177 ;; command is used to send the PostScript images to the printer, and | 172 ;; is used to send the PostScript images to the printer, and what arguments to |
178 ;; what arguments to give the command. These are analogous to | 173 ;; give the command. These are analogous to `lpr-command' and `lpr-switches'. |
179 ;; `lpr-command' and `lpr-switches'. | |
180 ;; | 174 ;; |
181 ;; Make sure that they contain appropriate values for your system; | 175 ;; Make sure that they contain appropriate values for your system; |
182 ;; see the usage notes below and the documentation of these variables. | 176 ;; see the usage notes below and the documentation of these variables. |
183 ;; | 177 ;; |
184 ;; The variable `ps-printer-name' determines the name of a local printer for | 178 ;; The variable `ps-printer-name' determines the name of a local printer for |
187 ;; The variable `ps-printer-name-option' determines the option used by some | 181 ;; The variable `ps-printer-name-option' determines the option used by some |
188 ;; utilities to indicate the printer name, it's used only when | 182 ;; utilities to indicate the printer name, it's used only when |
189 ;; `ps-printer-name' is a non-empty string. If you're using lpr utility to | 183 ;; `ps-printer-name' is a non-empty string. If you're using lpr utility to |
190 ;; print, for example, `ps-printer-name-option' should be set to "-P". | 184 ;; print, for example, `ps-printer-name-option' should be set to "-P". |
191 ;; | 185 ;; |
192 ;; NOTE: `ps-lpr-command' and `ps-lpr-switches' take their initial values | 186 ;; NOTE: `ps-lpr-command' and `ps-lpr-switches' take their initial values from |
193 ;; from the variables `lpr-command' and `lpr-switches'. If you have | 187 ;; the variables `lpr-command' and `lpr-switches'. If you have |
194 ;; `lpr-command' set to invoke a pretty-printer such as `enscript', | 188 ;; `lpr-command' set to invoke a pretty-printer such as `enscript', then |
195 ;; then ps-print won't work properly. `ps-lpr-command' must name | 189 ;; ps-print won't work properly. `ps-lpr-command' must name a program |
196 ;; a program that does not format the files it prints. | 190 ;; that does not format the files it prints. |
197 ;; `ps-printer-name' takes its initial value from the variable | 191 ;; `ps-printer-name' takes its initial value from the variable |
198 ;; `printer-name'. `ps-printer-name-option' tries to guess which system | 192 ;; `printer-name'. `ps-printer-name-option' tries to guess which system |
199 ;; Emacs is running and takes its initial value in accordance with this | 193 ;; Emacs is running and takes its initial value in accordance with this |
200 ;; guess. | 194 ;; guess. |
201 ;; | 195 ;; |
241 ;; | 235 ;; |
242 ;; The variable `ps-landscape-mode' determines the orientation of the printing | 236 ;; The variable `ps-landscape-mode' determines the orientation of the printing |
243 ;; on the page: nil means `portrait' mode, non-nil means `landscape' mode. | 237 ;; on the page: nil means `portrait' mode, non-nil means `landscape' mode. |
244 ;; There is no oblique mode yet, though this is easy to do in ps. | 238 ;; There is no oblique mode yet, though this is easy to do in ps. |
245 ;; | 239 ;; |
246 ;; In landscape mode, the text is NOT scaled: you may print 70 lines in portrait | 240 ;; In landscape mode, the text is NOT scaled: you may print 70 lines in |
247 ;; mode and only 50 lines in landscape mode. The margins represent margins in | 241 ;; portrait mode and only 50 lines in landscape mode. The margins represent |
248 ;; the printed paper: the top margin is the margin between the top of the page | 242 ;; margins in the printed paper: the top margin is the margin between the top |
249 ;; and the printed header, whatever the orientation is. | 243 ;; of the page and the printed header, whatever the orientation is. |
250 ;; | 244 ;; |
251 ;; The variable `ps-number-of-columns' determines the number of columns both in | 245 ;; The variable `ps-number-of-columns' determines the number of columns both in |
252 ;; landscape and portrait mode. | 246 ;; landscape and portrait mode. |
253 ;; You can use: | 247 ;; You can use: |
254 ;; - (the standard) one column portrait mode. | 248 ;; - (the standard) one column portrait mode. |
255 ;; - (my favorite) two columns landscape mode (which spares trees). | 249 ;; - (my favorite) two columns landscape mode (which spares trees). |
256 ;; but also: | 250 ;; but also: |
257 ;; - one column landscape mode for files with very long lines. | 251 ;; - one column landscape mode for files with very long lines. |
258 ;; - multi-column portrait or landscape mode. | 252 ;; - multi-column portrait or landscape mode. |
259 ;; | 253 ;; |
260 ;; The variable `ps-print-upside-down' determines other orientation for printing | 254 ;; The variable `ps-print-upside-down' determines other orientation for |
261 ;; page: nil means `normal' printing, non-nil means `upside-down' printing. The | 255 ;; printing page: nil means `normal' printing, non-nil means `upside-down' |
262 ;; default value is nil (`normal' printing). | 256 ;; printing (that is, the page is rotated by 180 grades). The default value is |
257 ;; nil (`normal' printing). | |
263 ;; | 258 ;; |
264 ;; The `upside-down' orientation can be used in portrait or landscape mode. | 259 ;; The `upside-down' orientation can be used in portrait or landscape mode. |
265 ;; | 260 ;; |
266 ;; The variable `ps-selected-pages' specifies which pages to print. If it's | 261 ;; The variable `ps-selected-pages' specifies which pages to print. If it's |
267 ;; nil, all pages are printed. If it's a list, the list element may be an | 262 ;; nil, all pages are printed. If it's a list, the list element may be an |
313 ;; | 308 ;; |
314 ;; Vertical layout | 309 ;; Vertical layout |
315 ;; --------------- | 310 ;; --------------- |
316 ;; | 311 ;; |
317 ;; The vertical layout is determined by the variables | 312 ;; The vertical layout is determined by the variables |
318 ;; `ps-bottom-margin' `ps-top-margin' `ps-header-offset' | 313 ;; `ps-bottom-margin' `ps-top-margin' `ps-header-offset' `ps-footer-offset' |
319 ;; as follows: | 314 ;; as follows: |
320 ;; | 315 ;; |
321 ;; |--------| |--------| | 316 ;; |--------| |--------| |--------| |--------| |
322 ;; | tm | | tm | | 317 ;; | tm | | tm | | tm | | tm | |
323 ;; |--------| |--------| | 318 ;; |--------| |--------| |--------| |--------| |
324 ;; | header | | | | 319 ;; | header | | | | header | | | |
325 ;; |--------| | | | 320 ;; |--------| | | |--------| | | |
326 ;; | ho | | | | 321 ;; | ho | | | | ho | | | |
327 ;; |--------| or | text | | 322 ;; |--------| | | |--------| | | |
328 ;; | | | | | 323 ;; | | | | | | | | |
329 ;; | text | | | | 324 ;; | text | or | text | or | text | or | text | |
330 ;; | | | | | 325 ;; | | | | | | | | |
331 ;; |--------| |--------| | 326 ;; | | |--------| |--------| | | |
332 ;; | bm | | bm | | 327 ;; | | | fo | | fo | | | |
333 ;; |--------| |--------| | 328 ;; | | |--------| |--------| | | |
329 ;; | | | footer | | footer | | | | |
330 ;; |--------| |--------| |--------| |--------| | |
331 ;; | bm | | bm | | bm | | bm | | |
332 ;; |--------| |--------| |--------| |--------| | |
334 ;; | 333 ;; |
335 ;; If `ps-print-header' is nil, `ps-header-offset' is not relevant. | 334 ;; If `ps-print-header' is nil, `ps-header-offset' is not relevant. |
335 ;; If `ps-print-footer' is nil, `ps-footer-offset' is not relevant. | |
336 ;; The margins represent margins in the printed paper: | 336 ;; The margins represent margins in the printed paper: |
337 ;; the top margin is the margin between the top of the page | 337 ;; the top margin is the margin between the top of the page and the printed |
338 ;; and the printed header, whatever the orientation is. | 338 ;; header, whatever the orientation is; |
339 ;; | 339 ;; the bottom margin is the margin between the bottom of the page and the |
340 ;; | 340 ;; printed footer, whatever the orientation is. |
341 ;; Headers | 341 ;; |
342 ;; ------- | 342 ;; |
343 ;; | 343 ;; Headers & Footers |
344 ;; ps-print can print headers at the top of each column or at the top | 344 ;; ----------------- |
345 ;; of each page; the default headers contain the following four items: | 345 ;; |
346 ;; on the left, the name of the buffer and, if the buffer is visiting | 346 ;; ps-print can print headers at the top of each column or at the top of each |
347 ;; a file, the file's directory; on the right, the page number and | 347 ;; page; the default headers contain the following four items: on the left, the |
348 ;; date of printing. The default headers look something like this: | 348 ;; name of the buffer and, if the buffer is visiting a file, the file's |
349 ;; directory; on the right, the page number and date of printing. The default | |
350 ;; headers look something like this: | |
349 ;; | 351 ;; |
350 ;; ps-print.el 1/21 | 352 ;; ps-print.el 1/21 |
351 ;; /home/jct/emacs-lisp/ps/new 94/12/31 | 353 ;; /home/jct/emacs-lisp/ps/new 94/12/31 |
352 ;; | 354 ;; |
353 ;; When printing on duplex printers, left and right are reversed so | 355 ;; When printing on duplex printers, left and right are reversed so that the |
354 ;; that the page numbers are toward the outside (cf. `ps-spool-duplex'). | 356 ;; page numbers are toward the outside (cf. `ps-spool-duplex'). |
355 ;; | 357 ;; |
356 ;; Headers are configurable: | 358 ;; Headers are configurable: |
357 ;; To turn them off completely, set `ps-print-header' to nil. | 359 ;; To turn them off completely, set `ps-print-header' to nil. |
358 ;; To turn off the header's gaudy framing box, | 360 ;; To turn off the header's gaudy framing box, |
359 ;; set `ps-print-header-frame' to nil. | 361 ;; set `ps-print-header-frame' to nil. |
360 ;; | 362 ;; |
361 ;; To print only one header at the top of each page, | 363 ;; The variable `ps-header-frame-alist' specifies header frame properties |
362 ;; set `ps-print-only-one-header' to t. | 364 ;; alist. Valid frame properties are: |
365 ;; | |
366 ;; fore-color Specify the foreground frame color. | |
367 ;; It should be a float number between 0.0 (black color) | |
368 ;; and 1.0 (white color), a string which is a color name, | |
369 ;; or a list of 3 float numbers which corresponds to the | |
370 ;; Red Green Blue color scale, each float number between | |
371 ;; 0.0 (dark color) and 1.0 (bright color). | |
372 ;; The default is 0 ("black"). | |
373 ;; | |
374 ;; back-color Specify the background frame color (similar to | |
375 ;; fore-color). The default is 0.9 ("gray90"). | |
376 ;; | |
377 ;; shadow-color Specify the shadow color (similar to fore-color). | |
378 ;; The default is 0 ("black"). | |
379 ;; | |
380 ;; border-color Specify the border color (similar to fore-color). | |
381 ;; The default is 0 ("black"). | |
382 ;; | |
383 ;; border-width Specify the border width. | |
384 ;; The default is 0.4. | |
385 ;; | |
386 ;; Any other property is ignored. | |
387 ;; | |
388 ;; Don't change this alist directly, instead use customization, or `ps-value', | |
389 ;; `ps-get', `ps-put' and `ps-del' functions (see them for documentation). | |
390 ;; | |
391 ;; To print only one header at the top of each page, set | |
392 ;; `ps-print-only-one-header' to t. | |
363 ;; | 393 ;; |
364 ;; To switch headers, set `ps-switch-header' to: | 394 ;; To switch headers, set `ps-switch-header' to: |
365 ;; | 395 ;; |
366 ;; nil Never switch headers. | 396 ;; nil Never switch headers. |
367 ;; | 397 ;; |
370 ;; duplex Switch headers only when duplexing is on, that is, when | 400 ;; duplex Switch headers only when duplexing is on, that is, when |
371 ;; `ps-spool-duplex' is non-nil (see Duplex Printers). | 401 ;; `ps-spool-duplex' is non-nil (see Duplex Printers). |
372 ;; | 402 ;; |
373 ;; Any other value is treated as t. The default value is `duplex'. | 403 ;; Any other value is treated as t. The default value is `duplex'. |
374 ;; | 404 ;; |
375 ;; The font family and size of text in the header are determined | 405 ;; The font family and size of text in the header are determined by the |
376 ;; by the variables `ps-header-font-family', `ps-header-font-size' and | 406 ;; variables `ps-header-font-family', `ps-header-font-size' and |
377 ;; `ps-header-title-font-size' (see below). | 407 ;; `ps-header-title-font-size' (see below). |
378 ;; | 408 ;; |
379 ;; The variable `ps-header-line-pad' determines the portion of a header | 409 ;; The variable `ps-header-line-pad' determines the portion of a header title |
380 ;; title line height to insert between the header frame and the text | 410 ;; line height to insert between the header frame and the text it contains, |
381 ;; it contains, both in the vertical and horizontal directions: | 411 ;; both in the vertical and horizontal directions: .5 means half a line. |
382 ;; .5 means half a line. | 412 ;; |
383 ;; | 413 ;; Page numbers are printed in `n/m' format, indicating page n of m pages; to |
384 ;; Page numbers are printed in `n/m' format, indicating page n of m pages; | 414 ;; omit the total page count and just print the page number, set |
385 ;; to omit the total page count and just print the page number, | 415 ;; `ps-show-n-of-n' to nil. |
386 ;; set `ps-show-n-of-n' to nil. | 416 ;; |
387 ;; | 417 ;; The amount of information in the header can be changed by changing the |
388 ;; The amount of information in the header can be changed by changing | 418 ;; number of lines. To show less, set `ps-header-lines' to 1, and the header |
389 ;; the number of lines. To show less, set `ps-header-lines' to 1, and | 419 ;; will show only the buffer name and page number. To show more, set |
390 ;; the header will show only the buffer name and page number. To show | 420 ;; `ps-header-lines' to 3, and the header will show the time of printing below |
391 ;; more, set `ps-header-lines' to 3, and the header will show the time of | 421 ;; the date. |
392 ;; printing below the date. | 422 ;; |
393 ;; | 423 ;; To change the content of the headers, change the variables `ps-left-header' |
394 ;; To change the content of the headers, change the variables | 424 ;; and `ps-right-header'. |
395 ;; `ps-left-header' and `ps-right-header'. | 425 ;; These variables are lists, specifying top-to-bottom the text to display on |
396 ;; These variables are lists, specifying top-to-bottom the text | 426 ;; the left or right side of the header. Each element of the list should be a |
397 ;; to display on the left or right side of the header. | 427 ;; string or a symbol. Strings are inserted directly into the PostScript |
398 ;; Each element of the list should be a string or a symbol. | 428 ;; arrays, and should contain the PostScript string delimiters '(' and ')'. |
399 ;; Strings are inserted directly into the PostScript arrays, | 429 ;; |
400 ;; and should contain the PostScript string delimiters '(' and ')'. | 430 ;; Symbols in the header format lists can either represent functions or |
401 ;; | 431 ;; variables. Functions are called, and should return a string to show in the |
402 ;; Symbols in the header format lists can either represent functions | 432 ;; header. Variables should contain strings to display in the header. In |
403 ;; or variables. Functions are called, and should return a string to | 433 ;; either case, function or variable, the PostScript string delimiters are |
404 ;; show in the header. Variables should contain strings to display in | 434 ;; added by ps-print, and should not be part of the returned value. |
405 ;; the header. In either case, function or variable, the PostScript | |
406 ;; string delimiters are added by ps-print, and should not be part of | |
407 ;; the returned value. | |
408 ;; | 435 ;; |
409 ;; Here's an example: say we want the left header to display the text | 436 ;; Here's an example: say we want the left header to display the text |
410 ;; | 437 ;; |
411 ;; Moe | 438 ;; Moe |
412 ;; Larry | 439 ;; Larry |
419 ;; | 446 ;; |
420 ;; a variable specifying "Larry" | 447 ;; a variable specifying "Larry" |
421 ;; | 448 ;; |
422 ;; (setq larry-var "Larry") | 449 ;; (setq larry-var "Larry") |
423 ;; | 450 ;; |
424 ;; and a literal for "Curly". Here's how `ps-left-header' should be | 451 ;; and a literal for "Curly". Here's how `ps-left-header' should be set: |
425 ;; set: | |
426 ;; | 452 ;; |
427 ;; (setq ps-left-header (list 'moe-func 'larry-var "(Curly)")) | 453 ;; (setq ps-left-header (list 'moe-func 'larry-var "(Curly)")) |
428 ;; | 454 ;; |
429 ;; Note that Curly has the PostScript string delimiters inside his | 455 ;; Note that Curly has the PostScript string delimiters inside his quotes -- |
430 ;; quotes -- those aren't misplaced lisp delimiters! | 456 ;; those aren't misplaced lisp delimiters! |
431 ;; | 457 ;; |
432 ;; Without them, PostScript would attempt to call the undefined | 458 ;; Without them, PostScript would attempt to call the undefined function Curly, |
433 ;; function Curly, which would result in a PostScript error. | 459 ;; which would result in a PostScript error. |
434 ;; | 460 ;; |
435 ;; Since most printers don't report PostScript errors except by | 461 ;; Since most printers don't report PostScript errors except by aborting the |
436 ;; aborting the print job, this kind of error can be hard to track down. | 462 ;; print job, this kind of error can be hard to track down. |
437 ;; | 463 ;; |
438 ;; Consider yourself warned! | 464 ;; Consider yourself warned! |
465 ;; | |
466 ;; ps-print also print footers. The footer variables are: `ps-print-footer', | |
467 ;; `ps-footer-offset', `ps-print-footer-frame', `ps-footer-font-family', | |
468 ;; `ps-footer-font-size', `ps-footer-line-pad', `ps-footer-lines', | |
469 ;; `ps-left-footer', `ps-right-footer' and `ps-footer-frame-alist'. These | |
470 ;; variables are similar to those one that control headers. | |
471 ;; | |
472 ;; The variables `ps-print-only-one-header' and `ps-switch-header' also control | |
473 ;; the footer (The same way that control header). | |
474 ;; | |
475 ;; As a footer example, if you want to have a centered page number in the | |
476 ;; footer but without headers, set: | |
477 ;; | |
478 ;; (setq ps-print-header nil | |
479 ;; ps-print-footer t | |
480 ;; ps-print-footer-frame nil | |
481 ;; ps-footer-lines 1 | |
482 ;; ps-right-footer nil | |
483 ;; ps-left-footer | |
484 ;; (list (concat "{pagenumberstring dup stringwidth pop" | |
485 ;; " 2 div PrintWidth 2 div exch sub 0 rmoveto}"))) | |
439 ;; | 486 ;; |
440 ;; | 487 ;; |
441 ;; PostScript Prologue Header | 488 ;; PostScript Prologue Header |
442 ;; -------------------------- | 489 ;; -------------------------- |
443 ;; | 490 ;; |
444 ;; It is possible to add PostScript prologue header comments besides that | 491 ;; It is possible to add PostScript prologue header comments besides that |
445 ;; ps-print generates by setting the variable `ps-print-prologue-header'. | 492 ;; ps-print generates by setting the variable `ps-print-prologue-header'. |
446 ;; | 493 ;; |
447 ;; `ps-print-prologue-header' may be a string or a symbol function which returns | 494 ;; `ps-print-prologue-header' may be a string or a symbol function which |
448 ;; a string. Note that this string is inserted on PostScript prologue header | 495 ;; returns a string. Note that this string is inserted on PostScript prologue |
449 ;; section which is used to define some document characteristic through | 496 ;; header section which is used to define some document characteristic through |
450 ;; PostScript special comments, like "%%Requirements: jog\n". | 497 ;; PostScript special comments, like "%%Requirements: jog\n". |
451 ;; | 498 ;; |
452 ;; By default `ps-print-prologue-header' is nil. | 499 ;; By default `ps-print-prologue-header' is nil. |
453 ;; | 500 ;; |
454 ;; ps-print always inserts the %%Requirements: comment, so if you need to insert | 501 ;; ps-print always inserts the %%Requirements: comment, so if you need to |
455 ;; more requirements put them first in `ps-print-prologue-header' using the | 502 ;; insert more requirements put them first in `ps-print-prologue-header' using |
456 ;; "%%+" comment. For example, if you need to set numcopies to 3 and jog on | 503 ;; the "%%+" comment. For example, if you need to set numcopies to 3 and jog |
457 ;; requirements and set %%LanguageLevel: to 2, do: | 504 ;; on requirements and set %%LanguageLevel: to 2, do: |
458 ;; | 505 ;; |
459 ;; (setq ps-print-prologue-header | 506 ;; (setq ps-print-prologue-header |
460 ;; "%%+ numcopies(3) jog\n%%LanguageLevel: 2\n") | 507 ;; "%%+ numcopies(3) jog\n%%LanguageLevel: 2\n") |
461 ;; | 508 ;; |
462 ;; The duplex requirement is inserted by ps-print (see section Duplex Printers). | 509 ;; The duplex requirement is inserted by ps-print (see section Duplex |
510 ;; Printers). | |
463 ;; | 511 ;; |
464 ;; Do not forget to terminate the string with "\n". | 512 ;; Do not forget to terminate the string with "\n". |
465 ;; | 513 ;; |
466 ;; For more information about PostScript document comments, see: | 514 ;; For more information about PostScript document comments, see: |
467 ;; PostScript Language Reference Manual (2nd edition) | 515 ;; PostScript Language Reference Manual (2nd edition) |
470 ;; | 518 ;; |
471 ;; It is also possible to add an user defined PostScript prologue code before | 519 ;; It is also possible to add an user defined PostScript prologue code before |
472 ;; all generated prologue code by setting the variable | 520 ;; all generated prologue code by setting the variable |
473 ;; `ps-user-defined-prologue'. | 521 ;; `ps-user-defined-prologue'. |
474 ;; | 522 ;; |
475 ;; `ps-user-defined-prologue' may be a string or a symbol function which returns | 523 ;; `ps-user-defined-prologue' may be a string or a symbol function which |
476 ;; a string. Note that this string is inserted after `ps-adobe-tag' and | 524 ;; returns a string. Note that this string is inserted after `ps-adobe-tag' |
477 ;; PostScript prologue comments, and before ps-print PostScript prologue code | 525 ;; and PostScript prologue comments, and before ps-print PostScript prologue |
478 ;; section. That is, this string is inserted after error handler initialization | 526 ;; code section. That is, this string is inserted after error handler |
479 ;; and before ps-print settings. | 527 ;; initialization and before ps-print settings. |
480 ;; | 528 ;; |
481 ;; By default `ps-user-defined-prologue' is nil. | 529 ;; By default `ps-user-defined-prologue' is nil. |
482 ;; | 530 ;; |
483 ;; It's strongly recommended only insert PostScript code and/or comments | 531 ;; It's strongly recommended only insert PostScript code and/or comments |
484 ;; specific for your printing system particularities. For example, some special | 532 ;; specific for your printing system particularities. For example, some |
485 ;; initialization that only your printing system needs. | 533 ;; special initialization that only your printing system needs. |
486 ;; | 534 ;; |
487 ;; Do not insert code for duplex printing, n-up printing or error handler, | 535 ;; Do not insert code for duplex printing, n-up printing or error handler, |
488 ;; ps-print handles this in a suitable way. | 536 ;; ps-print handles this in a suitable way. |
489 ;; | 537 ;; |
490 ;; For more information about PostScript, see: | 538 ;; For more information about PostScript, see: |
513 ;; | 561 ;; |
514 ;; paper catch the error and print on paper the error message. | 562 ;; paper catch the error and print on paper the error message. |
515 ;; This is the default value. | 563 ;; This is the default value. |
516 ;; | 564 ;; |
517 ;; system catch the error and send back the error message to | 565 ;; system catch the error and send back the error message to |
518 ;; printing system. This is useful only if printing system | 566 ;; printing system. This is useful only if printing |
519 ;; send back an email reporting the error, or if there is | 567 ;; system send back an email reporting the error, or if |
520 ;; some other alternative way to report back the error from | 568 ;; there is some other alternative way to report back the |
521 ;; the system to you. | 569 ;; error from the system to you. |
522 ;; | 570 ;; |
523 ;; paper-and-system catch the error, print on paper the error message and | 571 ;; paper-and-system catch the error, print on paper the error message and |
524 ;; send back the error message to printing system. | 572 ;; send back the error message to printing system. |
525 ;; | 573 ;; |
526 ;; Any other value is treated as `paper'. | 574 ;; Any other value is treated as `paper'. |
532 ;; If you have a duplex-capable printer (one that prints both sides of the | 580 ;; If you have a duplex-capable printer (one that prints both sides of the |
533 ;; paper), set `ps-spool-duplex' to t. | 581 ;; paper), set `ps-spool-duplex' to t. |
534 ;; ps-print will insert blank pages to make sure each buffer starts on the | 582 ;; ps-print will insert blank pages to make sure each buffer starts on the |
535 ;; correct side of the paper. | 583 ;; correct side of the paper. |
536 ;; | 584 ;; |
537 ;; The variable `ps-spool-config' specifies who is the responsable for setting | 585 ;; The variable `ps-spool-config' specifies who is the responsible for setting |
538 ;; duplex and page size switches. Valid values are: | 586 ;; duplex and page size. Valid values are: |
539 ;; | 587 ;; |
540 ;; lpr-switches duplex and page size are configured by `ps-lpr-switches'. | 588 ;; lpr-switches duplex and page size are configured by `ps-lpr-switches'. |
541 ;; Don't forget to set `ps-lpr-switches' to select duplex | 589 ;; Don't forget to set `ps-lpr-switches' to select duplex |
542 ;; printing for your printer. | 590 ;; printing for your printer. |
543 ;; | 591 ;; |
549 ;; | 597 ;; |
550 ;; Any other value is treated as nil. | 598 ;; Any other value is treated as nil. |
551 ;; | 599 ;; |
552 ;; The default value is `lpr-switches'. | 600 ;; The default value is `lpr-switches'. |
553 ;; | 601 ;; |
554 ;; WARNING: The setpagedevice PostScript operator affects ghostview utility when | 602 ;; WARNING: The setpagedevice PostScript operator affects ghostview utility |
555 ;; viewing file generated using landscape. Also on some printers, | 603 ;; when viewing file generated using landscape. Also on some |
556 ;; setpagedevice affects zebra stripes; on other printers, | 604 ;; printers, setpagedevice affects zebra stripes; on other printers, |
557 ;; setpagedevice affects the left margin. | 605 ;; setpagedevice affects the left margin. |
558 ;; Besides all that, if your printer does not have the paper size | 606 ;; Besides all that, if your printer does not have the paper size |
559 ;; specified by setpagedevice, your printing will be aborted. | 607 ;; specified by setpagedevice, your printing will be aborted. |
560 ;; So, if you need to use setpagedevice, set `ps-spool-config' to | 608 ;; So, if you need to use setpagedevice, set `ps-spool-config' to |
561 ;; `setpagedevice', generate a test file and send it to your printer; | 609 ;; `setpagedevice', generate a test file and send it to your printer; |
562 ;; if the printed file isn't ok, set `ps-spool-config' to nil. | 610 ;; if the printed file isn't ok, set `ps-spool-config' to nil. |
563 ;; | 611 ;; |
564 ;; The variable `ps-spool-tumble' specifies how the page images on opposite | 612 ;; The variable `ps-spool-tumble' specifies how the page images on opposite |
565 ;; sides of a sheet are oriented with respect to each other. If | 613 ;; sides of a sheet are oriented with respect to each other. If |
566 ;; `ps-spool-tumble' is nil, produces output suitable for binding on the left or | 614 ;; `ps-spool-tumble' is nil, produces output suitable for binding on the left |
567 ;; right. If `ps-spool-tumble' is non-nil, produces output suitable for binding | 615 ;; or right. If `ps-spool-tumble' is non-nil, produces output suitable for |
568 ;; at the top or bottom. It has effect only when `ps-spool-duplex' is non-nil. | 616 ;; binding at the top or bottom. It has effect only when `ps-spool-duplex' is |
569 ;; The default value is nil. | 617 ;; non-nil. The default value is nil. |
570 ;; | 618 ;; |
571 ;; Some printer system prints a header page and forces the first page be printed | 619 ;; Some printer system prints a header page and forces the first page be |
572 ;; on header page back, when using duplex. If your printer system has this | 620 ;; printed on header page back, when using duplex. If your printer system has |
573 ;; behavior, set variable `ps-banner-page-when-duplexing' to t. | 621 ;; this behavior, set variable `ps-banner-page-when-duplexing' to t. |
574 ;; | 622 ;; |
575 ;; When `ps-banner-page-when-duplexing' is non-nil means the very first page is | 623 ;; When `ps-banner-page-when-duplexing' is non-nil, it prints a blank page as |
576 ;; skipped. It's like the very first character of buffer (or region) is ^L | 624 ;; the very first printed page. So, it behaves as the very first character of |
577 ;; (\014). | 625 ;; buffer (or region) is ^L (\014). |
578 ;; | 626 ;; |
579 ;; The default for `ps-banner-page-when-duplexing' is nil (*don't* skip the very | 627 ;; The default for `ps-banner-page-when-duplexing' is nil (*don't* skip the |
580 ;; first page). | 628 ;; very first page). |
581 ;; | 629 ;; |
582 ;; | 630 ;; |
583 ;; N-up Printing | 631 ;; N-up Printing |
584 ;; ------------- | 632 ;; ------------- |
585 ;; | 633 ;; |
586 ;; The variable `ps-n-up-printing' specifies the number of pages per sheet of | 634 ;; The variable `ps-n-up-printing' specifies the number of pages per sheet of |
587 ;; paper. The value specified must be between 1 and 100. The default is 1. | 635 ;; paper. The value specified must be between 1 and 100. The default is 1. |
588 ;; | 636 ;; |
589 ;; NOTE: some PostScript printer may crash printing if `ps-n-up-printing' is set | 637 ;; NOTE: some PostScript printer may crash printing if `ps-n-up-printing' is |
590 ;; to a high value (for example, 23). If this happens, set a lower value. | 638 ;; set to a high value (for example, 23). If this happens, set a lower value. |
591 ;; | 639 ;; |
592 ;; The variable `ps-n-up-margin' specifies the margin in points between the | 640 ;; The variable `ps-n-up-margin' specifies the margin in points between the |
593 ;; sheet border and the n-up printing. The default is 1 cm (or 0.3937 inches, | 641 ;; sheet border and the n-up printing. The default is 1 cm (or 0.3937 inches, |
594 ;; or 28.35 points). | 642 ;; or 28.35 points). |
595 ;; | 643 ;; |
596 ;; If variable `ps-n-up-border-p' is non-nil a border is drawn around each page. | 644 ;; If variable `ps-n-up-border-p' is non-nil a border is drawn around each |
597 ;; The default is t. | 645 ;; page. The default is t. |
598 ;; | 646 ;; |
599 ;; The variable `ps-n-up-filling' specifies how page matrix is filled on each | 647 ;; The variable `ps-n-up-filling' specifies how page matrix is filled on each |
600 ;; sheet of paper. Following are the valid values for `ps-n-up-filling' with a | 648 ;; sheet of paper. Following are the valid values for `ps-n-up-filling' with a |
601 ;; filling example using a 3x4 page matrix: | 649 ;; filling example using a 3x4 page matrix: |
602 ;; | 650 ;; |
664 ;; ----------- | 712 ;; ----------- |
665 ;; | 713 ;; |
666 ;; The variable `ps-line-number' specifies whether to number each line; | 714 ;; The variable `ps-line-number' specifies whether to number each line; |
667 ;; non-nil means do so. The default is nil (don't number each line). | 715 ;; non-nil means do so. The default is nil (don't number each line). |
668 ;; | 716 ;; |
717 ;; The variable `ps-line-number-color' specifies the color for line number. | |
718 ;; See `ps-zebra-color' for documentation. The default is "black" (or 0.0, or | |
719 ;; '(0.0 0.0 0.0)). | |
720 ;; | |
669 ;; The variable `ps-line-number-font' specifies the font for line number. | 721 ;; The variable `ps-line-number-font' specifies the font for line number. |
670 ;; The default is "Times-Italic". | 722 ;; The default is "Times-Italic". |
671 ;; | 723 ;; |
672 ;; The variable `ps-line-number-font-size' specifies the font size in points | 724 ;; The variable `ps-line-number-font-size' specifies the font size in points |
673 ;; for line number. See `ps-font-size' for documentation. The default is 6. | 725 ;; for line number. See `ps-font-size' for documentation. The default is 6. |
674 ;; | 726 ;; |
675 ;; The variable `ps-line-number-step' specifies the interval that line number is | 727 ;; The variable `ps-line-number-step' specifies the interval that line number |
676 ;; printed. For example, if `ps-line-number-step' is set to 2, the printing | 728 ;; is printed. For example, if `ps-line-number-step' is set to 2, the printing |
677 ;; will look like: | 729 ;; will look like: |
678 ;; | 730 ;; |
679 ;; 1 one line | 731 ;; 1 one line |
680 ;; one line | 732 ;; one line |
681 ;; 3 one line | 733 ;; 3 one line |
688 ;; | 740 ;; |
689 ;; integer an integer that specifies the interval that line number is | 741 ;; integer an integer that specifies the interval that line number is |
690 ;; printed. If it's lesser than or equal to zero, it's used the | 742 ;; printed. If it's lesser than or equal to zero, it's used the |
691 ;; value 1. | 743 ;; value 1. |
692 ;; | 744 ;; |
693 ;; `zebra' specifies that only the line number of the first line in a zebra | 745 ;; `zebra' specifies that only the line number of the first line in a |
694 ;; stripe is to be printed. | 746 ;; zebra stripe is to be printed. |
695 ;; | 747 ;; |
696 ;; Any other value is treated as `zebra'. | 748 ;; Any other value is treated as `zebra'. |
697 ;; The default value is 1, so each line number is printed. | 749 ;; The default value is 1, so each line number is printed. |
698 ;; | 750 ;; |
699 ;; The variable `ps-line-number-start' specifies the starting point in the | 751 ;; The variable `ps-line-number-start' specifies the starting point in the |
700 ;; interval given by `ps-line-number-step'. For example, if | 752 ;; interval given by `ps-line-number-step'. For example, if |
701 ;; `ps-line-number-step' is set to 3 and `ps-line-number-start' is set to 3, the | 753 ;; `ps-line-number-step' is set to 3 and `ps-line-number-start' is set to 3, |
702 ;; printing will look like: | 754 ;; the printing will look like: |
703 ;; | 755 ;; |
704 ;; one line | 756 ;; one line |
705 ;; one line | 757 ;; one line |
706 ;; 3 one line | 758 ;; 3 one line |
707 ;; one line | 759 ;; one line |
719 ;; of `ps-line-number-step' inclusive. | 771 ;; of `ps-line-number-step' inclusive. |
720 ;; | 772 ;; |
721 ;; * If `ps-line-number-step' is set to `zebra', must be between 1 and the | 773 ;; * If `ps-line-number-step' is set to `zebra', must be between 1 and the |
722 ;; value of `ps-zebra-stripe-height' inclusive. | 774 ;; value of `ps-zebra-stripe-height' inclusive. |
723 ;; | 775 ;; |
724 ;; The default value is 1, so the line number of the first line of each interval | 776 ;; The default value is 1, so the line number of the first line of each |
725 ;; is printed. | 777 ;; interval is printed. |
726 ;; | 778 ;; |
727 ;; | 779 ;; |
728 ;; Zebra Stripes | 780 ;; Zebra Stripes |
729 ;; ------------- | 781 ;; ------------- |
730 ;; | 782 ;; |
731 ;; Zebra stripes are a kind of background that appear "underneath" the text | 783 ;; Zebra stripes are a kind of background that appear "underneath" the text and |
732 ;; and can make the text easier to read. They look like this: | 784 ;; can make the text easier to read. They look like this: |
733 ;; | 785 ;; |
734 ;; XXXXXXXXXXXXXXXXXXXXXXXX | 786 ;; XXXXXXXXXXXXXXXXXXXXXXXX |
735 ;; XXXXXXXXXXXXXXXXXXXXXXXX | 787 ;; XXXXXXXXXXXXXXXXXXXXXXXX |
736 ;; XXXXXXXXXXXXXXXXXXXXXXXX | 788 ;; XXXXXXXXXXXXXXXXXXXXXXXX |
737 ;; | 789 ;; |
742 ;; XXXXXXXXXXXXXXXXXXXXXXXX | 794 ;; XXXXXXXXXXXXXXXXXXXXXXXX |
743 ;; | 795 ;; |
744 ;; The blocks of X's represent rectangles filled with a light gray color. | 796 ;; The blocks of X's represent rectangles filled with a light gray color. |
745 ;; Each rectangle extends all the way across the page. | 797 ;; Each rectangle extends all the way across the page. |
746 ;; | 798 ;; |
747 ;; The height, in lines, of each rectangle is controlled by | 799 ;; The height, in lines, of each rectangle is controlled by the variable |
748 ;; the variable `ps-zebra-stripe-height', which is 3 by default. | 800 ;; `ps-zebra-stripe-height', which is 3 by default. The distance between |
749 ;; The distance between stripes equals the height of a stripe. | 801 ;; stripes equals the height of a stripe. |
750 ;; | 802 ;; |
751 ;; The variable `ps-zebra-stripes' controls whether to print zebra stripes. | 803 ;; The variable `ps-zebra-stripes' controls whether to print zebra stripes. |
752 ;; Non-nil means yes, nil means no. The default is nil. | 804 ;; Non-nil means yes, nil means no. The default is nil. |
753 ;; | 805 ;; |
754 ;; The variable `ps-zebra-color' controls the zebra stripes gray scale or RGB | 806 ;; The variable `ps-zebra-color' controls the zebra stripes gray scale or RGB |
808 ;; It is evaluated on each beginning of sheet of paper. | 860 ;; It is evaluated on each beginning of sheet of paper. |
809 ;; If `ps-n-up-printing' is equal to 1, `ps-print-begin-page-hook' is never | 861 ;; If `ps-n-up-printing' is equal to 1, `ps-print-begin-page-hook' is never |
810 ;; evaluated. | 862 ;; evaluated. |
811 ;; | 863 ;; |
812 ;; `ps-print-begin-page-hook' | 864 ;; `ps-print-begin-page-hook' |
813 ;; It is evaluated on each beginning of page, except in the beginning | 865 ;; It is evaluated on each beginning of page, except in the beginning of |
814 ;; of page that `ps-print-begin-sheet-hook' is evaluated. | 866 ;; page that `ps-print-begin-sheet-hook' is evaluated. |
815 ;; | 867 ;; |
816 ;; `ps-print-begin-column-hook' | 868 ;; `ps-print-begin-column-hook' |
817 ;; It is evaluated on each beginning of column, except in the beginning | 869 ;; It is evaluated on each beginning of column, except in the beginning of |
818 ;; of column that `ps-print-begin-page-hook' is evaluated or that | 870 ;; column that `ps-print-begin-page-hook' is evaluated or that |
819 ;; `ps-print-begin-sheet-hook' is evaluated. | 871 ;; `ps-print-begin-sheet-hook' is evaluated. |
820 ;; | 872 ;; |
821 ;; | 873 ;; |
822 ;; Font Managing | 874 ;; Font Managing |
823 ;; ------------- | 875 ;; ------------- |
824 ;; | 876 ;; |
825 ;; ps-print now knows rather precisely some fonts: the variable | 877 ;; ps-print now knows rather precisely some fonts: the variable |
826 ;; `ps-font-info-database' contains information for a list of font families | 878 ;; `ps-font-info-database' contains information for a list of font families |
827 ;; (currently mainly `Courier' `Helvetica' `Times' `Palatino' `Helvetica-Narrow' | 879 ;; (currently mainly `Courier' `Helvetica' `Times' `Palatino' |
828 ;; `NewCenturySchlbk'). Each font family contains the font names for standard, | 880 ;; `Helvetica-Narrow' `NewCenturySchlbk'). Each font family contains the font |
829 ;; bold, italic and bold-italic characters, a reference size (usually 10) and | 881 ;; names for standard, bold, italic and bold-italic characters, a reference |
830 ;; the corresponding line height, width of a space and average character width. | 882 ;; size (usually 10) and the corresponding line height, width of a space and |
883 ;; average character width. | |
831 ;; | 884 ;; |
832 ;; The variable `ps-font-family' determines which font family is to be used for | 885 ;; The variable `ps-font-family' determines which font family is to be used for |
833 ;; ordinary text. If its value does not correspond to a known font family, an | 886 ;; ordinary text. If its value does not correspond to a known font family, an |
834 ;; error message is printed into the `*Messages*' buffer, which lists the | 887 ;; error message is printed into the `*Messages*' buffer, which lists the |
835 ;; currently available font families. | 888 ;; currently available font families. |
836 ;; | 889 ;; |
837 ;; The variable `ps-font-size' determines the size (in points) of the font for | 890 ;; The variable `ps-font-size' determines the size (in points) of the font for |
838 ;; ordinary text, when generating PostScript. Its value is a float or a cons of | 891 ;; ordinary text, when generating PostScript. Its value is a float or a cons |
839 ;; floats which has the following form: | 892 ;; of floats which has the following form: |
840 ;; | 893 ;; |
841 ;; (LANDSCAPE-SIZE . PORTRAIT-SIZE) | 894 ;; (LANDSCAPE-SIZE . PORTRAIT-SIZE) |
842 ;; | 895 ;; |
843 ;; Similarly, the variable `ps-header-font-family' determines which font family | 896 ;; Similarly, the variable `ps-header-font-family' determines which font family |
844 ;; is to be used for text in the header. | 897 ;; is to be used for text in the header. |
845 ;; | 898 ;; |
846 ;; The variable `ps-header-font-size' determines the font size, in points, for | 899 ;; The variable `ps-header-font-size' determines the font size, in points, for |
847 ;; text in the header (similar to `ps-font-size'). | 900 ;; text in the header (similar to `ps-font-size'). |
848 ;; | 901 ;; |
849 ;; The variable `ps-header-title-font-size' determines the font size, in points, | 902 ;; The variable `ps-header-title-font-size' determines the font size, in |
850 ;; for the top line of text in the header (similar to `ps-font-size'). | 903 ;; points, for the top line of text in the header (similar to `ps-font-size'). |
851 ;; | 904 ;; |
852 ;; The variable `ps-line-spacing' determines the line spacing, in points, for | 905 ;; The variable `ps-line-spacing' determines the line spacing, in points, for |
853 ;; ordinary text, when generating PostScript (similar to `ps-font-size'). The | 906 ;; ordinary text, when generating PostScript (similar to `ps-font-size'). The |
854 ;; default value is 0 (zero = no line spacing). | 907 ;; default value is 0 (zero = no line spacing). |
855 ;; | 908 ;; |
871 ;; be set to "^Local Variables:" and "^End:", respectively, in order to leave | 924 ;; be set to "^Local Variables:" and "^End:", respectively, in order to leave |
872 ;; out some special printing instructions from the actual print. Special | 925 ;; out some special printing instructions from the actual print. Special |
873 ;; printing instructions may be appended to the end of the file just like any | 926 ;; printing instructions may be appended to the end of the file just like any |
874 ;; other buffer-local variables. See section "Local Variables in Files" on | 927 ;; other buffer-local variables. See section "Local Variables in Files" on |
875 ;; Emacs manual for more information. | 928 ;; Emacs manual for more information. |
876 ;; | 929 ;; |
877 ;; Variables `ps-begin-cut-regexp' and `ps-end-cut-regexp' control together what | 930 ;; Variables `ps-begin-cut-regexp' and `ps-end-cut-regexp' control together |
878 ;; actually gets printed. Both variables may be set to nil in which case no | 931 ;; what actually gets printed. Both variables may be set to nil in which case |
879 ;; cutting occurs. By default, both variables are set to nil. | 932 ;; no cutting occurs. By default, both variables are set to nil. |
880 ;; | 933 ;; |
881 ;; | 934 ;; |
882 ;; Adding a New Font Family | 935 ;; Adding a New Font Family |
883 ;; ------------------------ | 936 ;; ------------------------ |
884 ;; | 937 ;; |
885 ;; To use a new font family, you MUST first teach ps-print | 938 ;; To use a new font family, you MUST first teach ps-print this font, i.e., add |
886 ;; this font, i.e., add its information to `ps-font-info-database', | 939 ;; its information to `ps-font-info-database', otherwise ps-print cannot |
887 ;; otherwise ps-print cannot correctly place line and page breaks. | 940 ;; correctly place line and page breaks. |
888 ;; | 941 ;; |
889 ;; For example, assuming `Helvetica' is unknown, | 942 ;; For example, assuming `Helvetica' is unknown, you first need to do the |
890 ;; you first need to do the following ONLY ONCE: | 943 ;; following ONLY ONCE: |
891 ;; | 944 ;; |
892 ;; - create a new buffer | 945 ;; - create a new buffer |
893 ;; - generate the PostScript image to a file (C-u M-x ps-print-buffer) | 946 ;; - generate the PostScript image to a file (C-u M-x ps-print-buffer) |
894 ;; - open this file and find the line: | 947 ;; - open this file and find the line: |
895 ;; `% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage' | 948 ;; `% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage' |
896 ;; - delete the leading `%' (which is the PostScript comment character) | 949 ;; - delete the leading `%' (which is the PostScript comment character) |
897 ;; - replace in this line `Courier' by the new font (say `Helvetica') | 950 ;; - replace in this line `Courier' by the new font (say `Helvetica') to get |
898 ;; to get the line: | 951 ;; the line: |
899 ;; `3 cm 20 cm moveto 10/Helvetica ReportFontInfo showpage' | 952 ;; `3 cm 20 cm moveto 10/Helvetica ReportFontInfo showpage' |
900 ;; - send this file to the printer (or to ghostscript). | 953 ;; - send this file to the printer (or to ghostscript). |
901 ;; You should read the following on the output page: | 954 ;; You should read the following on the output page: |
902 ;; | 955 ;; |
903 ;; For Helvetica 10 point, the line height is 11.56, the space width is 2.78 | 956 ;; For Helvetica 10 point, the line height is 11.56, the space width is 2.78 |
916 ;; (space-width . 2.78) | 969 ;; (space-width . 2.78) |
917 ;; (avg-char-width . 5.09243))) | 970 ;; (avg-char-width . 5.09243))) |
918 ;; ps-font-info-database)) | 971 ;; ps-font-info-database)) |
919 ;; - Now you can use this font family with any size: | 972 ;; - Now you can use this font family with any size: |
920 ;; (setq ps-font-family 'Helvetica) | 973 ;; (setq ps-font-family 'Helvetica) |
921 ;; - if you want to use this family in another emacs session, you must | 974 ;; - if you want to use this family in another emacs session, you must put into |
922 ;; put into your `~/.emacs': | 975 ;; your `~/.emacs': |
923 ;; (require 'ps-print) | 976 ;; (require 'ps-print) |
924 ;; (setq ps-font-info-database (append ...))) | 977 ;; (setq ps-font-info-database (append ...))) |
925 ;; if you don't want to load ps-print, you have to copy the whole value: | 978 ;; if you don't want to load ps-print, you have to copy the whole value: |
926 ;; (setq ps-font-info-database '(<your stuff> <the standard stuff>)) | 979 ;; (setq ps-font-info-database '(<your stuff> <the standard stuff>)) |
927 ;; or, use `ps-print-hook' (see section Hooks): | 980 ;; or, use `ps-print-hook' (see section Hooks): |
943 ;; (avg-char-width . 6.0)) | 996 ;; (avg-char-width . 6.0)) |
944 ;; | 997 ;; |
945 ;; Now you can use your new font family with any size: | 998 ;; Now you can use your new font family with any size: |
946 ;; (setq ps-font-family 'my-mixed-family) | 999 ;; (setq ps-font-family 'my-mixed-family) |
947 ;; | 1000 ;; |
948 ;; Note that on above example the `w3-table-hack-x-face' entry refers to | 1001 ;; Note that on above example the `w3-table-hack-x-face' entry refers to a face |
949 ;; a face symbol, so when printing this face it'll be used the font | 1002 ;; symbol, so when printing this face it'll be used the font `LineDrawNormal'. |
950 ;; `LineDrawNormal'. If the face `w3-table-hack-x-face' is remapped to | 1003 ;; If the face `w3-table-hack-x-face' is remapped to use bold and/or italic |
951 ;; use bold and/or italic attribute, the corresponding entry (bold, italic | 1004 ;; attribute, the corresponding entry (bold, italic or bold-italic) will be |
952 ;; or bold-italic) will be used instead of `w3-table-hack-x-face' entry. | 1005 ;; used instead of `w3-table-hack-x-face' entry. |
953 ;; | 1006 ;; |
954 ;; Note also that the font family entry order is irrelevant, so the above | 1007 ;; Note also that the font family entry order is irrelevant, so the above |
955 ;; example could also be written: | 1008 ;; example could also be written: |
956 ;; (my-mixed-family | 1009 ;; (my-mixed-family |
957 ;; (size . 10.0) | 1010 ;; (size . 10.0) |
970 ;; You can get information on all the fonts resident in YOUR printer | 1023 ;; You can get information on all the fonts resident in YOUR printer |
971 ;; by uncommenting the line: | 1024 ;; by uncommenting the line: |
972 ;; % 3 cm 20 cm moveto ReportAllFontInfo showpage | 1025 ;; % 3 cm 20 cm moveto ReportAllFontInfo showpage |
973 ;; | 1026 ;; |
974 ;; The PostScript file should be sent to YOUR PostScript printer. | 1027 ;; The PostScript file should be sent to YOUR PostScript printer. |
975 ;; If you send it to ghostscript or to another PostScript printer, | 1028 ;; If you send it to ghostscript or to another PostScript printer, you may get |
976 ;; you may get slightly different results. | 1029 ;; slightly different results. |
977 ;; Anyway, as ghostscript fonts are autoload, you won't get much font info. | 1030 ;; Anyway, as ghostscript fonts are autoload, you won't get much font info. |
978 ;; | 1031 ;; |
979 ;; Note also that ps-print DOESN'T download any font to your printer, instead | 1032 ;; Note also that ps-print DOESN'T download any font to your printer, instead |
980 ;; it uses the fonts resident in your printer. | 1033 ;; it uses the fonts resident in your printer. |
981 ;; | 1034 ;; |
982 ;; | 1035 ;; |
983 ;; How Ps-Print Deals With Faces | 1036 ;; How Ps-Print Deals With Faces |
984 ;; ----------------------------- | 1037 ;; ----------------------------- |
985 ;; | 1038 ;; |
986 ;; The ps-print-*-with-faces commands attempt to determine which faces | 1039 ;; The ps-print-*-with-faces commands attempt to determine which faces should |
987 ;; should be printed in bold or italic, but their guesses aren't | 1040 ;; be printed in bold or italic, but their guesses aren't always right. For |
988 ;; always right. For example, you might want to map colors into faces | 1041 ;; example, you might want to map colors into faces so that blue faces print in |
989 ;; so that blue faces print in bold, and red faces in italic. | 1042 ;; bold, and red faces in italic. |
990 ;; | 1043 ;; |
991 ;; It is possible to force ps-print to consider specific faces bold, | 1044 ;; It is possible to force ps-print to consider specific faces bold, italic or |
992 ;; italic or underline, no matter what font they are displayed in, by setting | 1045 ;; underline, no matter what font they are displayed in, by setting the |
993 ;; the variables `ps-bold-faces', `ps-italic-faces' and `ps-underlined-faces'. | 1046 ;; variables `ps-bold-faces', `ps-italic-faces' and `ps-underlined-faces'. |
994 ;; These variables contain lists of faces that ps-print should consider bold, | 1047 ;; These variables contain lists of faces that ps-print should consider bold, |
995 ;; italic or underline; to set them, put code like the following into your | 1048 ;; italic or underline; to set them, put code like the following into your |
996 ;; .emacs file: | 1049 ;; .emacs file: |
997 ;; | 1050 ;; |
998 ;; (setq ps-bold-faces '(my-blue-face)) | 1051 ;; (setq ps-bold-faces '(my-blue-face)) |
999 ;; (setq ps-italic-faces '(my-red-face)) | 1052 ;; (setq ps-italic-faces '(my-red-face)) |
1000 ;; (setq ps-underlined-faces '(my-green-face)) | 1053 ;; (setq ps-underlined-faces '(my-green-face)) |
1001 ;; | 1054 ;; |
1002 ;; Faces like bold-italic that are both bold and italic should go in | 1055 ;; Faces like bold-italic that are both bold and italic should go in *both* |
1003 ;; *both* lists. | 1056 ;; lists. |
1004 ;; | 1057 ;; |
1005 ;; ps-print keeps internal lists of which fonts are bold and which are | 1058 ;; ps-print keeps internal lists of which fonts are bold and which are italic; |
1006 ;; italic; these lists are built the first time you invoke ps-print. | 1059 ;; these lists are built the first time you invoke ps-print. |
1007 ;; For the sake of efficiency, the lists are built only once; the same | 1060 ;; For the sake of efficiency, the lists are built only once; the same lists |
1008 ;; lists are referred in later invocations of ps-print. | 1061 ;; are referred in later invocations of ps-print. |
1009 ;; | 1062 ;; |
1010 ;; Because these lists are built only once, it's possible for them to | 1063 ;; Because these lists are built only once, it's possible for them to get out |
1011 ;; get out of sync, if a face changes, or if new faces are added. To | 1064 ;; of sync, if a face changes, or if new faces are added. To get the lists |
1012 ;; get the lists back in sync, you can set the variable | 1065 ;; back in sync, you can set the variable `ps-build-face-reference' to t, and |
1013 ;; `ps-build-face-reference' to t, and the lists will be rebuilt the | 1066 ;; the lists will be rebuilt the next time ps-print is invoked. If you need |
1014 ;; next time ps-print is invoked. If you need that the lists always be | 1067 ;; that the lists always be rebuilt when ps-print is invoked, set the variable |
1015 ;; rebuilt when ps-print is invoked, set the variable | |
1016 ;; `ps-always-build-face-reference' to t. | 1068 ;; `ps-always-build-face-reference' to t. |
1017 ;; | 1069 ;; |
1018 ;; If you need to print without worrying about face background color, set the | 1070 ;; If you need to print without worrying about face background color, set the |
1019 ;; variable `ps-use-face-background' which specifies if face background should | 1071 ;; variable `ps-use-face-background' which specifies if face background should |
1020 ;; be used. Valid values are: | 1072 ;; be used. Valid values are: |
1028 ;; | 1080 ;; |
1029 ;; | 1081 ;; |
1030 ;; How Ps-Print Deals With Color | 1082 ;; How Ps-Print Deals With Color |
1031 ;; ----------------------------- | 1083 ;; ----------------------------- |
1032 ;; | 1084 ;; |
1033 ;; ps-print detects faces with foreground and background colors | 1085 ;; ps-print detects faces with foreground and background colors defined and |
1034 ;; defined and embeds color information in the PostScript image. | 1086 ;; embeds color information in the PostScript image. |
1035 ;; The default foreground and background colors are defined by the | 1087 ;; The default foreground and background colors are defined by the variables |
1036 ;; variables `ps-default-fg' and `ps-default-bg'. | 1088 ;; `ps-default-fg' and `ps-default-bg'. |
1037 ;; On black-and-white printers, colors are displayed in gray scale. | 1089 ;; On black-and-white printers, colors are displayed in gray scale. |
1038 ;; To turn off color output, set `ps-print-color-p' to nil. | 1090 ;; To turn off color output, set `ps-print-color-p' to nil. |
1039 ;; | 1091 ;; |
1040 ;; | 1092 ;; |
1041 ;; How Ps-Print Maps Faces | 1093 ;; How Ps-Print Maps Faces |
1042 ;; ----------------------- | 1094 ;; ----------------------- |
1043 ;; | 1095 ;; |
1044 ;; As ps-print uses PostScript to print buffers, it is possible to have | 1096 ;; As ps-print uses PostScript to print buffers, it is possible to have other |
1045 ;; other attributes associated with faces. So the new attributes used | 1097 ;; attributes associated with faces. So the new attributes used by ps-print |
1046 ;; by ps-print are: | 1098 ;; are: |
1047 ;; | 1099 ;; |
1048 ;; strikeout - like underline, but the line is in middle of text. | 1100 ;; strikeout - like underline, but the line is in middle of text. |
1049 ;; overline - like underline, but the line is over the text. | 1101 ;; overline - like underline, but the line is over the text. |
1050 ;; shadow - text will have a shadow. | 1102 ;; shadow - text will have a shadow. |
1051 ;; box - text will be surrounded by a box. | 1103 ;; box - text will be surrounded by a box. |
1056 ;; Let's, for example, remap `font-lock-keyword-face' to another foreground | 1108 ;; Let's, for example, remap `font-lock-keyword-face' to another foreground |
1057 ;; color and bold attribute: | 1109 ;; color and bold attribute: |
1058 ;; | 1110 ;; |
1059 ;; (ps-extend-face '(font-lock-keyword-face "RoyalBlue" nil bold) 'MERGE) | 1111 ;; (ps-extend-face '(font-lock-keyword-face "RoyalBlue" nil bold) 'MERGE) |
1060 ;; | 1112 ;; |
1061 ;; If you want to use a new face, define it first with `defface', | 1113 ;; If you want to use a new face, define it first with `defface', and then call |
1062 ;; and then call `ps-extend-face' to specify how to print it. | 1114 ;; `ps-extend-face' to specify how to print it. |
1063 ;; | 1115 ;; |
1064 ;; | 1116 ;; |
1065 ;; How Ps-Print Has A Text And/Or Image On Background | 1117 ;; How Ps-Print Has A Text And/Or Image On Background |
1066 ;; -------------------------------------------------- | 1118 ;; -------------------------------------------------- |
1067 ;; | 1119 ;; |
1094 ;; | 1146 ;; |
1095 ;; (setq ps-print-background-image | 1147 ;; (setq ps-print-background-image |
1096 ;; '(("~/images/EPS-image1.ps" | 1148 ;; '(("~/images/EPS-image1.ps" |
1097 ;; "LeftMargin" "BottomMargin") ; X and Y position (lower left corner) | 1149 ;; "LeftMargin" "BottomMargin") ; X and Y position (lower left corner) |
1098 ;; ("~/images/EPS-image2.ps" | 1150 ;; ("~/images/EPS-image2.ps" |
1099 ;; "LeftMargin" "BottomMargin PrintHeight 2 div add" ; X and Y position | 1151 ;; "LeftMargin" "BottomMargin PrintHeight 2 div add" ; X and Y pos. |
1100 ;; ; (upper left corner) | 1152 ;; ; (upper left corner) |
1101 ;; nil nil nil | 1153 ;; nil nil nil |
1102 ;; 5 (11 . 17)) ; page list | 1154 ;; 5 (11 . 17)) ; page list |
1103 ;; )) | 1155 ;; )) |
1104 ;; | 1156 ;; |
1122 ;; | 1174 ;; |
1123 ;; Some tools are provided to help you customize your font setup. | 1175 ;; Some tools are provided to help you customize your font setup. |
1124 ;; | 1176 ;; |
1125 ;; `ps-setup' returns (some part of) the current setup. | 1177 ;; `ps-setup' returns (some part of) the current setup. |
1126 ;; | 1178 ;; |
1127 ;; To avoid wrapping too many lines, you may want to adjust the | 1179 ;; To avoid wrapping too many lines, you may want to adjust the left and right |
1128 ;; left and right margins and the font size. On UN*X systems, do: | 1180 ;; margins and the font size. On UN*X systems, do: |
1129 ;; pr -t file | awk '{printf "%3d %s\n", length($0), $0}' | sort -r | head | 1181 ;; pr -t file | awk '{printf "%3d %s\n", length($0), $0}' | sort -r | head |
1130 ;; to determine the longest lines of your file. | 1182 ;; to determine the longest lines of your file. |
1131 ;; Then, the command `ps-line-lengths' will give you the correspondence | 1183 ;; Then, the command `ps-line-lengths' will give you the correspondence between |
1132 ;; between a line length (number of characters) and the maximum font | 1184 ;; a line length (number of characters) and the maximum font size which doesn't |
1133 ;; size which doesn't wrap such a line with the current ps-print setup. | 1185 ;; wrap such a line with the current ps-print setup. |
1134 ;; | 1186 ;; |
1135 ;; The commands `ps-nb-pages-buffer' and `ps-nb-pages-region' display | 1187 ;; The commands `ps-nb-pages-buffer' and `ps-nb-pages-region' display the |
1136 ;; the correspondence between a number of pages and the maximum font | 1188 ;; correspondence between a number of pages and the maximum font size which |
1137 ;; size which allow the number of lines of the current buffer or of | 1189 ;; allow the number of lines of the current buffer or of its current region to |
1138 ;; its current region to fit in this number of pages. | 1190 ;; fit in this number of pages. |
1139 ;; | 1191 ;; |
1140 ;; NOTE: line folding is not taken into account in this process and could | 1192 ;; NOTE: line folding is not taken into account in this process and could |
1141 ;; change the results. | 1193 ;; change the results. |
1142 ;; | 1194 ;; |
1143 ;; The command `ps-print-customize' activates a customization buffer for | 1195 ;; The command `ps-print-customize' activates a customization buffer for |
1157 ;; | 1209 ;; |
1158 ;; New since version 2.8 | 1210 ;; New since version 2.8 |
1159 ;; --------------------- | 1211 ;; --------------------- |
1160 ;; | 1212 ;; |
1161 ;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> | 1213 ;; [vinicius] Vinicius Jose Latorre <vinicius@cpqd.com.br> |
1214 ;; | |
1215 ;; 20010407 | |
1216 ;; `ps-line-number-color', `ps-print-footer', `ps-footer-offset', | |
1217 ;; `ps-print-footer-frame', `ps-footer-font-family', | |
1218 ;; `ps-footer-font-size', `ps-footer-line-pad', `ps-footer-lines', | |
1219 ;; `ps-left-footer', `ps-right-footer', `ps-footer-frame-alist' and | |
1220 ;; `ps-header-frame-alist'. | |
1221 ;; | |
1222 ;; 20010328 | |
1223 ;; `ps-line-spacing', `ps-paragraph-spacing', `ps-paragraph-regexp', | |
1224 ;; `ps-begin-cut-regexp' and `ps-end-cut-regexp'. | |
1162 ;; | 1225 ;; |
1163 ;; 20001122 | 1226 ;; 20001122 |
1164 ;; `ps-line-number-font', `ps-line-number-font-size' and | 1227 ;; `ps-line-number-font', `ps-line-number-font-size' and |
1165 ;; `ps-end-with-control-d'. | 1228 ;; `ps-end-with-control-d'. |
1166 ;; | 1229 ;; |
1236 ;; | 1299 ;; |
1237 ;; | 1300 ;; |
1238 ;; Known bugs and limitations of ps-print | 1301 ;; Known bugs and limitations of ps-print |
1239 ;; -------------------------------------- | 1302 ;; -------------------------------------- |
1240 ;; | 1303 ;; |
1241 ;; Although color printing will work in XEmacs 19.12, it doesn't work | 1304 ;; Although color printing will work in XEmacs 19.12, it doesn't work well; in |
1242 ;; well; in particular, bold or italic fonts don't print in the right | 1305 ;; particular, bold or italic fonts don't print in the right background color. |
1243 ;; background color. | |
1244 ;; | 1306 ;; |
1245 ;; Invisible properties aren't correctly ignored in XEmacs 19.12. | 1307 ;; Invisible properties aren't correctly ignored in XEmacs 19.12. |
1246 ;; | 1308 ;; |
1247 ;; Automatic font-attribute detection doesn't work well, especially | 1309 ;; Automatic font-attribute detection doesn't work well, especially with |
1248 ;; with hilit19 and older versions of get-create-face. Users having | 1310 ;; hilit19 and older versions of get-create-face. Users having problems with |
1249 ;; problems with auto-font detection should use the lists | 1311 ;; auto-font detection should use the lists `ps-italic-faces', `ps-bold-faces' |
1250 ;; `ps-italic-faces', `ps-bold-faces' and `ps-underlined-faces' and/or | 1312 ;; and `ps-underlined-faces' and/or turn off automatic detection by setting |
1251 ;; turn off automatic detection by setting `ps-auto-font-detect' to nil. | 1313 ;; `ps-auto-font-detect' to nil. |
1252 ;; | 1314 ;; |
1253 ;; Automatic font-attribute detection doesn't work with XEmacs 19.12 | 1315 ;; Automatic font-attribute detection doesn't work with XEmacs 19.12 in tty |
1254 ;; in tty mode; use the lists `ps-italic-faces', `ps-bold-faces' and | 1316 ;; mode; use the lists `ps-italic-faces', `ps-bold-faces' and |
1255 ;; `ps-underlined-faces' instead. | 1317 ;; `ps-underlined-faces' instead. |
1256 ;; | 1318 ;; |
1257 ;; Still too slow; could use some hand-optimization. | 1319 ;; Still too slow; could use some hand-optimization. |
1258 ;; | 1320 ;; |
1259 ;; Default background color isn't working. | 1321 ;; Default background color isn't working. |
1262 ;; | 1324 ;; |
1263 ;; Epoch and Emacs 19 not supported. At all. | 1325 ;; Epoch and Emacs 19 not supported. At all. |
1264 ;; | 1326 ;; |
1265 ;; Fixed-pitch fonts work better for line folding, but are not required. | 1327 ;; Fixed-pitch fonts work better for line folding, but are not required. |
1266 ;; | 1328 ;; |
1267 ;; `ps-nb-pages-buffer' and `ps-nb-pages-region' don't take care | 1329 ;; `ps-nb-pages-buffer' and `ps-nb-pages-region' don't take care of folding |
1268 ;; of folding lines. | 1330 ;; lines. |
1269 ;; | 1331 ;; |
1270 ;; | 1332 ;; |
1271 ;; Things to change | 1333 ;; Things to change |
1272 ;; ---------------- | 1334 ;; ---------------- |
1273 ;; | 1335 ;; |
1274 ;; Avoid page break inside a paragraph. | 1336 ;; Avoid page break inside a paragraph. |
1275 ;; Add `ps-non-bold-faces' and `ps-non-italic-faces' (should be easy). | 1337 ;; Add `ps-non-bold-faces' and `ps-non-italic-faces' (should be easy). |
1276 ;; Improve the memory management for big files (hard?). | 1338 ;; Improve the memory management for big files (hard?). |
1277 ;; `ps-nb-pages-buffer' and `ps-nb-pages-region' should take care | 1339 ;; `ps-nb-pages-buffer' and `ps-nb-pages-region' should take care of folding |
1278 ;; of folding lines. | 1340 ;; lines. |
1279 ;; | 1341 ;; |
1280 ;; | 1342 ;; |
1281 ;; Acknowledgments | 1343 ;; Acknowledgments |
1282 ;; --------------- | 1344 ;; --------------- |
1345 ;; | |
1346 ;; Thanks to Toni Ronkko <tronkko@hytti.uku.fi> for line and paragraph spacing, | |
1347 ;; region to cut out when printing and footer suggestions. | |
1283 ;; | 1348 ;; |
1284 ;; Thanks to Pavel Janik ml <Pavel@Janik.cz> for documentation correction. | 1349 ;; Thanks to Pavel Janik ml <Pavel@Janik.cz> for documentation correction. |
1285 ;; | 1350 ;; |
1286 ;; Thanks to Corinne Ilvedson <cilvedson@draper.com> for line number font size | 1351 ;; Thanks to Corinne Ilvedson <cilvedson@draper.com> for line number font size |
1287 ;; suggestion. | 1352 ;; suggestion. |
1330 ;; Thanks to some suggestions on: | 1395 ;; Thanks to some suggestions on: |
1331 ;; * Face color map: Marco Melgazzi <marco@techie.com> | 1396 ;; * Face color map: Marco Melgazzi <marco@techie.com> |
1332 ;; * XEmacs compatibility: William J. Henney <will@astrosmo.unam.mx> | 1397 ;; * XEmacs compatibility: William J. Henney <will@astrosmo.unam.mx> |
1333 ;; * Check `ps-paper-type': Sudhakar Frederick <sfrederi@asc.corp.mot.com> | 1398 ;; * Check `ps-paper-type': Sudhakar Frederick <sfrederi@asc.corp.mot.com> |
1334 ;; | 1399 ;; |
1335 ;; Thanks to Jacques Duthen <duthen@cegelec-red.fr> (Jack) for the 3.4 version | 1400 ;; Thanks to Jacques Duthen <duthen@cegelec-red.fr> (Jack) for version 3.4 I |
1336 ;; I started from. [vinicius] | 1401 ;; started from. [vinicius] |
1337 ;; | 1402 ;; |
1338 ;; Thanks to Jim Thompson <?@?> for the 2.8 version I started from. | 1403 ;; Thanks to Jim Thompson <?@?> for the 2.8 version I started from. [jack] |
1339 ;; [jack] | 1404 ;; |
1340 ;; | 1405 ;; Thanks to Kevin Rodgers <kevinr@ihs.com> for adding support for color and |
1341 ;; Thanks to Kevin Rodgers <kevinr@ihs.com> for adding support for | 1406 ;; the invisible property. |
1342 ;; color and the invisible property. | 1407 ;; |
1343 ;; | 1408 ;; Thanks to Avishai Yacobi, avishaiy@mcil.comm.mot.com, for writing the |
1344 ;; Thanks to Avishai Yacobi, avishaiy@mcil.comm.mot.com, for writing | 1409 ;; initial port to Emacs 19. His code is no longer part of ps-print, but his |
1345 ;; the initial port to Emacs 19. His code is no longer part of | 1410 ;; work is still appreciated. |
1346 ;; ps-print, but his work is still appreciated. | 1411 ;; |
1347 ;; | 1412 ;; Thanks to Remi Houdaille and Michel Train, michel@metasoft.fdn.org, for |
1348 ;; Thanks to Remi Houdaille and Michel Train, michel@metasoft.fdn.org, | 1413 ;; adding underline support. Their code also is no longer part of ps-print, |
1349 ;; for adding underline support. Their code also is no longer part of | 1414 ;; but their efforts are not forgotten. |
1350 ;; ps-print, but their efforts are not forgotten. | 1415 ;; |
1351 ;; | 1416 ;; Thanks also to all of you who mailed code to add features to ps-print; |
1352 ;; Thanks also to all of you who mailed code to add features to | 1417 ;; although I didn't use your code, I still appreciate your sharing it with me. |
1353 ;; ps-print; although I didn't use your code, I still appreciate your | |
1354 ;; sharing it with me. | |
1355 ;; | 1418 ;; |
1356 ;; Thanks to all who mailed comments, encouragement, and criticism. | 1419 ;; Thanks to all who mailed comments, encouragement, and criticism. |
1357 ;; Thanks also to all who responded to my survey; I had too many | 1420 ;; Thanks also to all who responded to my survey; I had too many responses to |
1358 ;; responses to reply to them all, but I greatly appreciate your | 1421 ;; reply to them all, but I greatly appreciate your interest. |
1359 ;; interest. | |
1360 ;; | 1422 ;; |
1361 ;; Jim | 1423 ;; Jim |
1362 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1424 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1363 | 1425 |
1364 ;;; Code: | 1426 ;;; Code: |
1464 :prefix "ps-" | 1526 :prefix "ps-" |
1465 :tag "Vertical" | 1527 :tag "Vertical" |
1466 :group 'ps-print) | 1528 :group 'ps-print) |
1467 | 1529 |
1468 (defgroup ps-print-headers nil | 1530 (defgroup ps-print-headers nil |
1469 "Headers layout" | 1531 "Headers & footers layout" |
1470 :prefix "ps-" | 1532 :prefix "ps-" |
1471 :tag "Header" | 1533 :tag "Header & Footer" |
1472 :group 'ps-print) | 1534 :group 'ps-print) |
1473 | 1535 |
1474 (defgroup ps-print-font nil | 1536 (defgroup ps-print-font nil |
1475 "Fonts customization" | 1537 "Fonts customization" |
1476 :prefix "ps-" | 1538 :prefix "ps-" |
1563 | 1625 |
1564 It's strongly recommended only insert PostScript code and/or comments specific | 1626 It's strongly recommended only insert PostScript code and/or comments specific |
1565 for your printing system particularities. For example, some special | 1627 for your printing system particularities. For example, some special |
1566 initialization that only your printing system needs. | 1628 initialization that only your printing system needs. |
1567 | 1629 |
1568 Do not insert code for duplex printing, n-up printing or error handler, ps-print | 1630 Do not insert code for duplex printing, n-up printing or error handler, |
1569 handles this in a suitable way. | 1631 ps-print handles this in a suitable way. |
1570 | 1632 |
1571 For more information about PostScript, see: | 1633 For more information about PostScript, see: |
1572 PostScript Language Reference Manual (2nd edition) | 1634 PostScript Language Reference Manual (2nd edition) |
1573 Adobe Systems Incorporated | 1635 Adobe Systems Incorporated |
1574 | 1636 |
1585 :group 'ps-print-miscellany) | 1647 :group 'ps-print-miscellany) |
1586 | 1648 |
1587 (defcustom ps-print-prologue-header nil | 1649 (defcustom ps-print-prologue-header nil |
1588 "*PostScript prologue header comments besides that ps-print generates. | 1650 "*PostScript prologue header comments besides that ps-print generates. |
1589 | 1651 |
1590 `ps-print-prologue-header' may be a string or a symbol function which | 1652 `ps-print-prologue-header' may be a string or a symbol function which returns a |
1591 returns a string. Note that this string is inserted on PostScript prologue | 1653 string. Note that this string is inserted on PostScript prologue header |
1592 header section which is used to define some document characteristic through | 1654 section which is used to define some document characteristic through PostScript |
1593 PostScript special comments, like \"%%Requirements: jog\\n\". | 1655 special comments, like \"%%Requirements: jog\\n\". |
1594 | 1656 |
1595 ps-print always inserts the %%Requirements: comment, so if you need to insert | 1657 ps-print always inserts the %%Requirements: comment, so if you need to insert |
1596 more requirements put them first in `ps-print-prologue-header' using the | 1658 more requirements put them first in `ps-print-prologue-header' using the |
1597 \"%%+\" comment. For example, if you need to set numcopies to 3 and jog on | 1659 \"%%+\" comment. For example, if you need to set numcopies to 3 and jog on |
1598 requirements and set %%LanguageLevel: to 2, do: | 1660 requirements and set %%LanguageLevel: to 2, do: |
1694 string symbol (repeat sexp))) | 1756 string symbol (repeat sexp))) |
1695 :group 'ps-print-printer) | 1757 :group 'ps-print-printer) |
1696 | 1758 |
1697 (defcustom ps-print-region-function nil | 1759 (defcustom ps-print-region-function nil |
1698 "*Specify a function to print the region on a PostScript printer. | 1760 "*Specify a function to print the region on a PostScript printer. |
1699 See definition of `call-process-region' for calling conventions. The fourth and | 1761 See definition of `call-process-region' for calling conventions. The fourth |
1700 the sixth arguments are both nil." | 1762 and the sixth arguments are both nil." |
1701 :type '(choice (const nil) function) | 1763 :type '(choice (const nil) function) |
1702 :group 'ps-print-printer) | 1764 :group 'ps-print-printer) |
1703 | 1765 |
1704 (defcustom ps-manual-feed nil | 1766 (defcustom ps-manual-feed nil |
1705 "*Non-nil means the printer will manually feed paper. | 1767 "*Non-nil means the printer will manually feed paper. |
1780 "*Non-nil means print in landscape mode." | 1842 "*Non-nil means print in landscape mode." |
1781 :type 'boolean | 1843 :type 'boolean |
1782 :group 'ps-print-page) | 1844 :group 'ps-print-page) |
1783 | 1845 |
1784 (defcustom ps-print-upside-down nil | 1846 (defcustom ps-print-upside-down nil |
1785 "*Non-nil means print upside-down." | 1847 "*Non-nil means print upside-down (that is, it's rotated by 180 grades)." |
1786 :type 'boolean | 1848 :type 'boolean |
1849 :version "21.1" | |
1787 :group 'ps-print-page) | 1850 :group 'ps-print-page) |
1788 | 1851 |
1789 (defcustom ps-selected-pages nil | 1852 (defcustom ps-selected-pages nil |
1790 "*Specify which pages to print. | 1853 "*Specify which pages to print. |
1791 | 1854 |
2052 | 2115 |
2053 integer an integer that specifies the interval that line number is | 2116 integer an integer that specifies the interval that line number is |
2054 printed. If it's lesser than or equal to zero, it's used the | 2117 printed. If it's lesser than or equal to zero, it's used the |
2055 value 1. | 2118 value 1. |
2056 | 2119 |
2057 `zebra' specifies that only the line number of the first line in a zebra | 2120 `zebra' specifies that only the line number of the first line in a |
2058 stripe is to be printed. | 2121 zebra stripe is to be printed. |
2059 | 2122 |
2060 Any other value is treated as `zebra'." | 2123 Any other value is treated as `zebra'." |
2061 :type '(choice :menu-tag "Line Number Step" | 2124 :type '(choice :menu-tag "Line Number Step" |
2062 :tag "Line Number Step" | 2125 :tag "Line Number Step" |
2063 (integer :tag "Step Interval") | 2126 (integer :tag "Step Interval") |
2082 one line | 2145 one line |
2083 ... | 2146 ... |
2084 | 2147 |
2085 The values for `ps-line-number-start': | 2148 The values for `ps-line-number-start': |
2086 | 2149 |
2087 * If `ps-line-number-step' is an integer, must be between 1 and the value | 2150 * If `ps-line-number-step' is an integer, must be between 1 and the value of |
2088 of `ps-line-number-step' inclusive. | 2151 `ps-line-number-step' inclusive. |
2089 | 2152 |
2090 * If `ps-line-number-step' is set to `zebra', must be between 1 and the | 2153 * If `ps-line-number-step' is set to `zebra', must be between 1 and the |
2091 value of `ps-zebra-strip-height' inclusive. Use this combination if you | 2154 value of `ps-zebra-strip-height' inclusive. Use this combination if you |
2092 wish that line number be relative to zebra stripes." | 2155 wish that line number be relative to zebra stripes." |
2093 :type '(integer :tag "Start Step Interval") | 2156 :type '(integer :tag "Start Step Interval") |
2111 If XSCALE and YSCALE are nil, the original size is used. | 2174 If XSCALE and YSCALE are nil, the original size is used. |
2112 | 2175 |
2113 ROTATION is the image rotation angle; if nil, the default is 0. | 2176 ROTATION is the image rotation angle; if nil, the default is 0. |
2114 | 2177 |
2115 PAGES designates the page to print background image. | 2178 PAGES designates the page to print background image. |
2116 PAGES may be a number or a cons cell (FROM . TO) designating FROM page | 2179 PAGES may be a number or a cons cell (FROM . TO) designating FROM page to TO |
2117 to TO page. | 2180 page. |
2118 If PAGES is nil, print background image on all pages. | 2181 If PAGES is nil, print background image on all pages. |
2119 | 2182 |
2120 X, Y, XSCALE, YSCALE and ROTATION may be a floating point number, | 2183 X, Y, XSCALE, YSCALE and ROTATION may be a floating point number, an integer |
2121 an integer number or a string. If it is a string, the string should contain | 2184 number or a string. If it is a string, the string should contain PostScript |
2122 PostScript programming that returns a float or integer value. | 2185 programming that returns a float or integer value. |
2123 | 2186 |
2124 For example, if you wish to print an EPS image on all pages do: | 2187 For example, if you wish to print an EPS image on all pages do: |
2125 | 2188 |
2126 '((\"~/images/EPS-image.ps\"))" | 2189 '((\"~/images/EPS-image.ps\"))" |
2127 :type '(repeat | 2190 :type '(repeat |
2157 FONTSIZE is font size to be used, if nil, 200 is used. | 2220 FONTSIZE is font size to be used, if nil, 200 is used. |
2158 | 2221 |
2159 GRAY is the text gray factor (should be very light like 0.8). | 2222 GRAY is the text gray factor (should be very light like 0.8). |
2160 If nil, the default is 0.85. | 2223 If nil, the default is 0.85. |
2161 | 2224 |
2162 ROTATION is the text rotation angle; if nil, the angle is given by | 2225 ROTATION is the text rotation angle; if nil, the angle is given by the diagonal |
2163 the diagonal from lower left corner to upper right corner. | 2226 from lower left corner to upper right corner. |
2164 | 2227 |
2165 PAGES designates the page to print background text. | 2228 PAGES designates the page to print background text. |
2166 PAGES may be a number or a cons cell (FROM . TO) designating FROM page | 2229 PAGES may be a number or a cons cell (FROM . TO) designating FROM page to TO |
2167 to TO page. | 2230 page. |
2168 If PAGES is nil, print background text on all pages. | 2231 If PAGES is nil, print background text on all pages. |
2169 | 2232 |
2170 X, Y, FONTSIZE, GRAY and ROTATION may be a floating point number, | 2233 X, Y, FONTSIZE, GRAY and ROTATION may be a floating point number, an integer |
2171 an integer number or a string. If it is a string, the string should contain | 2234 number or a string. If it is a string, the string should contain PostScript |
2172 PostScript programming that returns a float or integer value. | 2235 programming that returns a float or integer value. |
2173 | 2236 |
2174 For example, if you wish to print text \"Preliminary\" on all pages do: | 2237 For example, if you wish to print text \"Preliminary\" on all pages do: |
2175 | 2238 |
2176 '((\"Preliminary\"))" | 2239 '((\"Preliminary\"))" |
2177 :type '(repeat | 2240 :type '(repeat |
2246 "*Portion of a header title line height to insert between the header frame | 2309 "*Portion of a header title line height to insert between the header frame |
2247 and the text it contains, both in the vertical and horizontal directions." | 2310 and the text it contains, both in the vertical and horizontal directions." |
2248 :type 'number | 2311 :type 'number |
2249 :group 'ps-print-vertical) | 2312 :group 'ps-print-vertical) |
2250 | 2313 |
2251 ;;; Header setup | 2314 (defcustom ps-footer-offset (/ (* 72 1.0) 2.54) ; 1.0 cm |
2315 "*Vertical space in points (1/72 inch) between the main text and the footer." | |
2316 :type 'number | |
2317 :group 'ps-print-vertical) | |
2318 | |
2319 (defcustom ps-footer-line-pad 0.15 | |
2320 "*Portion of a footer title line height to insert between the footer frame | |
2321 and the text it contains, both in the vertical and horizontal directions." | |
2322 :type 'number | |
2323 :group 'ps-print-vertical) | |
2324 | |
2325 ;;; Header/Footer setup | |
2252 | 2326 |
2253 (defcustom ps-print-header t | 2327 (defcustom ps-print-header t |
2254 "*Non-nil means print a header at the top of each page. | 2328 "*Non-nil means print a header at the top of each page. |
2255 By default, the header displays the buffer name, page number, and, if | 2329 By default, the header displays the buffer name, page number, and, if the |
2256 the buffer is visiting a file, the file's directory. Headers are | 2330 buffer is visiting a file, the file's directory. Headers are customizable by |
2257 customizable by changing variables `ps-left-header' and | 2331 changing variables `ps-left-header' and `ps-right-header'." |
2258 `ps-right-header'." | |
2259 :type 'boolean | |
2260 :group 'ps-print-headers) | |
2261 | |
2262 (defcustom ps-print-only-one-header nil | |
2263 "*Non-nil means print only one header at the top of each page. | |
2264 This is useful when printing more than one column, so it is possible | |
2265 to have only one header over all columns or one header per column. | |
2266 See also `ps-print-header'." | |
2267 :type 'boolean | 2332 :type 'boolean |
2268 :group 'ps-print-headers) | 2333 :group 'ps-print-headers) |
2269 | 2334 |
2270 (defcustom ps-print-header-frame t | 2335 (defcustom ps-print-header-frame t |
2271 "*Non-nil means draw a gaudy frame around the header." | 2336 "*Non-nil means draw a gaudy frame around the header." |
2272 :type 'boolean | 2337 :type 'boolean |
2273 :group 'ps-print-headers) | 2338 :group 'ps-print-headers) |
2274 | 2339 |
2340 (defcustom ps-header-frame-alist | |
2341 '((fore-color . 0) | |
2342 (back-color . 0.9) | |
2343 (border-width . 0.4) | |
2344 (border-color . 0) | |
2345 (shadow-color . 0)) | |
2346 "*Specify header frame properties alist. | |
2347 | |
2348 Valid frame properties are: | |
2349 | |
2350 `fore-color' Specify the foreground frame color. | |
2351 It should be a float number between 0.0 (black color) | |
2352 and 1.0 (white color), a string which is a color name, | |
2353 or a list of 3 float numbers which corresponds to the | |
2354 Red Green Blue color scale, each float number between | |
2355 0.0 (dark color) and 1.0 (bright color). | |
2356 | |
2357 `back-color' Specify the background frame color (similar to | |
2358 `fore-color'). | |
2359 | |
2360 `shadow-color' Specify the shadow color (similar to `fore-color'). | |
2361 | |
2362 `border-color' Specify the border color (similar to `fore-color'). | |
2363 | |
2364 `border-width' Specify the border width. | |
2365 | |
2366 Any other property is ignored. | |
2367 | |
2368 Don't change this alist directly, instead use customization, or `ps-value', | |
2369 `ps-get', `ps-put' and `ps-del' functions (see them for documentation)." | |
2370 :version "21.1" | |
2371 :type '(repeat | |
2372 (choice :menu-tag "Header Frame Element" | |
2373 :tag "" | |
2374 (cons :tag "Foreground Color" :format "%v" | |
2375 (const :format "" fore-color) | |
2376 (choice :menu-tag "Foreground Color" | |
2377 :tag "Foreground Color" | |
2378 (number :tag "Gray Scale" :value 0) | |
2379 (string :tag "Color Name" :value "black") | |
2380 (list :tag "RGB Color" :value (0 0 0) | |
2381 (number :tag "Red") | |
2382 (number :tag "Green") | |
2383 (number :tag "Blue")))) | |
2384 (cons :tag "Background Color" :format "%v" | |
2385 (const :format "" back-color) | |
2386 (choice :menu-tag "Background Color" | |
2387 :tag "Background Color" | |
2388 (number :tag "Gray Scale" :value 0.9) | |
2389 (string :tag "Color Name" :value "gray90") | |
2390 (list :tag "RGB Color" :value (0.9 0.9 0.9) | |
2391 (number :tag "Red") | |
2392 (number :tag "Green") | |
2393 (number :tag "Blue")))) | |
2394 (cons :tag "Border Width" :format "%v" | |
2395 (const :format "" border-width) | |
2396 (number :tag "Border Width" :value 0.4)) | |
2397 (cons :tag "Border Color" :format "%v" | |
2398 (const :format "" border-color) | |
2399 (choice :menu-tag "Border Color" | |
2400 :tag "Border Color" | |
2401 (number :tag "Gray Scale" :value 0) | |
2402 (string :tag "Color Name" :value "black") | |
2403 (list :tag "RGB Color" :value (0 0 0) | |
2404 (number :tag "Red") | |
2405 (number :tag "Green") | |
2406 (number :tag "Blue")))) | |
2407 (cons :tag "Shadow Color" :format "%v" | |
2408 (const :format "" shadow-color) | |
2409 (choice :menu-tag "Shadow Color" | |
2410 :tag "Shadow Color" | |
2411 (number :tag "Gray Scale" :value 0) | |
2412 (string :tag "Color Name" :value "black") | |
2413 (list :tag "RGB Color" :value (0 0 0) | |
2414 (number :tag "Red") | |
2415 (number :tag "Green") | |
2416 (number :tag "Blue")))))) | |
2417 :group 'ps-print-headers) | |
2418 | |
2275 (defcustom ps-header-lines 2 | 2419 (defcustom ps-header-lines 2 |
2276 "*Number of lines to display in page header, when generating PostScript." | 2420 "*Number of lines to display in page header, when generating PostScript." |
2277 :type 'integer | 2421 :type 'integer |
2278 :group 'ps-print-headers) | 2422 :group 'ps-print-headers) |
2279 | 2423 |
2424 (defcustom ps-print-footer nil | |
2425 "*Non-nil means print a footer at the bottom of each page. | |
2426 By default, the footer displays page number. | |
2427 Footers are customizable by changing variables `ps-left-footer' and | |
2428 `ps-right-footer'." | |
2429 :version "21.1" | |
2430 :type 'boolean | |
2431 :group 'ps-print-headers) | |
2432 | |
2433 (defcustom ps-print-footer-frame t | |
2434 "*Non-nil means draw a gaudy frame around the footer." | |
2435 :version "21.1" | |
2436 :type 'boolean | |
2437 :group 'ps-print-headers) | |
2438 | |
2439 (defcustom ps-footer-frame-alist | |
2440 '((fore-color . 0) | |
2441 (back-color . 0.9) | |
2442 (border-width . 0.4) | |
2443 (border-color . 0) | |
2444 (shadow-color . 0)) | |
2445 "*Specify footer frame properties alist. | |
2446 | |
2447 Don't change this alist directly, instead use customization, or `ps-value', | |
2448 `ps-get', `ps-put' and `ps-del' functions (see them for documentation). | |
2449 | |
2450 See also `ps-header-frame-alist' for documentation." | |
2451 :version "21.1" | |
2452 :type '(repeat | |
2453 (choice :menu-tag "Header Frame Element" | |
2454 :tag "" | |
2455 (cons :tag "Foreground Color" :format "%v" | |
2456 (const :format "" fore-color) | |
2457 (choice :menu-tag "Foreground Color" | |
2458 :tag "Foreground Color" | |
2459 (number :tag "Gray Scale" :value 0) | |
2460 (string :tag "Color Name" :value "black") | |
2461 (list :tag "RGB Color" :value (0 0 0) | |
2462 (number :tag "Red") | |
2463 (number :tag "Green") | |
2464 (number :tag "Blue")))) | |
2465 (cons :tag "Background Color" :format "%v" | |
2466 (const :format "" back-color) | |
2467 (choice :menu-tag "Background Color" | |
2468 :tag "Background Color" | |
2469 (number :tag "Gray Scale" :value 0.9) | |
2470 (string :tag "Color Name" :value "gray90") | |
2471 (list :tag "RGB Color" :value (0.9 0.9 0.9) | |
2472 (number :tag "Red") | |
2473 (number :tag "Green") | |
2474 (number :tag "Blue")))) | |
2475 (cons :tag "Border Width" :format "%v" | |
2476 (const :format "" border-width) | |
2477 (number :tag "Border Width" :value 0.4)) | |
2478 (cons :tag "Border Color" :format "%v" | |
2479 (const :format "" border-color) | |
2480 (choice :menu-tag "Border Color" | |
2481 :tag "Border Color" | |
2482 (number :tag "Gray Scale" :value 0) | |
2483 (string :tag "Color Name" :value "black") | |
2484 (list :tag "RGB Color" :value (0 0 0) | |
2485 (number :tag "Red") | |
2486 (number :tag "Green") | |
2487 (number :tag "Blue")))) | |
2488 (cons :tag "Shadow Color" :format "%v" | |
2489 (const :format "" shadow-color) | |
2490 (choice :menu-tag "Shadow Color" | |
2491 :tag "Shadow Color" | |
2492 (number :tag "Gray Scale" :value 0) | |
2493 (string :tag "Color Name" :value "black") | |
2494 (list :tag "RGB Color" :value (0 0 0) | |
2495 (number :tag "Red") | |
2496 (number :tag "Green") | |
2497 (number :tag "Blue")))))) | |
2498 :group 'ps-print-headers) | |
2499 | |
2500 (defcustom ps-footer-lines 2 | |
2501 "*Number of lines to display in page footer, when generating PostScript." | |
2502 :version "21.1" | |
2503 :type 'integer | |
2504 :group 'ps-print-headers) | |
2505 | |
2506 (defcustom ps-print-only-one-header nil | |
2507 "*Non-nil means print only one header/footer at the top/bottom of each page. | |
2508 This is useful when printing more than one column, so it is possible to have | |
2509 only one header/footer over all columns or one header/footer per column. | |
2510 See also `ps-print-header' and `ps-print-footer'." | |
2511 :type 'boolean | |
2512 :group 'ps-print-headers) | |
2513 | |
2280 (defcustom ps-switch-header 'duplex | 2514 (defcustom ps-switch-header 'duplex |
2281 "*Specify if headers are switched or not. | 2515 "*Specify if headers/footers are switched or not. |
2282 | 2516 |
2283 Valid values are: | 2517 Valid values are: |
2284 | 2518 |
2285 nil Never switch headers. | 2519 nil Never switch headers/footers. |
2286 | 2520 |
2287 t Always switch headers. | 2521 t Always switch headers/footers. |
2288 | 2522 |
2289 duplex Switch headers only when duplexing is on, that is, when | 2523 duplex Switch headers/footers only when duplexing is on, that is, when |
2290 `ps-spool-duplex' is non-nil. | 2524 `ps-spool-duplex' is non-nil. |
2291 | 2525 |
2292 Any other value is treated as t." | 2526 Any other value is treated as t. |
2293 :type '(choice :menu-tag "Switch Header" | 2527 |
2294 :tag "Switch Header" | 2528 See also `ps-print-header' and `ps-print-footer'." |
2529 :type '(choice :menu-tag "Switch Header/Footer" | |
2530 :tag "Switch Header/Footer" | |
2295 (const :tag "Never Switch" nil) | 2531 (const :tag "Never Switch" nil) |
2296 (const :tag "Always Switch" t) | 2532 (const :tag "Always Switch" t) |
2297 (const :tag "Switch When Duplexing" duplex)) | 2533 (const :tag "Switch When Duplexing" duplex)) |
2298 :group 'ps-print-headers) | 2534 :group 'ps-print-headers) |
2299 | 2535 |
2306 | 2542 |
2307 (defcustom ps-spool-config | 2543 (defcustom ps-spool-config |
2308 (if ps-windows-system | 2544 (if ps-windows-system |
2309 nil | 2545 nil |
2310 'lpr-switches) | 2546 'lpr-switches) |
2311 "*Specify who is responsable for setting duplex and page size switches. | 2547 "*Specify who is responsible for setting duplex and page size. |
2312 | 2548 |
2313 Valid values are: | 2549 Valid values are: |
2314 | 2550 |
2315 `lpr-switches' duplex and page size are configured by `ps-lpr-switches'. | 2551 `lpr-switches' duplex and page size are configured by `ps-lpr-switches'. |
2316 Don't forget to set `ps-lpr-switches' to select duplex | 2552 Don't forget to set `ps-lpr-switches' to select duplex |
2352 :type 'boolean | 2588 :type 'boolean |
2353 :group 'ps-print-headers) | 2589 :group 'ps-print-headers) |
2354 | 2590 |
2355 (defcustom ps-spool-tumble nil | 2591 (defcustom ps-spool-tumble nil |
2356 "*Specify how the page images on opposite sides of a sheet are oriented. | 2592 "*Specify how the page images on opposite sides of a sheet are oriented. |
2357 If `ps-spool-tumble' is nil, produces output suitable for binding on the left or | 2593 If `ps-spool-tumble' is nil, produces output suitable for binding on the left |
2358 right. If `ps-spool-tumble' is non-nil, produces output suitable for binding at | 2594 or right. If `ps-spool-tumble' is non-nil, produces output suitable for |
2359 the top or bottom. | 2595 binding at the top or bottom. |
2360 | 2596 |
2361 It has effect only when `ps-spool-duplex' is non-nil." | 2597 It has effect only when `ps-spool-duplex' is non-nil." |
2362 :type 'boolean | 2598 :type 'boolean |
2363 :group 'ps-print-headers) | 2599 :group 'ps-print-headers) |
2364 | 2600 |
2471 "*Font info database: font family (the key), name, bold, italic, bold-italic, | 2707 "*Font info database: font family (the key), name, bold, italic, bold-italic, |
2472 reference size, line height, space width, average character width. | 2708 reference size, line height, space width, average character width. |
2473 To get the info for another specific font (say Helvetica), do the following: | 2709 To get the info for another specific font (say Helvetica), do the following: |
2474 - create a new buffer | 2710 - create a new buffer |
2475 - generate the PostScript image to a file (C-u M-x ps-print-buffer) | 2711 - generate the PostScript image to a file (C-u M-x ps-print-buffer) |
2476 - open this file and delete the leading `%' (which is the PostScript | 2712 - open this file and delete the leading `%' (which is the PostScript comment |
2477 comment character) from the line | 2713 character) from the line |
2478 `% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage' | 2714 `% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage' |
2479 to get the line | 2715 to get the line |
2480 `3 cm 20 cm moveto 10/Helvetica ReportFontInfo showpage' | 2716 `3 cm 20 cm moveto 10/Helvetica ReportFontInfo showpage' |
2481 - add the values to `ps-font-info-database'. | 2717 - add the values to `ps-font-info-database'. |
2482 You can get all the fonts of YOUR printer using `ReportAllFontInfo'. | 2718 You can get all the fonts of YOUR printer using `ReportAllFontInfo'. |
2483 | 2719 |
2484 Note also that ps-print DOESN'T download any font to your printer, instead | 2720 Note also that ps-print DOESN'T download any font to your printer, instead it |
2485 it uses the fonts resident in your printer." | 2721 uses the fonts resident in your printer." |
2486 :type '(repeat | 2722 :type '(repeat |
2487 (list :tag "Font Definition" | 2723 (list :tag "Font Definition" |
2488 (symbol :tag "Font Family") | 2724 (symbol :tag "Font Family") |
2489 (cons :format "%v" | 2725 (cons :format "%v" |
2490 (const :format "" fonts) | 2726 (const :format "" fonts) |
2549 (cons :tag "Landscape/Portrait" | 2785 (cons :tag "Landscape/Portrait" |
2550 (number :tag "Landscape Header Title Size") | 2786 (number :tag "Landscape Header Title Size") |
2551 (number :tag "Portrait Header Title Size"))) | 2787 (number :tag "Portrait Header Title Size"))) |
2552 :group 'ps-print-font) | 2788 :group 'ps-print-font) |
2553 | 2789 |
2790 (defcustom ps-footer-font-family 'Helvetica | |
2791 "*Font family name for text in the footer, when generating PostScript." | |
2792 :version "21.1" | |
2793 :type 'symbol | |
2794 :group 'ps-print-font) | |
2795 | |
2796 (defcustom ps-footer-font-size '(10 . 12) | |
2797 "*Font size, in points, for text in the footer, when generating PostScript." | |
2798 :version "21.1" | |
2799 :type '(choice :menu-tag "Footer Font Size" | |
2800 :tag "Footer Font Size" | |
2801 (number :tag "Footer Size") | |
2802 (cons :tag "Landscape/Portrait" | |
2803 (number :tag "Landscape Footer Size") | |
2804 (number :tag "Portrait Footer Size"))) | |
2805 :group 'ps-print-font) | |
2806 | |
2807 (defcustom ps-line-number-color "black" | |
2808 "*Specify color for line-number, when generating PostScript." | |
2809 :type '(choice :menu-tag "Line Number Color" | |
2810 :tag "Line Number Color" | |
2811 (number :tag "Gray Scale" :value 0) | |
2812 (string :tag "Color Name" :value "black") | |
2813 (list :tag "RGB Color" :value (0 0 0) | |
2814 (number :tag "Red") | |
2815 (number :tag "Green") | |
2816 (number :tag "Blue"))) | |
2817 :version "21.1" | |
2818 :group 'ps-print-font | |
2819 :group 'ps-print-miscellany) | |
2820 | |
2554 (defcustom ps-line-number-font "Times-Italic" | 2821 (defcustom ps-line-number-font "Times-Italic" |
2555 "*Font for line-number, when generating PostScript." | 2822 "*Font for line-number, when generating PostScript." |
2556 :type 'string | 2823 :type 'string |
2557 :group 'ps-print-font | 2824 :group 'ps-print-font |
2558 :group 'ps-print-miscellany) | 2825 :group 'ps-print-miscellany) |
2605 (number :tag "Blue"))) | 2872 (number :tag "Blue"))) |
2606 :group 'ps-print-color) | 2873 :group 'ps-print-color) |
2607 | 2874 |
2608 (defcustom ps-auto-font-detect t | 2875 (defcustom ps-auto-font-detect t |
2609 "*Non-nil means automatically detect bold/italic/underline face attributes. | 2876 "*Non-nil means automatically detect bold/italic/underline face attributes. |
2610 If nil, we rely solely on the lists `ps-bold-faces', `ps-italic-faces', | 2877 If nil, we rely solely on the lists `ps-bold-faces', `ps-italic-faces', and |
2611 and `ps-underlined-faces'." | 2878 `ps-underlined-faces'." |
2612 :type 'boolean | 2879 :type 'boolean |
2613 :group 'ps-print-font) | 2880 :group 'ps-print-font) |
2614 | 2881 |
2615 (defcustom ps-bold-faces | 2882 (defcustom ps-bold-faces |
2616 (unless ps-print-color-p | 2883 (unless ps-print-color-p |
2668 (defcustom ps-left-header | 2935 (defcustom ps-left-header |
2669 (list 'ps-get-buffer-name 'ps-header-dirpart) | 2936 (list 'ps-get-buffer-name 'ps-header-dirpart) |
2670 "*The items to display (each on a line) on the left part of the page header. | 2937 "*The items to display (each on a line) on the left part of the page header. |
2671 This applies to generating PostScript. | 2938 This applies to generating PostScript. |
2672 | 2939 |
2673 The value should be a list of strings and symbols, each representing an | 2940 The value should be a list of strings and symbols, each representing an entry |
2674 entry in the PostScript array HeaderLinesLeft. | 2941 in the PostScript array HeaderLinesLeft. |
2675 | 2942 |
2676 Strings are inserted unchanged into the array; those representing | 2943 Strings are inserted unchanged into the array; those representing |
2677 PostScript string literals should be delimited with PostScript string | 2944 PostScript string literals should be delimited with PostScript string |
2678 delimiters '(' and ')'. | 2945 delimiters '(' and ')'. |
2679 | 2946 |
2680 For symbols with bound functions, the function is called and should | 2947 For symbols with bound functions, the function is called and should return a |
2681 return a string to be inserted into the array. For symbols with bound | 2948 string to be inserted into the array. For symbols with bound values, the value |
2682 values, the value should be a string to be inserted into the array. | 2949 should be a string to be inserted into the array. In either case, function or |
2683 In either case, function or variable, the string value has PostScript | 2950 variable, the string value has PostScript string delimiters added to it." |
2684 string delimiters added to it." | |
2685 :type '(repeat (choice :menu-tag "Left Header" | 2951 :type '(repeat (choice :menu-tag "Left Header" |
2686 :tag "Left Header" | 2952 :tag "Left Header" |
2687 string symbol)) | 2953 string symbol)) |
2688 :group 'ps-print-headers) | 2954 :group 'ps-print-headers) |
2689 | 2955 |
2691 (list "/pagenumberstring load" | 2957 (list "/pagenumberstring load" |
2692 'ps-time-stamp-mon-dd-yyyy 'ps-time-stamp-hh:mm:ss) | 2958 'ps-time-stamp-mon-dd-yyyy 'ps-time-stamp-hh:mm:ss) |
2693 "*The items to display (each on a line) on the right part of the page header. | 2959 "*The items to display (each on a line) on the right part of the page header. |
2694 This applies to generating PostScript. | 2960 This applies to generating PostScript. |
2695 | 2961 |
2696 See the variable `ps-left-header' for a description of the format of | 2962 See the variable `ps-left-header' for a description of the format of this |
2697 this variable." | 2963 variable." |
2698 :type '(repeat (choice :menu-tag "Right Header" | 2964 :type '(repeat (choice :menu-tag "Right Header" |
2699 :tag "Right Header" | 2965 :tag "Right Header" |
2700 string symbol)) | 2966 string symbol)) |
2701 :group 'ps-print-headers) | 2967 :group 'ps-print-headers) |
2702 | 2968 |
2969 (defcustom ps-left-footer | |
2970 (list 'ps-get-buffer-name 'ps-header-dirpart) | |
2971 "*The items to display (each on a line) on the left part of the page footer. | |
2972 This applies to generating PostScript. | |
2973 | |
2974 The value should be a list of strings and symbols, each representing an entry | |
2975 in the PostScript array FooterLinesLeft. | |
2976 | |
2977 Strings are inserted unchanged into the array; those representing PostScript | |
2978 string literals should be delimited with PostScript string delimiters '(' and | |
2979 ')'. | |
2980 | |
2981 For symbols with bound functions, the function is called and should return a | |
2982 string to be inserted into the array. For symbols with bound values, the value | |
2983 should be a string to be inserted into the array. In either case, function or | |
2984 variable, the string value has PostScript string delimiters added to it." | |
2985 :version "21.1" | |
2986 :type '(repeat (choice :menu-tag "Left Footer" | |
2987 :tag "Left Footer" | |
2988 string symbol)) | |
2989 :group 'ps-print-headers) | |
2990 | |
2991 (defcustom ps-right-footer | |
2992 (list "/pagenumberstring load" | |
2993 'ps-time-stamp-mon-dd-yyyy 'ps-time-stamp-hh:mm:ss) | |
2994 "*The items to display (each on a line) on the right part of the page footer. | |
2995 This applies to generating PostScript. | |
2996 | |
2997 See the variable `ps-left-footer' for a description of the format of this | |
2998 variable." | |
2999 :version "21.1" | |
3000 :type '(repeat (choice :menu-tag "Right Footer" | |
3001 :tag "Right Footer" | |
3002 string symbol)) | |
3003 :group 'ps-print-headers) | |
3004 | |
2703 (defcustom ps-razzle-dazzle t | 3005 (defcustom ps-razzle-dazzle t |
2704 "*Non-nil means report progress while formatting buffer." | 3006 "*Non-nil means report progress while formatting buffer." |
2705 :type 'boolean | 3007 :type 'boolean |
2706 :group 'ps-print-miscellany) | 3008 :group 'ps-print-miscellany) |
2707 | 3009 |
2708 (defcustom ps-adobe-tag "%!PS-Adobe-3.0\n" | 3010 (defcustom ps-adobe-tag "%!PS-Adobe-3.0\n" |
2709 "*Contains the header line identifying the output as PostScript. | 3011 "*Contains the header line identifying the output as PostScript. |
2710 By default, `ps-adobe-tag' contains the standard identifier. Some | 3012 By default, `ps-adobe-tag' contains the standard identifier. Some printers |
2711 printers require slightly different versions of this line." | 3013 require slightly different versions of this line." |
2712 :type 'string | 3014 :type 'string |
2713 :group 'ps-print-miscellany) | 3015 :group 'ps-print-miscellany) |
2714 | 3016 |
2715 (defcustom ps-build-face-reference t | 3017 (defcustom ps-build-face-reference t |
2716 "*Non-nil means build the reference face lists. | 3018 "*Non-nil means build the reference face lists. |
2717 | 3019 |
2718 ps-print sets this value to nil after it builds its internal reference | 3020 ps-print sets this value to nil after it builds its internal reference lists of |
2719 lists of bold and italic faces. By settings its value back to t, you | 3021 bold and italic faces. By settings its value back to t, you can force ps-print |
2720 can force ps-print to rebuild the lists the next time you invoke one | 3022 to rebuild the lists the next time you invoke one of the ...-with-faces |
2721 of the ...-with-faces commands. | 3023 commands. |
2722 | 3024 |
2723 You should set this value back to t after you change the attributes of | 3025 You should set this value back to t after you change the attributes of any |
2724 any face, or create new faces. Most users shouldn't have to worry | 3026 face, or create new faces. Most users shouldn't have to worry about its |
2725 about its setting, though." | 3027 setting, though." |
2726 :type 'boolean | 3028 :type 'boolean |
2727 :group 'ps-print-face) | 3029 :group 'ps-print-face) |
2728 | 3030 |
2729 (defcustom ps-always-build-face-reference nil | 3031 (defcustom ps-always-build-face-reference nil |
2730 "*Non-nil means always rebuild the reference face lists. | 3032 "*Non-nil means always rebuild the reference face lists. |
2731 | 3033 |
2732 If this variable is non-nil, ps-print will rebuild its internal | 3034 If this variable is non-nil, ps-print will rebuild its internal reference lists |
2733 reference lists of bold and italic faces *every* time one of the | 3035 of bold and italic faces *every* time one of the ...-with-faces commands is |
2734 ...-with-faces commands is called. Most users shouldn't need to set this | 3036 called. Most users shouldn't need to set this variable." |
2735 variable." | |
2736 :type 'boolean | 3037 :type 'boolean |
2737 :group 'ps-print-face) | 3038 :group 'ps-print-face) |
2738 | 3039 |
2739 (defcustom ps-banner-page-when-duplexing nil | 3040 (defcustom ps-banner-page-when-duplexing nil |
2740 "*Non-nil means the very first page is skipped. | 3041 "*Non-nil means the very first page is skipped. |
2852 | 3153 |
2853 ;;;###autoload | 3154 ;;;###autoload |
2854 (defun ps-print-buffer (&optional filename) | 3155 (defun ps-print-buffer (&optional filename) |
2855 "Generate and print a PostScript image of the buffer. | 3156 "Generate and print a PostScript image of the buffer. |
2856 | 3157 |
2857 Interactively, when you use a prefix argument (C-u), the command | 3158 Interactively, when you use a prefix argument (C-u), the command prompts the |
2858 prompts the user for a file name, and saves the PostScript image | 3159 user for a file name, and saves the PostScript image in that file instead of |
2859 in that file instead of sending it to the printer. | 3160 sending it to the printer. |
2860 | 3161 |
2861 Noninteractively, the argument FILENAME is treated as follows: if it | 3162 Noninteractively, the argument FILENAME is treated as follows: if it is nil, |
2862 is nil, send the image to the printer. If FILENAME is a string, save | 3163 send the image to the printer. If FILENAME is a string, save the PostScript |
2863 the PostScript image in a file with that name." | 3164 image in a file with that name." |
2864 (interactive (list (ps-print-preprint current-prefix-arg))) | 3165 (interactive (list (ps-print-preprint current-prefix-arg))) |
2865 (ps-print-without-faces (point-min) (point-max) filename)) | 3166 (ps-print-without-faces (point-min) (point-max) filename)) |
2866 | 3167 |
2867 | 3168 |
2868 ;;;###autoload | 3169 ;;;###autoload |
2869 (defun ps-print-buffer-with-faces (&optional filename) | 3170 (defun ps-print-buffer-with-faces (&optional filename) |
2870 "Generate and print a PostScript image of the buffer. | 3171 "Generate and print a PostScript image of the buffer. |
2871 Like `ps-print-buffer', but includes font, color, and underline | 3172 Like `ps-print-buffer', but includes font, color, and underline information in |
2872 information in the generated image. This command works only if you | 3173 the generated image. This command works only if you are using a window system, |
2873 are using a window system, so it has a way to determine color values." | 3174 so it has a way to determine color values." |
2874 (interactive (list (ps-print-preprint current-prefix-arg))) | 3175 (interactive (list (ps-print-preprint current-prefix-arg))) |
2875 (ps-print-with-faces (point-min) (point-max) filename)) | 3176 (ps-print-with-faces (point-min) (point-max) filename)) |
2876 | 3177 |
2877 | 3178 |
2878 ;;;###autoload | 3179 ;;;###autoload |
2884 | 3185 |
2885 | 3186 |
2886 ;;;###autoload | 3187 ;;;###autoload |
2887 (defun ps-print-region-with-faces (from to &optional filename) | 3188 (defun ps-print-region-with-faces (from to &optional filename) |
2888 "Generate and print a PostScript image of the region. | 3189 "Generate and print a PostScript image of the region. |
2889 Like `ps-print-region', but includes font, color, and underline | 3190 Like `ps-print-region', but includes font, color, and underline information in |
2890 information in the generated image. This command works only if you | 3191 the generated image. This command works only if you are using a window system, |
2891 are using a window system, so it has a way to determine color values." | 3192 so it has a way to determine color values." |
2892 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg))) | 3193 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg))) |
2893 (ps-print-with-faces from to filename t)) | 3194 (ps-print-with-faces from to filename t)) |
2894 | 3195 |
2895 | 3196 |
2896 ;;;###autoload | 3197 ;;;###autoload |
2897 (defun ps-spool-buffer () | 3198 (defun ps-spool-buffer () |
2898 "Generate and spool a PostScript image of the buffer. | 3199 "Generate and spool a PostScript image of the buffer. |
2899 Like `ps-print-buffer' except that the PostScript image is saved in a | 3200 Like `ps-print-buffer' except that the PostScript image is saved in a local |
2900 local buffer to be sent to the printer later. | 3201 buffer to be sent to the printer later. |
2901 | 3202 |
2902 Use the command `ps-despool' to send the spooled images to the printer." | 3203 Use the command `ps-despool' to send the spooled images to the printer." |
2903 (interactive) | 3204 (interactive) |
2904 (ps-spool-without-faces (point-min) (point-max))) | 3205 (ps-spool-without-faces (point-min) (point-max))) |
2905 | 3206 |
2906 | 3207 |
2907 ;;;###autoload | 3208 ;;;###autoload |
2908 (defun ps-spool-buffer-with-faces () | 3209 (defun ps-spool-buffer-with-faces () |
2909 "Generate and spool a PostScript image of the buffer. | 3210 "Generate and spool a PostScript image of the buffer. |
2910 Like `ps-spool-buffer', but includes font, color, and underline | 3211 Like `ps-spool-buffer', but includes font, color, and underline information in |
2911 information in the generated image. This command works only if you | 3212 the generated image. This command works only if you are using a window system, |
2912 are using a window system, so it has a way to determine color values. | 3213 so it has a way to determine color values. |
2913 | 3214 |
2914 Use the command `ps-despool' to send the spooled images to the printer." | 3215 Use the command `ps-despool' to send the spooled images to the printer." |
2915 (interactive) | 3216 (interactive) |
2916 (ps-spool-with-faces (point-min) (point-max))) | 3217 (ps-spool-with-faces (point-min) (point-max))) |
2917 | 3218 |
2927 | 3228 |
2928 | 3229 |
2929 ;;;###autoload | 3230 ;;;###autoload |
2930 (defun ps-spool-region-with-faces (from to) | 3231 (defun ps-spool-region-with-faces (from to) |
2931 "Generate a PostScript image of the region and spool locally. | 3232 "Generate a PostScript image of the region and spool locally. |
2932 Like `ps-spool-region', but includes font, color, and underline | 3233 Like `ps-spool-region', but includes font, color, and underline information in |
2933 information in the generated image. This command works only if you | 3234 the generated image. This command works only if you are using a window system, |
2934 are using a window system, so it has a way to determine color values. | 3235 so it has a way to determine color values. |
2935 | 3236 |
2936 Use the command `ps-despool' to send the spooled images to the printer." | 3237 Use the command `ps-despool' to send the spooled images to the printer." |
2937 (interactive "r") | 3238 (interactive "r") |
2938 (ps-spool-with-faces from to t)) | 3239 (ps-spool-with-faces from to t)) |
2939 | 3240 |
2940 ;;;###autoload | 3241 ;;;###autoload |
2941 (defun ps-despool (&optional filename) | 3242 (defun ps-despool (&optional filename) |
2942 "Send the spooled PostScript to the printer. | 3243 "Send the spooled PostScript to the printer. |
2943 | 3244 |
2944 Interactively, when you use a prefix argument (C-u), the command | 3245 Interactively, when you use a prefix argument (C-u), the command prompts the |
2945 prompts the user for a file name, and saves the spooled PostScript | 3246 user for a file name, and saves the spooled PostScript image in that file |
2946 image in that file instead of sending it to the printer. | 3247 instead of sending it to the printer. |
2947 | 3248 |
2948 Noninteractively, the argument FILENAME is treated as follows: if it | 3249 Noninteractively, the argument FILENAME is treated as follows: if it is nil, |
2949 is nil, send the image to the printer. If FILENAME is a string, save | 3250 send the image to the printer. If FILENAME is a string, save the PostScript |
2950 the PostScript image in a file with that name." | 3251 image in a file with that name." |
2951 (interactive (list (ps-print-preprint current-prefix-arg))) | 3252 (interactive (list (ps-print-preprint current-prefix-arg))) |
2952 (ps-do-despool filename)) | 3253 (ps-do-despool filename)) |
2953 | 3254 |
2954 ;;;###autoload | 3255 ;;;###autoload |
2955 (defun ps-line-lengths () | 3256 (defun ps-line-lengths () |
2956 "Display the correspondence between a line length and a font size, | 3257 "Display the correspondence between a line length and a font size, using the |
2957 using the current ps-print setup. | 3258 current ps-print setup. |
2958 Try: pr -t file | awk '{printf \"%3d %s\n\", length($0), $0}' | sort -r | head" | 3259 Try: pr -t file | awk '{printf \"%3d %s\n\", length($0), $0}' | sort -r | head" |
2959 (interactive) | 3260 (interactive) |
2960 (ps-line-lengths-internal)) | 3261 (ps-line-lengths-internal)) |
2961 | 3262 |
2962 ;;;###autoload | 3263 ;;;###autoload |
2974 (ps-nb-pages nb-lines)) | 3275 (ps-nb-pages nb-lines)) |
2975 | 3276 |
2976 ;;;###autoload | 3277 ;;;###autoload |
2977 (defun ps-setup () | 3278 (defun ps-setup () |
2978 "Return the current PostScript-generation setup." | 3279 "Return the current PostScript-generation setup." |
2979 (format | 3280 (let (prefix) |
2980 " | 3281 (mapconcat |
2981 ;;; ps-print version %s | 3282 #'(lambda (elt) |
2982 | 3283 (cond |
2983 \(setq ps-print-color-p %s | 3284 ((null elt) "") |
2984 ps-lpr-command %S | 3285 ((stringp elt) elt) |
2985 ps-lpr-switches %s | 3286 (t |
2986 ps-printer-name %s | 3287 (let* ((col (car elt)) |
2987 ps-printer-name-option %s | 3288 (sym (cdr elt)) |
2988 ps-print-region-function %s | 3289 (key (symbol-name sym)) |
2989 ps-manual-feed %S | 3290 (len (length key)) |
2990 ps-end-with-control-d %S | 3291 (val (symbol-value sym))) |
2991 | 3292 (concat (if prefix |
2992 ps-paper-type %s | 3293 prefix |
2993 ps-warn-paper-type %s | 3294 (setq prefix " ") |
2994 ps-landscape-mode %s | 3295 "(setq ") |
2995 ps-print-upside-down %s | 3296 key |
2996 ps-number-of-columns %s | 3297 (if (> col len) |
2997 | 3298 (make-string (- col len) ?\ ) |
2998 ps-zebra-stripes %s | 3299 " ") |
2999 ps-zebra-stripe-height %s | 3300 (cond ((null val) "nil") |
3000 ps-zebra-stripe-follow %S | 3301 ((eq val t) "t") |
3001 ps-zebra-color %s | 3302 ((or (symbolp val) (listp val)) (format "'%S" val)) |
3002 ps-line-number %s | 3303 (t (format "%S" val)))))) |
3003 ps-line-number-step %s | 3304 )) |
3004 ps-line-number-start %S | 3305 (list |
3005 | 3306 (concat "\n;;; ps-print version " ps-print-version "\n") |
3006 ps-default-fg %s | 3307 '(25 . ps-print-color-p) |
3007 ps-default-bg %s | 3308 '(25 . ps-lpr-command) |
3008 ps-razzle-dazzle %S | 3309 '(25 . ps-lpr-switches) |
3009 | 3310 '(25 . ps-printer-name) |
3010 ps-use-face-background %s | 3311 '(25 . ps-printer-name-option) |
3011 | 3312 '(25 . ps-print-region-function) |
3012 ps-print-control-characters %s | 3313 '(25 . ps-manual-feed) |
3013 | 3314 '(25 . ps-end-with-control-d) |
3014 ps-print-background-image %s | 3315 nil |
3015 | 3316 '(23 . ps-paper-type) |
3016 ps-print-background-text %s | 3317 '(23 . ps-warn-paper-type) |
3017 | 3318 '(23 . ps-landscape-mode) |
3018 ps-error-handler-message %s | 3319 '(23 . ps-print-upside-down) |
3019 ps-user-defined-prologue %s | 3320 '(23 . ps-number-of-columns) |
3020 ps-print-prologue-header %s | 3321 nil |
3021 ps-postscript-code-directory %S | 3322 '(23 . ps-zebra-stripes) |
3022 ps-adobe-tag %S | 3323 '(23 . ps-zebra-stripe-height) |
3023 | 3324 '(23 . ps-zebra-stripe-follow) |
3024 ps-left-margin %s | 3325 '(23 . ps-zebra-color) |
3025 ps-right-margin %s | 3326 '(23 . ps-line-number) |
3026 ps-inter-column %s | 3327 '(23 . ps-line-number-step) |
3027 ps-bottom-margin %s | 3328 '(23 . ps-line-number-start) |
3028 ps-top-margin %s | 3329 nil |
3029 ps-header-offset %s | 3330 '(17 . ps-default-fg) |
3030 ps-header-line-pad %s | 3331 '(17 . ps-default-bg) |
3031 ps-print-header %s | 3332 '(17 . ps-razzle-dazzle) |
3032 ps-print-only-one-header %s | 3333 nil |
3033 ps-print-header-frame %s | 3334 '(23 . ps-use-face-background) |
3034 ps-switch-header %s | 3335 nil |
3035 ps-header-lines %s | 3336 '(28 . ps-print-control-characters) |
3036 ps-show-n-of-n %s | 3337 nil |
3037 ps-spool-config %s | 3338 '(26 . ps-print-background-image) |
3038 ps-spool-duplex %s | 3339 nil |
3039 ps-spool-tumble %s | 3340 '(25 . ps-print-background-text) |
3040 ps-banner-page-when-duplexing %s | 3341 nil |
3041 ps-left-header %s | 3342 '(29 . ps-error-handler-message) |
3042 ps-right-header %s | 3343 '(29 . ps-user-defined-prologue) |
3043 | 3344 '(29 . ps-print-prologue-header) |
3044 ps-n-up-printing %s | 3345 '(29 . ps-postscript-code-directory) |
3045 ps-n-up-margin %s | 3346 '(29 . ps-adobe-tag) |
3046 ps-n-up-border-p %s | 3347 nil |
3047 ps-n-up-filling %s | 3348 '(30 . ps-left-margin) |
3048 | 3349 '(30 . ps-right-margin) |
3049 ps-multibyte-buffer %s | 3350 '(30 . ps-inter-column) |
3050 ps-font-family %s | 3351 '(30 . ps-bottom-margin) |
3051 ps-font-size %s | 3352 '(30 . ps-top-margin) |
3052 ps-header-font-family %s | 3353 '(30 . ps-print-only-one-header) |
3053 ps-header-font-size %s | 3354 '(30 . ps-switch-header) |
3054 ps-header-title-font-size %s | 3355 '(30 . ps-print-header) |
3055 ps-line-number-font %s | 3356 '(30 . ps-header-lines) |
3056 ps-line-number-font-size %s | 3357 '(30 . ps-header-offset) |
3057 ps-line-spacing %s | 3358 '(30 . ps-header-line-pad) |
3058 ps-paragraph-spacing %s | 3359 '(30 . ps-print-header-frame) |
3059 ps-paragraph-regexp %s | 3360 '(30 . ps-header-frame-alist) |
3060 ps-begin-cut-regexp %s | 3361 '(30 . ps-print-footer) |
3061 ps-end-cut-regexp %s | 3362 '(30 . ps-footer-lines) |
3062 | 3363 '(30 . ps-footer-offset) |
3063 ps-even-or-odd-pages %s | 3364 '(30 . ps-footer-line-pad) |
3064 ps-selected-pages %s | 3365 '(30 . ps-print-footer-frame) |
3065 ps-last-selected-pages %s | 3366 '(30 . ps-footer-frame-alist) |
3066 | 3367 '(30 . ps-show-n-of-n) |
3067 ps-build-face-reference %S | 3368 '(30 . ps-spool-config) |
3068 ps-always-build-face-reference %S | 3369 '(30 . ps-spool-duplex) |
3069 | 3370 '(30 . ps-spool-tumble) |
3070 ps-auto-font-detect %S | 3371 '(30 . ps-banner-page-when-duplexing) |
3071 ps-bold-faces %s | 3372 '(30 . ps-left-header) |
3072 ps-italic-faces %s | 3373 '(30 . ps-right-header) |
3073 ps-underlined-faces %s) | 3374 '(30 . ps-left-footer) |
3074 | 3375 '(30 . ps-right-footer) |
3376 nil | |
3377 '(23 . ps-n-up-printing) | |
3378 '(23 . ps-n-up-margin) | |
3379 '(23 . ps-n-up-border-p) | |
3380 '(23 . ps-n-up-filling) | |
3381 nil | |
3382 '(26 . ps-multibyte-buffer) | |
3383 '(26 . ps-font-family) | |
3384 '(26 . ps-font-size) | |
3385 '(26 . ps-header-font-family) | |
3386 '(26 . ps-header-font-size) | |
3387 '(26 . ps-header-title-font-size) | |
3388 '(26 . ps-footer-font-family) | |
3389 '(26 . ps-footer-font-size) | |
3390 '(26 . ps-line-number-color) | |
3391 '(26 . ps-line-number-font) | |
3392 '(26 . ps-line-number-font-size) | |
3393 '(26 . ps-line-spacing) | |
3394 '(26 . ps-paragraph-spacing) | |
3395 '(26 . ps-paragraph-regexp) | |
3396 '(26 . ps-begin-cut-regexp) | |
3397 '(26 . ps-end-cut-regexp) | |
3398 nil | |
3399 '(23 . ps-even-or-odd-pages) | |
3400 '(23 . ps-selected-pages) | |
3401 '(23 . ps-last-selected-pages) | |
3402 nil | |
3403 '(31 . ps-build-face-reference) | |
3404 '(31 . ps-always-build-face-reference) | |
3405 nil | |
3406 '(20 . ps-auto-font-detect) | |
3407 '(20 . ps-bold-faces) | |
3408 '(20 . ps-italic-faces) | |
3409 '(20 . ps-underlined-faces) | |
3410 ")\n | |
3075 ;; The following customized variables have long lists and are seldom modified: | 3411 ;; The following customized variables have long lists and are seldom modified: |
3076 ;; ps-page-dimensions-database | 3412 ;; ps-page-dimensions-database |
3077 ;; ps-font-info-database | 3413 ;; ps-font-info-database |
3078 | 3414 |
3079 ;;; ps-print - end of settings | 3415 ;;; ps-print - end of settings\n") |
3080 " | 3416 "\n"))) |
3081 ps-print-version | |
3082 ps-print-color-p | |
3083 ps-lpr-command | |
3084 (ps-print-quote ps-lpr-switches) | |
3085 (ps-print-quote ps-printer-name) | |
3086 (ps-print-quote ps-printer-name-option) | |
3087 (ps-print-quote ps-print-region-function) | |
3088 ps-manual-feed | |
3089 ps-end-with-control-d | |
3090 (ps-print-quote ps-paper-type) | |
3091 ps-warn-paper-type | |
3092 ps-landscape-mode | |
3093 ps-print-upside-down | |
3094 ps-number-of-columns | |
3095 ps-zebra-stripes | |
3096 ps-zebra-stripe-height | |
3097 (ps-print-quote ps-zebra-stripe-follow) | |
3098 (ps-print-quote ps-zebra-color) | |
3099 ps-line-number | |
3100 (ps-print-quote ps-line-number-step) | |
3101 ps-line-number-start | |
3102 (ps-print-quote ps-default-fg) | |
3103 (ps-print-quote ps-default-bg) | |
3104 ps-razzle-dazzle | |
3105 (ps-print-quote ps-use-face-background) | |
3106 (ps-print-quote ps-print-control-characters) | |
3107 (ps-print-quote ps-print-background-image) | |
3108 (ps-print-quote ps-print-background-text) | |
3109 (ps-print-quote ps-error-handler-message) | |
3110 (ps-print-quote ps-user-defined-prologue) | |
3111 (ps-print-quote ps-print-prologue-header) | |
3112 ps-postscript-code-directory | |
3113 ps-adobe-tag | |
3114 ps-left-margin | |
3115 ps-right-margin | |
3116 ps-inter-column | |
3117 ps-bottom-margin | |
3118 ps-top-margin | |
3119 ps-header-offset | |
3120 ps-header-line-pad | |
3121 ps-print-header | |
3122 ps-print-only-one-header | |
3123 ps-print-header-frame | |
3124 (ps-print-quote ps-switch-header) | |
3125 ps-header-lines | |
3126 ps-show-n-of-n | |
3127 (ps-print-quote ps-spool-config) | |
3128 ps-spool-duplex | |
3129 ps-spool-tumble | |
3130 ps-banner-page-when-duplexing | |
3131 (ps-print-quote ps-left-header) | |
3132 (ps-print-quote ps-right-header) | |
3133 ps-n-up-printing | |
3134 ps-n-up-margin | |
3135 ps-n-up-border-p | |
3136 (ps-print-quote ps-n-up-filling) | |
3137 (ps-print-quote (symbol-value 'ps-multibyte-buffer)) ; see `ps-mule.el' | |
3138 (ps-print-quote ps-font-family) | |
3139 (ps-print-quote ps-font-size) | |
3140 (ps-print-quote ps-header-font-family) | |
3141 (ps-print-quote ps-header-font-size) | |
3142 (ps-print-quote ps-header-title-font-size) | |
3143 ps-line-number-font | |
3144 (ps-print-quote ps-line-number-font-size) | |
3145 (ps-print-quote ps-line-spacing) | |
3146 (ps-print-quote ps-paragraph-spacing) | |
3147 (ps-print-quote ps-paragraph-regexp) | |
3148 (ps-print-quote ps-begin-cut-regexp) | |
3149 (ps-print-quote ps-end-cut-regexp) | |
3150 (ps-print-quote ps-even-or-odd-pages) | |
3151 (ps-print-quote ps-selected-pages) | |
3152 (ps-print-quote ps-last-selected-pages) | |
3153 ps-build-face-reference | |
3154 ps-always-build-face-reference | |
3155 ps-auto-font-detect | |
3156 (ps-print-quote ps-bold-faces) | |
3157 (ps-print-quote ps-italic-faces) | |
3158 (ps-print-quote ps-underlined-faces))) | |
3159 | 3417 |
3160 | 3418 |
3161 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3419 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3162 ;; Utility functions and variables: | 3420 ;; Utility functions and variables: |
3163 | 3421 |
3164 | 3422 |
3423 (defun ps-value (alist-sym key) | |
3424 "Return value from association list ALIST-SYM which car is `eq' to KEY." | |
3425 (cdr (assq key (symbol-value alist-sym)))) | |
3426 | |
3427 | |
3428 (defun ps-get (alist-sym key) | |
3429 "Return element from association list ALIST-SYM which car is `eq' to KEY." | |
3430 (assq key (symbol-value alist-sym))) | |
3431 | |
3432 | |
3433 (defun ps-put (alist-sym key value) | |
3434 "Store element (KEY . VALUE) into association list ALIST-SYM. | |
3435 If KEY already exists in ALIST-SYM, modify cdr to VALUE. | |
3436 It can be retrieved with `(ps-get ALIST-SYM KEY)'." | |
3437 (let ((elt: (assq key (symbol-value alist-sym)))) ; to avoid name conflict | |
3438 (if elt: | |
3439 (setcdr elt: value) | |
3440 (setq elt: (cons key value)) | |
3441 (set alist-sym (cons elt: (symbol-value alist-sym)))) | |
3442 elt:)) | |
3443 | |
3444 | |
3445 (defun ps-del (alist-sym key) | |
3446 "Delete by side effect element KEY from association list ALIST-SYM." | |
3447 (let ((a:list: (symbol-value alist-sym)) ; to avoid name conflict | |
3448 old) | |
3449 (while a:list: | |
3450 (if (eq key (car (car a:list:))) | |
3451 (progn | |
3452 (if old | |
3453 (setcdr old (cdr a:list:)) | |
3454 (set alist-sym (cdr a:list:))) | |
3455 (setq a:list: nil)) | |
3456 (setq old a:list: | |
3457 a:list: (cdr a:list:))))) | |
3458 (symbol-value alist-sym)) | |
3459 | |
3460 | |
3165 (defun ps-time-stamp-mon-dd-yyyy () | 3461 (defun ps-time-stamp-mon-dd-yyyy () |
3166 (format-time-string "%b %d %Y")) | 3462 (format-time-string "%b %d %Y")) |
3167 | 3463 |
3168 | 3464 |
3169 (defun ps-time-stamp-hh:mm:ss () | 3465 (defun ps-time-stamp-hh:mm:ss () |
3170 (format-time-string "%T")) | 3466 (format-time-string "%T")) |
3171 | |
3172 | |
3173 (defun ps-print-quote (sym) | |
3174 (cond ((null sym) | |
3175 nil) | |
3176 ((or (symbolp sym) (listp sym)) | |
3177 (format "'%S" sym)) | |
3178 ((stringp sym) | |
3179 (format "%S" sym)) | |
3180 (t | |
3181 sym))) | |
3182 | 3467 |
3183 | 3468 |
3184 (eval-and-compile | 3469 (eval-and-compile |
3185 (defvar ps-print-emacs-type | 3470 (defvar ps-print-emacs-type |
3186 (cond ((string-match "XEmacs" emacs-version) 'xemacs) | 3471 (cond ((string-match "XEmacs" emacs-version) 'xemacs) |
3320 done!" | 3605 done!" |
3321 (let ((filename (convert-standard-filename | 3606 (let ((filename (convert-standard-filename |
3322 (expand-file-name (format "ps-prin%d.ps" filenumber) | 3607 (expand-file-name (format "ps-prin%d.ps" filenumber) |
3323 ps-postscript-code-directory)))) | 3608 ps-postscript-code-directory)))) |
3324 (if (and (file-exists-p filename) | 3609 (if (and (file-exists-p filename) |
3325 (file-readable-p filename)) | 3610 (file-readable-p filename)) |
3326 (with-temp-buffer | 3611 (with-temp-buffer |
3327 (insert-file-contents filename) | 3612 (insert-file-contents filename) |
3328 (buffer-string)) | 3613 (buffer-string)) |
3329 (error "ps-print PostScript prologue `%s' file was not found." | 3614 (error "ps-print PostScript prologue `%s' file was not found." |
3330 filename)))) | 3615 filename)))) |
3331 | 3616 |
3332 | 3617 |
3333 (defvar ps-mark-code-directory nil) | 3618 (defvar ps-mark-code-directory nil) |
3386 "%0.3f %0.3f %0.3f" | 3671 "%0.3f %0.3f %0.3f" |
3387 | 3672 |
3388 ;; Lucid emacsen will have to make do with %s (princ) for floats. | 3673 ;; Lucid emacsen will have to make do with %s (princ) for floats. |
3389 "%s %s %s")) | 3674 "%s %s %s")) |
3390 | 3675 |
3391 ;; These values determine how much print-height to deduct when headers | 3676 ;; These values determine how much print-height to deduct when headers/footers |
3392 ;; are turned on. This is a pretty clumsy way of handling it, but | 3677 ;; are turned on. This is a pretty clumsy way of handling it, but it'll do for |
3393 ;; it'll do for now. | 3678 ;; now. |
3394 | 3679 |
3395 (defvar ps-header-pad 0 | 3680 (defvar ps-header-pad 0 |
3396 "Vertical and horizontal space between the header frame and the text. | 3681 "Vertical and horizontal space between the header frame and the text. |
3397 This is in units of points (1/72 inch).") | 3682 This is in units of points (1/72 inch).") |
3398 | 3683 |
3684 (defvar ps-footer-pad 0 | |
3685 "Vertical and horizontal space between the footer frame and the text. | |
3686 This is in units of points (1/72 inch).") | |
3687 | |
3399 ;; Define accessors to the dimensions list. | 3688 ;; Define accessors to the dimensions list. |
3400 | 3689 |
3401 (defmacro ps-page-dimensions-get-width (dims) `(nth 0 ,dims)) | 3690 (defmacro ps-page-dimensions-get-width (dims) `(nth 0 ,dims)) |
3402 (defmacro ps-page-dimensions-get-height (dims) `(nth 1 ,dims)) | 3691 (defmacro ps-page-dimensions-get-height (dims) `(nth 1 ,dims)) |
3403 (defmacro ps-page-dimensions-get-media (dims) `(nth 2 ,dims)) | 3692 (defmacro ps-page-dimensions-get-media (dims) `(nth 2 ,dims)) |
3411 (defvar ps-width-remaining nil) | 3700 (defvar ps-width-remaining nil) |
3412 | 3701 |
3413 (defvar ps-font-size-internal nil) | 3702 (defvar ps-font-size-internal nil) |
3414 (defvar ps-header-font-size-internal nil) | 3703 (defvar ps-header-font-size-internal nil) |
3415 (defvar ps-header-title-font-size-internal nil) | 3704 (defvar ps-header-title-font-size-internal nil) |
3705 (defvar ps-footer-font-size-internal nil) | |
3416 (defvar ps-line-spacing-internal nil) | 3706 (defvar ps-line-spacing-internal nil) |
3417 (defvar ps-paragraph-spacing-internal nil) | 3707 (defvar ps-paragraph-spacing-internal nil) |
3418 | 3708 |
3419 | 3709 |
3420 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3710 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3655 (normal-font (cdr (assq 'normal font-list)))) | 3945 (normal-font (cdr (assq 'normal font-list)))) |
3656 (while (and font-list (not (eq font-type (car (car font-list))))) | 3946 (while (and font-list (not (eq font-type (car (car font-list))))) |
3657 (setq font-list (cdr font-list))) | 3947 (setq font-list (cdr font-list))) |
3658 (or (cdr (car font-list)) normal-font))) | 3948 (or (cdr (car font-list)) normal-font))) |
3659 | 3949 |
3660 (defun ps-fonts (font-sym) | 3950 (defsubst ps-fonts (font-sym) |
3661 (mapcar 'cdr (ps-font-alist font-sym))) | 3951 (mapcar 'cdr (ps-font-alist font-sym))) |
3662 | 3952 |
3663 (defun ps-font-number (font-sym font-type) | 3953 (defsubst ps-font-number (font-sym font-type) |
3664 (or (ps-alist-position font-type (ps-font-alist font-sym)) | 3954 (or (ps-alist-position font-type (ps-font-alist font-sym)) |
3665 0)) | 3955 0)) |
3666 | 3956 |
3667 (defsubst ps-line-height (font-sym) | 3957 (defsubst ps-line-height (font-sym) |
3668 "The height of a line, for generating PostScript. | 3958 "The height of a line, for generating PostScript. |
3829 (ps-select-font ps-font-family 'ps-font-for-text | 4119 (ps-select-font ps-font-family 'ps-font-for-text |
3830 ps-font-size-internal ps-font-size-internal) | 4120 ps-font-size-internal ps-font-size-internal) |
3831 (ps-select-font ps-header-font-family 'ps-font-for-header | 4121 (ps-select-font ps-header-font-family 'ps-font-for-header |
3832 ps-header-font-size-internal | 4122 ps-header-font-size-internal |
3833 ps-header-title-font-size-internal) | 4123 ps-header-title-font-size-internal) |
4124 (ps-select-font ps-footer-font-family 'ps-font-for-footer | |
4125 ps-footer-font-size-internal ps-footer-font-size-internal) | |
3834 | 4126 |
3835 (setq page-width (ps-page-dimensions-get-width page-dimensions) | 4127 (setq page-width (ps-page-dimensions-get-width page-dimensions) |
3836 page-height (ps-page-dimensions-get-height page-dimensions)) | 4128 page-height (ps-page-dimensions-get-height page-dimensions)) |
3837 | 4129 |
3838 ;; Landscape mode | 4130 ;; Landscape mode |
3876 page-height == bm + print-height + tm | 4168 page-height == bm + print-height + tm |
3877 => print-height == %d !" | 4169 => print-height == %d !" |
3878 ps-top-margin | 4170 ps-top-margin |
3879 ps-bottom-margin | 4171 ps-bottom-margin |
3880 ps-print-height)) | 4172 ps-print-height)) |
3881 ;; If headers are turned on, deduct the height of the header from | 4173 ;; If headers are turned on, deduct the height of the header from the print |
3882 ;; the print height. | 4174 ;; height. |
3883 (if ps-print-header | 4175 (if ps-print-header |
3884 (setq ps-header-pad (* ps-header-line-pad | 4176 (setq ps-header-pad (* ps-header-line-pad |
3885 (ps-title-line-height 'ps-font-for-header)) | 4177 (ps-title-line-height 'ps-font-for-header)) |
3886 ps-print-height (- ps-print-height | 4178 ps-print-height (- ps-print-height |
3887 ps-header-offset | 4179 ps-header-offset |
3889 (ps-title-line-height 'ps-font-for-header) | 4181 (ps-title-line-height 'ps-font-for-header) |
3890 (* (ps-line-height 'ps-font-for-header) | 4182 (* (ps-line-height 'ps-font-for-header) |
3891 (1- ps-header-lines)) | 4183 (1- ps-header-lines)) |
3892 ps-header-pad))) | 4184 ps-header-pad))) |
3893 (if (<= ps-print-height 0) | 4185 (if (<= ps-print-height 0) |
3894 (error "Bad vertical layout: | 4186 (error "Bad vertical layout (header): |
3895 ps-top-margin == %s | 4187 ps-top-margin == %s |
3896 ps-bottom-margin == %s | 4188 ps-bottom-margin == %s |
3897 ps-header-offset == %s | 4189 ps-header-offset == %s |
3898 ps-header-pad == %s | 4190 ps-header-pad == %s |
3899 header-height == %s | 4191 header-height == %s |
3907 (ps-title-line-height 'ps-font-for-header) | 4199 (ps-title-line-height 'ps-font-for-header) |
3908 (* (ps-line-height 'ps-font-for-header) | 4200 (* (ps-line-height 'ps-font-for-header) |
3909 (1- ps-header-lines)) | 4201 (1- ps-header-lines)) |
3910 ps-header-pad) | 4202 ps-header-pad) |
3911 ps-print-height)) | 4203 ps-print-height)) |
4204 ;; If footers are turned on, deduct the height of the footer from the print | |
4205 ;; height. | |
4206 (if ps-print-footer | |
4207 (setq ps-footer-pad (* ps-footer-line-pad | |
4208 (ps-title-line-height 'ps-font-for-footer)) | |
4209 ps-print-height (- ps-print-height | |
4210 ps-footer-offset | |
4211 ps-footer-pad | |
4212 (* (ps-line-height 'ps-font-for-footer) | |
4213 (1- ps-footer-lines)) | |
4214 ps-footer-pad))) | |
4215 (if (<= ps-print-height 0) | |
4216 (error "Bad vertical layout (footer): | |
4217 ps-top-margin == %s | |
4218 ps-bottom-margin == %s | |
4219 ps-footer-offset == %s | |
4220 ps-footer-pad == %s | |
4221 footer-height == %s | |
4222 page-height == bm + print-height + tm - fo - fh | |
4223 => print-height == %d !" | |
4224 ps-top-margin | |
4225 ps-bottom-margin | |
4226 ps-footer-offset | |
4227 ps-footer-pad | |
4228 (+ ps-footer-pad | |
4229 (* (ps-line-height 'ps-font-for-footer) | |
4230 (1- ps-footer-lines)) | |
4231 ps-footer-pad) | |
4232 ps-print-height)) | |
3912 ;; ps-zebra-stripe-follow is `full' or `full-follow' | 4233 ;; ps-zebra-stripe-follow is `full' or `full-follow' |
3913 (if ps-zebra-stripe-full-p | 4234 (if ps-zebra-stripe-full-p |
3914 (let* ((line-height (ps-line-height 'ps-font-for-text)) | 4235 (let* ((line-height (ps-line-height 'ps-font-for-text)) |
3915 (zebra (* (+ line-height ps-line-spacing-internal) | 4236 (zebra (* (+ line-height ps-line-spacing-internal) |
3916 ps-zebra-stripe-height))) | 4237 ps-zebra-stripe-height))) |
3917 (setq ps-print-height (- (* (floor ps-print-height zebra) zebra) | 4238 (setq ps-print-height (- (* (floor ps-print-height zebra) zebra) |
3918 line-height)) | 4239 line-height)) |
3919 (if (<= ps-print-height 0) | 4240 (if (<= ps-print-height 0) |
3920 (error "Bad vertical layout: | 4241 (error "Bad vertical layout (full zebra stripe follow): |
3921 ps-zebra-stripe-follow == %s | 4242 ps-zebra-stripe-follow == %s |
3922 ps-zebra-stripe-height == %s | 4243 ps-zebra-stripe-height == %s |
3923 font-text-height == %s | 4244 font-text-height == %s |
3924 line-spacing == %s | 4245 line-spacing == %s |
3925 page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th | 4246 page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th |
4087 (save-excursion | 4408 (save-excursion |
4088 (set-buffer ps-spool-buffer) | 4409 (set-buffer ps-spool-buffer) |
4089 (goto-char (point-max)) | 4410 (goto-char (point-max)) |
4090 (insert-file fname))) | 4411 (insert-file fname))) |
4091 | 4412 |
4092 ;; These functions insert the arrays that define the contents of the | 4413 ;; These functions insert the arrays that define the contents of the headers. |
4093 ;; headers. | |
4094 | 4414 |
4095 (defun ps-generate-header-line (fonttag &optional content) | 4415 (defun ps-generate-header-line (fonttag &optional content) |
4096 (ps-output " [ " fonttag " ") | 4416 (ps-output " [" fonttag " ") |
4097 (cond | 4417 (cond |
4098 ;; Literal strings should be output as is -- the string must | 4418 ;; Literal strings should be output as is -- the string must contain its own |
4099 ;; contain its own PS string delimiters, '(' and ')', if necessary. | 4419 ;; PS string delimiters, '(' and ')', if necessary. |
4100 ((stringp content) | 4420 ((stringp content) |
4101 (ps-output (ps-mule-encode-header-string content fonttag))) | 4421 (ps-output (ps-mule-encode-header-string content fonttag))) |
4102 | 4422 |
4103 ;; Functions are called -- they should return strings; they will be | 4423 ;; Functions are called -- they should return strings; they will be inserted |
4104 ;; inserted as strings and the PS string delimiters added. | 4424 ;; as strings and the PS string delimiters added. |
4105 ((and (symbolp content) (fboundp content)) | 4425 ((and (symbolp content) (fboundp content)) |
4106 (ps-output-string (ps-mule-encode-header-string (funcall content) | 4426 (ps-output-string (ps-mule-encode-header-string (funcall content) |
4107 fonttag))) | 4427 fonttag))) |
4108 | 4428 |
4109 ;; Variables will have their contents inserted. They should | 4429 ;; Variables will have their contents inserted. They should contain |
4110 ;; contain strings, and will be inserted as strings. | 4430 ;; strings, and will be inserted as strings. |
4111 ((and (symbolp content) (boundp content)) | 4431 ((and (symbolp content) (boundp content)) |
4112 (ps-output-string (ps-mule-encode-header-string (symbol-value content) | 4432 (ps-output-string (ps-mule-encode-header-string (symbol-value content) |
4113 fonttag))) | 4433 fonttag))) |
4114 | 4434 |
4115 ;; Anything else will get turned into an empty string. | 4435 ;; Anything else will get turned into an empty string. |
4116 (t | 4436 (t |
4117 (ps-output-string ""))) | 4437 (ps-output-string ""))) |
4118 (ps-output " ]\n")) | 4438 (ps-output "]\n")) |
4119 | 4439 |
4120 (defun ps-generate-header (name contents) | 4440 (defun ps-generate-header (name fonttag0 fonttag1 contents) |
4121 (ps-output "/" name " [\n") | 4441 (ps-output "/" name "[\n") |
4122 (if (> ps-header-lines 0) | 4442 (and contents (> ps-header-lines 0) |
4123 (let ((count 1)) | 4443 (let ((count 1)) |
4124 (ps-generate-header-line "/h0" (car contents)) | 4444 (ps-generate-header-line fonttag0 (car contents)) |
4125 (while (and (< count ps-header-lines) | 4445 (while (and (< count ps-header-lines) |
4126 (setq contents (cdr contents))) | 4446 (setq contents (cdr contents))) |
4127 (ps-generate-header-line "/h1" (car contents)) | 4447 (ps-generate-header-line fonttag1 (car contents)) |
4128 (setq count (1+ count))))) | 4448 (setq count (1+ count))))) |
4129 (ps-output "] def\n")) | 4449 (ps-output "]def\n")) |
4130 | 4450 |
4131 | 4451 |
4132 (defun ps-output-boolean (name bool) | 4452 (defun ps-output-boolean (name bool) |
4133 (ps-output (format "/%s %s def\n" name (if bool "true" "false")))) | 4453 (ps-output (format "/%s %s def\n" name (if bool "true" "false")))) |
4454 | |
4455 | |
4456 (defun ps-output-frame-properties (name alist) | |
4457 (ps-output "/" name " [" | |
4458 (ps-format-color (cdr (assq 'fore-color alist)) 0) | |
4459 (ps-format-color (cdr (assq 'back-color alist)) 0.9) | |
4460 (ps-float-format (or (cdr (assq 'border-width alist)) 0.4)) | |
4461 (ps-format-color (cdr (assq 'border-color alist)) 0) | |
4462 (ps-format-color (cdr (assq 'shadow-color alist)) 0) | |
4463 "]def\n")) | |
4134 | 4464 |
4135 | 4465 |
4136 (defun ps-background-pages (page-list func) | 4466 (defun ps-background-pages (page-list func) |
4137 (if page-list | 4467 (if page-list |
4138 (mapcar | 4468 (mapcar |
4728 (full-follow . 3)) | 5058 (full-follow . 3)) |
4729 "Alist for zebra stripe continuation.") | 5059 "Alist for zebra stripe continuation.") |
4730 | 5060 |
4731 | 5061 |
4732 (defun ps-begin-file () | 5062 (defun ps-begin-file () |
4733 (ps-get-page-dimensions) | |
4734 (setq ps-page-order 0 | 5063 (setq ps-page-order 0 |
4735 ps-page-printed 0 | 5064 ps-page-printed 0 |
4736 ps-background-text-count 0 | 5065 ps-background-text-count 0 |
4737 ps-background-image-count 0 | 5066 ps-background-image-count 0 |
4738 ps-background-pages nil | 5067 ps-background-pages nil |
4803 (format "/InterColumn %s def\n" ps-inter-column) | 5132 (format "/InterColumn %s def\n" ps-inter-column) |
4804 | 5133 |
4805 (format "/BottomMargin %s def\n" ps-bottom-margin) | 5134 (format "/BottomMargin %s def\n" ps-bottom-margin) |
4806 (format "/TopMargin %s def\n" ps-top-margin) ; not used | 5135 (format "/TopMargin %s def\n" ps-top-margin) ; not used |
4807 (format "/HeaderOffset %s def\n" ps-header-offset) | 5136 (format "/HeaderOffset %s def\n" ps-header-offset) |
4808 (format "/HeaderPad %s def\n" ps-header-pad)) | 5137 (format "/HeaderPad %s def\n" ps-header-pad) |
4809 | 5138 (format "/FooterOffset %s def\n" ps-footer-offset) |
4810 (ps-output-boolean "PrintHeader " ps-print-header) | 5139 (format "/FooterPad %s def\n" ps-footer-pad) |
4811 (ps-output-boolean "PrintOnlyOneHeader" ps-print-only-one-header) | 5140 (format "/FooterLines %s def\n" ps-footer-lines)) |
4812 (ps-output-boolean "PrintHeaderFrame " ps-print-header-frame) | 5141 |
5142 (ps-output-boolean "ShowNofN " ps-show-n-of-n) | |
4813 (ps-output-boolean "SwitchHeader " (if (eq ps-switch-header 'duplex) | 5143 (ps-output-boolean "SwitchHeader " (if (eq ps-switch-header 'duplex) |
4814 ps-spool-duplex | 5144 ps-spool-duplex |
4815 ps-switch-header)) | 5145 ps-switch-header)) |
4816 (ps-output-boolean "ShowNofN " ps-show-n-of-n) | 5146 (ps-output-boolean "PrintOnlyOneHeader" ps-print-only-one-header) |
5147 (ps-output-boolean "PrintHeader " ps-print-header) | |
5148 (ps-output-boolean "PrintHeaderFrame " ps-print-header-frame) | |
5149 (ps-output-frame-properties "HeaderFrameProperties" ps-header-frame-alist) | |
5150 (ps-output-boolean "PrintFooter " ps-print-footer) | |
5151 (ps-output-boolean "PrintFooterFrame " ps-print-footer-frame) | |
5152 (ps-output-frame-properties "FooterFrameProperties" ps-footer-frame-alist) | |
4817 | 5153 |
4818 (let ((line-height (ps-line-height 'ps-font-for-text))) | 5154 (let ((line-height (ps-line-height 'ps-font-for-text))) |
4819 (ps-output (format "/LineSpacing %s def\n" ps-line-spacing-internal) | 5155 (ps-output (format "/LineSpacing %s def\n" ps-line-spacing-internal) |
4820 (format "/ParagraphSpacing %s def\n" | 5156 (format "/ParagraphSpacing %s def\n" |
4821 ps-paragraph-spacing-internal) | 5157 ps-paragraph-spacing-internal) |
4838 (format "/PrintLineStep %d def\n" | 5174 (format "/PrintLineStep %d def\n" |
4839 (if (integerp ps-line-number-step) | 5175 (if (integerp ps-line-number-step) |
4840 ps-line-number-step | 5176 ps-line-number-step |
4841 ps-zebra-stripe-height)) | 5177 ps-zebra-stripe-height)) |
4842 (format "/PrintLineStart %d def\n" ps-line-number-start) | 5178 (format "/PrintLineStart %d def\n" ps-line-number-start) |
4843 (format "/ZebraHeight %d def\n" ps-zebra-stripe-height) | 5179 "/LineNumberColor " |
5180 (ps-format-color ps-line-number-color 0.0) | |
5181 (format "def\n/ZebraHeight %d def\n" | |
5182 ps-zebra-stripe-height) | |
4844 "/ZebraColor " | 5183 "/ZebraColor " |
4845 (ps-format-color ps-zebra-color 0.95) | 5184 (ps-format-color ps-zebra-color 0.95) |
4846 "def\n/BackgroundColor " | 5185 "def\n/BackgroundColor " |
4847 (ps-format-color ps-default-bg 1.0) | 5186 (ps-format-color ps-default-bg 1.0) |
4848 "def\n/UseSetpagedevice " | 5187 "def\n/UseSetpagedevice " |
4891 (format "/h1 %s(%s)cvn DefFont\n" ; /h1 12/Helvetica DefFont | 5230 (format "/h1 %s(%s)cvn DefFont\n" ; /h1 12/Helvetica DefFont |
4892 ps-header-font-size-internal | 5231 ps-header-font-size-internal |
4893 (ps-font 'ps-font-for-header 'normal)) | 5232 (ps-font 'ps-font-for-header 'normal)) |
4894 (format "/L0 %s(%s)cvn DefFont\n" ; /L0 6/Times-Italic DefFont | 5233 (format "/L0 %s(%s)cvn DefFont\n" ; /L0 6/Times-Italic DefFont |
4895 (ps-get-font-size 'ps-line-number-font-size) | 5234 (ps-get-font-size 'ps-line-number-font-size) |
4896 ps-line-number-font)) | 5235 ps-line-number-font) |
4897 | 5236 (format "/H0 %s(%s)cvn DefFont\n" ; /H0 12/Helvetica DefFont |
4898 (ps-output "\n\n% ---- These lines must be kept together because... | 5237 ps-footer-font-size-internal |
5238 (ps-font 'ps-font-for-footer 'normal)) | |
5239 "\n\n% ---- These lines must be kept together because... | |
4899 | 5240 |
4900 /h0 F | 5241 /h0 F |
4901 /HeaderTitleLineHeight FontHeight def | 5242 /HeaderTitleLineHeight FontHeight def |
4902 | 5243 |
4903 /h1 F | 5244 /h1 F |
4904 /HeaderLineHeight FontHeight def | 5245 /HeaderLineHeight FontHeight def |
4905 /HeaderDescent Descent def | 5246 /HeaderDescent Descent def |
5247 | |
5248 /H0 F | |
5249 /FooterLineHeight FontHeight def | |
5250 /FooterDescent Descent def | |
4906 | 5251 |
4907 % ---- ...because `F' has a side-effect on `FontHeight' and `Descent'\n\n") | 5252 % ---- ...because `F' has a side-effect on `FontHeight' and `Descent'\n\n") |
4908 | 5253 |
4909 ;; Text fonts | 5254 ;; Text fonts |
4910 (let ((font (ps-font-alist 'ps-font-for-text)) | 5255 (let ((font (ps-font-alist 'ps-font-for-text)) |
5018 siz)) | 5363 siz)) |
5019 | 5364 |
5020 | 5365 |
5021 (defun ps-get-font-size (font-sym) | 5366 (defun ps-get-font-size (font-sym) |
5022 (ps-get-size (symbol-value font-sym) "font size" font-sym)) | 5367 (ps-get-size (symbol-value font-sym) "font size" font-sym)) |
5368 | |
5369 | |
5370 (defsubst ps-rgb-color (color default) | |
5371 (cond ((and color (listp color)) color) | |
5372 ((stringp color) (ps-color-scale color)) | |
5373 ((numberp color) (list color color color)) | |
5374 (t (list default default default)) | |
5375 )) | |
5023 | 5376 |
5024 | 5377 |
5025 (defun ps-begin-job () | 5378 (defun ps-begin-job () |
5026 ;; prologue files | 5379 ;; prologue files |
5027 (or (equal ps-mark-code-directory ps-postscript-code-directory) | 5380 (or (equal ps-mark-code-directory ps-postscript-code-directory) |
5080 "paragraph spacing") | 5433 "paragraph spacing") |
5081 ps-font-size-internal (ps-get-font-size 'ps-font-size) | 5434 ps-font-size-internal (ps-get-font-size 'ps-font-size) |
5082 ps-header-font-size-internal (ps-get-font-size 'ps-header-font-size) | 5435 ps-header-font-size-internal (ps-get-font-size 'ps-header-font-size) |
5083 ps-header-title-font-size-internal | 5436 ps-header-title-font-size-internal |
5084 (ps-get-font-size 'ps-header-title-font-size) | 5437 (ps-get-font-size 'ps-header-title-font-size) |
5438 ps-footer-font-size-internal (ps-get-font-size 'ps-footer-font-size) | |
5085 ps-control-or-escape-regexp | 5439 ps-control-or-escape-regexp |
5086 (cond ((eq ps-print-control-characters '8-bit) | 5440 (cond ((eq ps-print-control-characters '8-bit) |
5087 (string-as-unibyte "[\000-\037\177-\377]")) | 5441 (string-as-unibyte "[\000-\037\177-\377]")) |
5088 ((eq ps-print-control-characters 'control-8-bit) | 5442 ((eq ps-print-control-characters 'control-8-bit) |
5089 (string-as-unibyte "[\000-\037\177-\237]")) | 5443 (string-as-unibyte "[\000-\037\177-\237]")) |
5097 ;; that ps-print can be dumped into emacs. This expression can't be | 5451 ;; that ps-print can be dumped into emacs. This expression can't be |
5098 ;; evaluated at dump-time because X isn't initialized. | 5452 ;; evaluated at dump-time because X isn't initialized. |
5099 ps-color-p (and ps-print-color-p (ps-color-device)) | 5453 ps-color-p (and ps-print-color-p (ps-color-device)) |
5100 ps-print-color-scale (if ps-color-p | 5454 ps-print-color-scale (if ps-color-p |
5101 (float (car (ps-color-values "white"))) | 5455 (float (car (ps-color-values "white"))) |
5102 1.0))) | 5456 1.0)) |
5103 | 5457 ;; initialize page dimensions |
5104 | 5458 (ps-get-page-dimensions)) |
5105 (defun ps-rgb-color (color default) | |
5106 (cond ((and color (listp color)) color) | |
5107 ((stringp color) (ps-color-scale color)) | |
5108 ((numberp color) (list color color color)) | |
5109 (t (list default default default)) | |
5110 )) | |
5111 | 5459 |
5112 | 5460 |
5113 (defun ps-page-number () | 5461 (defun ps-page-number () |
5114 (if ps-print-only-one-header | 5462 (if ps-print-only-one-header |
5115 (1+ (/ (1- ps-page-column) ps-number-of-columns)) | 5463 (1+ (/ (1- ps-page-column) ps-number-of-columns)) |
5116 ps-page-column)) | 5464 ps-page-column)) |
5117 | 5465 |
5118 | 5466 |
5119 (defun ps-next-page () | 5467 (defsubst ps-end-page () |
5468 (ps-output "EndPage\nEndDSCPage\n")) | |
5469 | |
5470 | |
5471 (defsubst ps-next-page () | |
5120 (ps-end-page) | 5472 (ps-end-page) |
5121 (ps-flush-output) | 5473 (ps-flush-output) |
5122 (ps-begin-page)) | 5474 (ps-begin-page)) |
5123 | 5475 |
5124 | 5476 |
5164 (ps-output "BeginDSCPage\n") | 5516 (ps-output "BeginDSCPage\n") |
5165 (run-hooks 'ps-print-begin-column-hook)) | 5517 (run-hooks 'ps-print-begin-column-hook)) |
5166 (setq ps-page-column (1+ ps-page-column))) | 5518 (setq ps-page-column (1+ ps-page-column))) |
5167 | 5519 |
5168 (defun ps-begin-page () | 5520 (defun ps-begin-page () |
5169 (ps-get-page-dimensions) | |
5170 (setq ps-width-remaining ps-print-width | 5521 (setq ps-width-remaining ps-print-width |
5171 ps-height-remaining ps-print-height) | 5522 ps-height-remaining ps-print-height) |
5172 | 5523 |
5173 (ps-header-page) | 5524 (ps-header-page) |
5174 | 5525 |
5175 (ps-output (format "/LineNumber %d def\n" ps-showline-count) | 5526 (ps-output (format "/LineNumber %d def\n" ps-showline-count) |
5176 (format "/PageNumber %d def\n" (ps-page-number))) | 5527 (format "/PageNumber %d def\n" (ps-page-number))) |
5177 | 5528 |
5178 (when ps-print-header | 5529 (when ps-print-header |
5179 (ps-generate-header "HeaderLinesLeft" ps-left-header) | 5530 (ps-generate-header "HeaderLinesLeft" "/h0" "/h1" ps-left-header) |
5180 (ps-generate-header "HeaderLinesRight" ps-right-header) | 5531 (ps-generate-header "HeaderLinesRight" "/h0" "/h1" ps-right-header) |
5181 (ps-output (format "%d SetHeaderLines\n" ps-header-lines))) | 5532 (ps-output (format "%d SetHeaderLines\n" ps-header-lines))) |
5533 | |
5534 (when ps-print-footer | |
5535 (ps-generate-header "FooterLinesLeft" "/H0" "/H0" ps-left-footer) | |
5536 (ps-generate-header "FooterLinesRight" "/H0" "/H0" ps-right-footer) | |
5537 (ps-output (format "%d SetFooterLines\n" ps-footer-lines))) | |
5182 | 5538 |
5183 (ps-output (number-to-string ps-lines-printed) " BeginPage\n") | 5539 (ps-output (number-to-string ps-lines-printed) " BeginPage\n") |
5184 (ps-set-font ps-current-font) | 5540 (ps-set-font ps-current-font) |
5185 (ps-set-bg ps-current-bg) | 5541 (ps-set-bg ps-current-bg) |
5186 (ps-set-color ps-current-color) | 5542 (ps-set-color ps-current-color) |
5187 (ps-mule-begin-page)) | 5543 (ps-mule-begin-page)) |
5188 | 5544 |
5189 (defun ps-end-page () | 5545 (defsubst ps-skip-newline (limit) |
5190 (ps-output "EndPage\nEndDSCPage\n")) | |
5191 | |
5192 (defun ps-skip-newline (limit) | |
5193 (setq ps-showline-count (1+ ps-showline-count) | 5546 (setq ps-showline-count (1+ ps-showline-count) |
5194 ps-lines-printed (1+ ps-lines-printed)) | 5547 ps-lines-printed (1+ ps-lines-printed)) |
5195 (and (< (point) limit) | 5548 (and (< (point) limit) |
5196 (forward-char 1))) | 5549 (forward-char 1))) |
5197 | 5550 |