annotate lisp/ps-print.el @ 13282:69fe836d7f02

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