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