annotate lisp/packages/ps-print.el @ 51:69ce12f60f55

Added tag r19-16b91 for changeset ee648375d8d6
author cvs
date Mon, 13 Aug 2007 08:56:44 +0200
parents 4103f0995bd7
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; ps-print.el --- Jim's Pretty-Good PostScript Generator for Emacs 19.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
5 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
6 ;; Maintainer: Jacques Duthen <duthen@club-internet.fr>
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
7 ;; Keywords: print, PostScript
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
8 ;; Time-stamp: <97/01/29 23:21:25 tjchol01>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
9 ;; Version: 3.05
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
10
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
11 (defconst ps-print-version "3.05"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
12 "ps-print.el, v 3.05 <97/01/17 duthen>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
13
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
14 Jack's last change version -- this file may have been edited as part of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
15 Emacs without changes to the version number. When reporting bugs,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
16 please also report the version of Emacs, if any, that ps-print was
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
17 distributed with.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
18
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
19 Please send all bug fixes and enhancements to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
20 Jacques Duthen <duthen@cegelec-red.fr>.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
21 ")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
22
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
23 ;; This file is part of GNU Emacs.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
24
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
25 ;; GNU Emacs is free software; you can redistribute it and/or modify
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
26 ;; it under the terms of the GNU General Public License as published by
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
30 ;; GNU Emacs is distributed in the hope that it will be useful,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
31 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
32 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
33 ;; GNU General Public License for more details.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; You should have received a copy of the GNU General Public License
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
36 ;; along with GNU Emacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
37 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
38 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; LCD Archive Entry:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; ps-print|James C. Thompson|thompson@wg2.waii.com|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; Jim's Pretty-Good PostScript Generator for Emacs 19 (ps-print)|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; 26-Feb-1994|2.8|~/packages/ps-print.el|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
45 ;; 3.05 [jack] <97/01/16 duthen>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
46 ;; Ben Wing <ben@666.com> took ps-print.el from the official 19.34
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
47 ;; GNU distribution:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
48 ;; -rw-rw-r-- 1 duthen 69315 Jul 22 1996 ps-print.el
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
49 ;; He patched it for XEmacs.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
50 ;; Steven L Baur <steve@miranova.com> sent me this version which has
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
51 ;; 26 diffs with 19.34.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
52 ;; I merge these 26 diffs into my 3.04 version.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
53
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
54 ;; `ps-paper-type': ###autoload.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
55 ;; `ps-print-color-p' `ps-color-values': Replace pixel-components by
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
56 ;; color-instance-rgb-components for XEmacs.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
57 ;; `ps-color-device': New function to dynamically test the device
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
58 ;; color capability, added where ps-print-color-p is tested.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
59 ;; `ps-xemacs-face-kind-p': Fixed.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
60 ;; `ps-do-despool': Permit dynamic evaluation at print time of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
61 ;; ps-lpr-switches.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
62 ;; `ps-eval-switch' `ps-flatten-list' `ps-flatten-list-1': New for
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
63 ;; the previous feature.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
64 ;; `ps-gnus-print-article-from-summary': Updated for Gnus 5.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
65
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
66
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
67 ;; 3.04 [jack] after [simon] Oct 8, 1996 Simon Marshall <simon@gnu.ai.mit.edu>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
68 ;; `ps-print-version':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
69 ;; Fix value.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
70 ;; `cl' `lisp-float-type':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
71 ;; Require them.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
72 ;; `ps-number-of-columns' `ps-*-font-size':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
73 ;; Try to select defaults better suited when `ps-landscape-mode' is non-nil.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
74 ;; `ps-*-faces':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
75 ;; Change default for Font Lock mode faces when `ps-print-color-p' is nil.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
76 ;; `ps-right-header':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
77 ;; Replace `time-stamp-yy/mm/dd' by `time-stamp-mon-dd-yyyy'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
78 ;; `ps-end-file' `ps-begin-page':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
79 ;; Fix bug in page count for Ghostview.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
80 ;; `ps-generate-postscript-with-faces':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
81 ;; Replace `ps-sorter' by `car-less-than-car'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
82 ;; `ps-plot' `ps-generate':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
83 ;; Replace `%d' by `%3d'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
84
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
85 ;; 3.03 [jack] Sept 27, 1996 Jacques Duthen <duthen@cegelec-red.fr>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
86 ;; Merge 31 diffs between 19.29 and 19.34
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
87
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
88 ;; 3.02 [jack] June 26, 1996 Jacques Duthen <duthen@cegelec-red.fr>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
89 ;; Add new page dimensions to `ps-page-dimensions-database' for `paper-type'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
90 ;; Improve landscape mode `ps-landscape-mode' and multiple columns
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
91 ;; printing `ps-number-of-columns':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
92 ;; The text and the margins are no more scaled.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
93 ;; Simplify the semantics of `ps-inter-column' (space between columns).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
94 ;; Add error checking for negative `ps-print-width' and `ps-print-height'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
95 ;; Change the semantics of `ps-top-margin' which is now the TOP MARGIN,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
96 ;; and add `ps-header-offset' instead of having `ps-top-margin' split in 2.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
97 ;; Add `ps-header-font-family', `ps-header-font-size' and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
98 ;; `ps-header-title-font-size' to control the header.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
99 ;; Add `ps-header-line-pad'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
100 ;; Change the semantics of `ps-font-info-database' to have symbolic
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
101 ;; font families.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
102 ;; Add new fonts to `ps-font-info-database': `Courier' `Helvetica'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
103 ;; `Times' `Palatino' `Helvetica-Narrow' `NewCenturySchlbk'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
104 ;; Make public `ps-font-family' and `ps-font-size' so that the user
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
105 ;; can directly control the text font and size without loading ps-print.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
106 ;; Add error checking for unknown font families and a message giving
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
107 ;; the exhaustive list of available font families.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
108 ;; Document how to install a new font family.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
109 ;; Add `/ReportAllFontInfo' to get all the font families of the printer.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
110 ;; Add the possibility to make `mixed' font families.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
111 ;; Add `ps-setup' to get the current setup.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
112 ;; Add tools `ps-line-lengths' `ps-nb-pages-buffer' `ps-nb-pages-region'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
113 ;; to help choose the font size.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
114 ;; Split `ps-print-prologue' in two to insert info from header fonts
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
115 ;; Replace indexes by macro `ps-page-dimensions-get-width'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
116 ;; to get access to the dimensions list.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
117 ;; Add `ps-select-font' inside `ps-get-page-dimensions'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
118 ;; Fix the "clumsy" `ps-page-height' management.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
119 ;; Move `ps-get-page-dimensions' to the beginning of `ps-begin-file'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
120 ;; to get early error checking.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
121 ;; Add sample setup `ps-jack-setup'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
122 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
123 ;; Rewrite a lot of postscript code and add comments inside it
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
124 ;; (maybe they should not (or optionally) be included in the generated
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
125 ;; Postscript).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
126 ;; Translate the origin to (lm, bm) to simplify the other moves.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
127 ;; Fix bug in `/HeaderOffset' with `/PrintStartY'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
128 ;; Fix bug in `/SetHeaderLines'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
129 ;; Change `/ReportFontInfo' for use by `/ReportAllFontInfo'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
130
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
131 ;; 3.01 [jack] June 4, 1996 Jacques Duthen <duthen@cegelec-red.fr>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
132 ;; Manage float value for every variable representing a size.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
133 ;; Add `ps-font-info-database' `ps-inter-column'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
134
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
135 ;; 3.00 [jack] May 17, 1996 Jacques Duthen <duthen@cegelec-red.fr>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
136 ;; based on 2.8 Jim's Pretty-Good version:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
137 ;; Add `ps-landscape-mode' and `ps-number-of-columns'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
138 ;; for dumb multi-column landscape mode.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
139
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;; Baseline-version: 2.8. (Jim's last change version -- this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;; file may have been edited as part of Emacs without changes to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;; version number. When reporting bugs, please also report the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; version of Emacs, if any, that ps-print was distributed with.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;; About ps-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;; --------------
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
151 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;; This package provides printing of Emacs buffers on PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;; printers; the buffer's bold and italic text attributes are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; preserved in the printer output. Ps-print is intended for use with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;; Emacs 19 or Lucid Emacs, together with a fontifying package such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;; font-lock or hilit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
158 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; Using ps-print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; --------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; The Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; Ps-print provides eight commands for generating PostScript images
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; of Emacs buffers:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;; ps-print-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;; ps-print-buffer-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;; ps-print-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;; ps-print-region-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;; ps-spool-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;; ps-spool-buffer-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;; ps-spool-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;; ps-spool-region-with-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 ;; These commands all perform essentially the same function: they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;; generate PostScript images suitable for printing on a PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; printer or displaying with GhostScript. These commands are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;; collectively referred to as "ps-print- commands".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; The word "print" or "spool" in the command name determines when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; PostScript image is sent to the printer:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; print - The PostScript image is immediately sent to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;; printer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; spool - The PostScript image is saved temporarily in an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;; Emacs buffer. Many images may be spooled locally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;; before printing them. To send the spooled images
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
190 ;; to the printer, use the command `ps-despool'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; The spooling mechanism was designed for printing lots of small
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;; files (mail messages or netnews articles) to save paper that would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;; otherwise be wasted on banner pages, and to make it easier to find
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ;; your output at the printer (it's easier to pick up one 50-page
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;; printout than to find 50 single-page printouts).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
198 ;; Ps-print has a hook in the `kill-emacs-hooks' so that you won't
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
199 ;; accidentally quit from Emacs while you have unprinted PostScript
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; waiting in the spool buffer. If you do attempt to exit with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;; spooled PostScript, you'll be asked if you want to print it, and if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; you decline, you'll be asked to confirm the exit; this is modeled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;; on the confirmation that Emacs uses for modified buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;; The word "buffer" or "region" in the command name determines how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; much of the buffer is printed:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; buffer - Print the entire buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; region - Print just the current region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;; The -with-faces suffix on the command name means that the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;; will include font, color, and underline information in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ;; PostScript image, so the printed image can look as pretty as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; buffer. The ps-print- commands without the -with-faces suffix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; don't include font, color, or underline information; images printed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; with these commands aren't as pretty, but are faster to generate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; Two ps-print- command examples:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; ps-print-buffer - print the entire buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; without font, color, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; underline information, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; send it immediately to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;; printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; ps-spool-region-with-faces - print just the current region;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; include font, color, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; underline information, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;; spool the image in Emacs to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ;; send to the printer later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; Invoking Ps-Print
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
235 ;; -----------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; To print your buffer, type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; M-x ps-print-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; or substitute one of the other seven ps-print- commands. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; command will generate the PostScript image and print or spool it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;; specified. By giving the command a prefix argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;; C-u M-x ps-print-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; it will save the PostScript image to a file instead of sending it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;; to the printer; you will be prompted for the name of the file to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;; save the image to. The prefix argument is ignored by the commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;; that spool their images, but you may save the spooled images to a
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
251 ;; file by giving a prefix argument to `ps-despool':
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ;; C-u M-x ps-despool
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
255 ;; When invoked this way, `ps-despool' will prompt you for the name of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ;; the file to save to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
258 ;; Any of the `ps-print-' commands can be bound to keys; I recommend
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
259 ;; binding `ps-spool-buffer-with-faces', `ps-spool-region-with-faces',
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
260 ;; and `ps-despool'. Here are the bindings I use on my Sun 4 keyboard:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;; (global-set-key 'f22 'ps-spool-buffer-with-faces) ;f22 is prsc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;; (global-set-key '(shift f22) 'ps-spool-region-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;; (global-set-key '(control f22) 'ps-despool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;; The Printer Interface
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
268 ;; ---------------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
270 ;; The variables `ps-lpr-command' and `ps-lpr-switches' determine what
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;; command is used to send the PostScript images to the printer, and
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
272 ;; what arguments to give the command. These are analogous to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
273 ;; `lpr-command' and `lpr-switches'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
275 ;; Make sure that they contain appropriate values for your system;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
276 ;; see the usage notes below and the documentation of these variables.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
277 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
278 ;; NOTE: `ps-lpr-command' and `ps-lpr-switches' take their initial values
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
279 ;; from the variables `lpr-command' and `lpr-switches'. If you have
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
280 ;; `lpr-command' set to invoke a pretty-printer such as `enscript',
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
281 ;; then ps-print won't work properly. `ps-lpr-command' must name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;; a program that does not format the files it prints.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
285 ;; The Page Layout
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
286 ;; ---------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
288 ;; All dimensions are floats in PostScript points.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
289 ;; 1 inch == 2.54 cm == 72 points
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
290 ;; 1 cm == (/ 1 2.54) inch == (/ 72 2.54) points
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
292 ;; The variable `ps-paper-type' determines the size of paper ps-print
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
293 ;; formats for; it should contain one of the symbols:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
294 ;; `a4' `a3' `letter' `legal' `letter-small' `tabloid'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
295 ;; `ledger' `statement' `executive' `a4small' `b4' `b5'
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
297 ;; The variable `ps-landscape-mode' determines the orientation
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
298 ;; of the printing on the page:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
299 ;; nil means `portrait' mode, non-nil means `landscape' mode.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
300 ;; There is no oblique mode yet, though this is easy to do in ps.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
301
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
302 ;; In landscape mode, the text is NOT scaled: you may print 70 lines
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
303 ;; in portrait mode and only 50 lignes in landscape mode.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
304 ;; The margins represent margins in the printed paper:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
305 ;; the top margin is the margin between the top of the page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
306 ;; and the printed header, whatever the orientation is.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
308 ;; The variable `ps-number-of-columns' determines the number of columns
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
309 ;; both in landscape and portrait mode.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
310 ;; You can use:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
311 ;; - (the standard) one column portrait mode
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
312 ;; - (my favorite) two columns landscape mode (which spares trees)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
313 ;; but also
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
314 ;; - one column landscape mode for files with very long lines.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
315 ;; - multi-column portrait or landscape mode
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
318 ;; Horizontal layout
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
319 ;; -----------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
320 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
321 ;; The horizontal layout is determined by the variables
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
322 ;; `ps-left-margin' `ps-inter-column' `ps-right-margin'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
323 ;; as follows:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
324 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
325 ;; ------------------------------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
326 ;; | | | | | | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
327 ;; | lm | text | ic | text | ic | text | rm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
328 ;; | | | | | | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
329 ;; ------------------------------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
330 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
331 ;; If `ps-number-of-columns' is 1, `ps-inter-column' is not relevant.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
332 ;; Usually, lm = rm > 0 and ic = lm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
333 ;; If (ic < 0), the text of adjacent columns can overlap.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
334 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
335 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
336 ;; Vertical layout
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
337 ;; ---------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
339 ;; The vertical layout is determined by the variables
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
340 ;; `ps-bottom-margin' `ps-top-margin' `ps-header-offset'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
341 ;; as follows:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
342 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
343 ;; |--------| |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
344 ;; | tm | | tm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
345 ;; |--------| |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
346 ;; | header | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
347 ;; |--------| | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
348 ;; | ho | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
349 ;; |--------| or | text |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
350 ;; | | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
351 ;; | text | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
352 ;; | | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
353 ;; |--------| |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
354 ;; | bm | | bm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
355 ;; |--------| |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
356 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
357 ;; If `ps-print-header' is nil, `ps-header-offset' is not relevant.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
358 ;; The margins represent margins in the printed paper:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
359 ;; the top margin is the margin between the top of the page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
360 ;; and the printed header, whatever the orientation is.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ;; Headers
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
364 ;; -------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
366 ;; Ps-print can print headers at the top of each column; the default
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ;; headers contain the following four items: on the left, the name of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 ;; the buffer and, if the buffer is visiting a file, the file's
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
369 ;; directory; on the right, the page number and date of printing.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
370 ;; The default headers look something like this:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;; ps-print.el 1/21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ;; /home/jct/emacs-lisp/ps/new 94/12/31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ;; When printing on duplex printers, left and right are reversed so
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
376 ;; that the page numbers are toward the outside (cf. `ps-spool-duplex').
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
377 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
378 ;; Headers are configurable:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
379 ;; To turn them off completely, set `ps-print-header' to nil.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
380 ;; To turn off the header's gaudy framing box,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
381 ;; set `ps-print-header-frame' to nil.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
383 ;; The font family and size of text in the header are determined
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
384 ;; by the variables `ps-header-font-family', `ps-header-font-size' and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
385 ;; `ps-header-title-font-size' (see below).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
386 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
387 ;; The variable `ps-header-line-pad' determines the portion of a header
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
388 ;; title line height to insert between the header frame and the text
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
389 ;; it contains, both in the vertical and horizontal directions:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
390 ;; .5 means half a line.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
391
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
392 ;; Page numbers are printed in `n/m' format, indicating page n of m pages;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
393 ;; to omit the total page count and just print the page number,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
394 ;; set `ps-show-n-of-n' to nil.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ;; The amount of information in the header can be changed by changing
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
397 ;; the number of lines. To show less, set `ps-header-lines' to 1, and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ;; the header will show only the buffer name and page number. To show
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
399 ;; more, set `ps-header-lines' to 3, and the header will show the time of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;; printing below the date.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;; To change the content of the headers, change the variables
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
403 ;; `ps-left-header' and `ps-right-header'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
404 ;; These variables are lists, specifying top-to-bottom the text
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
405 ;; to display on the left or right side of the header.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
406 ;; Each element of the list should be a string or a symbol.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
407 ;; Strings are inserted directly into the PostScript arrays,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
408 ;; and should contain the PostScript string delimiters '(' and ')'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ;; Symbols in the header format lists can either represent functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;; or variables. Functions are called, and should return a string to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;; show in the header. Variables should contain strings to display in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;; the header. In either case, function or variable, the PostScript
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
414 ;; string delimiters are added by ps-print, and should not be part of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 ;; the returned value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 ;; Here's an example: say we want the left header to display the text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 ;; Moe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 ;; Larry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ;; Curly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;; where we have a function to return "Moe"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 ;; (defun moe-func ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 ;; "Moe")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;; a variable specifying "Larry"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ;; (setq larry-var "Larry")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
432 ;; and a literal for "Curly". Here's how `ps-left-header' should be
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 ;; set:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 ;; (setq ps-left-header (list 'moe-func 'larry-var "(Curly)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 ;; Note that Curly has the PostScript string delimiters inside his
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
438 ;; quotes -- those aren't misplaced lisp delimiters!
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
439 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
440 ;; Without them, PostScript would attempt to call the undefined
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
441 ;; function Curly, which would result in a PostScript error.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
442 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
443 ;; Since most printers don't report PostScript errors except by
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
444 ;; aborting the print job, this kind of error can be hard to track down.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
445 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
446 ;; Consider yourself warned!
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ;; Duplex Printers
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
450 ;; ---------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 ;; If you have a duplex-capable printer (one that prints both sides of
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
453 ;; the paper), set `ps-spool-duplex' to t.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
454 ;; Ps-print will insert blank pages to make sure each buffer starts
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
455 ;; on the correct side of the paper.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
456 ;; Don't forget to set `ps-lpr-switches' to select duplex printing
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
457 ;; for your printer.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
458 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
459 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
460 ;; Font managing
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
461 ;; -------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
462 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
463 ;; Ps-print now knows rather precisely some fonts:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
464 ;; the variable `ps-font-info-database' contains information
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
465 ;; for a list of font families (currently mainly `Courier' `Helvetica'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
466 ;; `Times' `Palatino' `Helvetica-Narrow' `NewCenturySchlbk').
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
467 ;; Each font family contains the font names for standard, bold, italic
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
468 ;; and bold-italic characters, a reference size (usually 10) and the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
469 ;; corresponding line height, width of a space and average character width.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
471 ;; The variable `ps-font-family' determines which font family
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
472 ;; is to be used for ordinary text.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
473 ;; If its value does not correspond to a known font family,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
474 ;; an error message is printed into the `*Messages*' buffer,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
475 ;; which lists the currently available font families.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
477 ;; The variable `ps-font-size' determines the size (in points)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
478 ;; of the font for ordinary text, when generating Postscript.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
479 ;; Its value is a float.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
480 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
481 ;; Similarly, the variable `ps-header-font-family' determines
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
482 ;; which font family is to be used for text in the header.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
483 ;; The variable `ps-header-font-size' determines the font size,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
484 ;; in points, for text in the header.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
485 ;; The variable `ps-header-title-font-size' determines the font size,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
486 ;; in points, for the top line of text in the header.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
487 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
488 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
489 ;; Adding a new font family
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
490 ;; ------------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
491 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
492 ;; To use a new font family, you MUST first teach ps-print
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
493 ;; this font, i.e., add its information to `ps-font-info-database',
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
494 ;; otherwise ps-print cannot correctly place line and page breaks.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
495 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
496 ;; For example, assuming `Helvetica' is unknown,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
497 ;; you first need to do the following ONLY ONCE:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
498 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
499 ;; - create a new buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
500 ;; - generate the PostScript image to a file (C-u M-x ps-print-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
501 ;; - open this file and find the line:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
502 ;; `% 3 cm 20 cm moveto 10 /Courier ReportFontInfo showpage'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
503 ;; - delete the leading `%' (which is the Postscript comment character)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
504 ;; - replace in this line `Courier' by the new font (say `Helvetica')
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
505 ;; to get the line:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
506 ;; `3 cm 20 cm moveto 10 /Helvetica ReportFontInfo showpage'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
507 ;; - send this file to the printer (or to ghostscript).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
508 ;; You should read the following on the output page:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
509 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
510 ;; For Helvetica 10 point, the line height is 11.56, the space width is 2.78
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
511 ;; and a crude estimate of average character width is 5.09243
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
512 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
513 ;; - Add these values to the `ps-font-info-database':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
514 ;; (setq ps-font-info-database
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
515 ;; (append
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
516 ;; '((Helvetica ; the family name
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
517 ;; "Helvetica" "Helvetica-Bold" "Helvetica-Oblique" "Helvetica-BoldOblique"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
518 ;; 10.0 11.56 2.78 5.09243))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
519 ;; ps-font-info-database))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
520 ;; - Now you can use this font family with any size:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
521 ;; (setq ps-font-family 'Helvetica)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
522 ;; - if you want to use this family in another emacs session, you must
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
523 ;; put into your `~/.emacs':
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
524 ;; (require 'ps-print)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
525 ;; (setq ps-font-info-database (append ...)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
526 ;; if you don't want to load ps-print, you have to copy the whole value:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
527 ;; (setq ps-font-info-database '(<your stuff> <the standard stuff>))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
528 ;; or, if you can wait until the `ps-print-hook' is implemented, do:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
529 ;; (add-hook 'ps-print-hook '(setq ps-font-info-database (append ...)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
530 ;; This does not work yet, since there is no `ps-print-hook' yet.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
532 ;; You can create new `mixed' font families like:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
533 ;; (my-mixed-family
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
534 ;; "Courier-Bold" "Helvetica"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
535 ;; "Zapf-Chancery-MediumItalic" "NewCenturySchlbk-BoldItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
536 ;; 10.0 10.55 6.0 6.0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
537 ;; Now you can use your new font family with any size:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
538 ;; (setq ps-font-family 'my-mixed-family)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
539 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
540 ;; You can get information on all the fonts resident in YOUR printer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
541 ;; by uncommenting the line:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
542 ;; % 3 cm 20 cm moveto ReportAllFontInfo showpage
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
543 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
544 ;; The postscript file should be sent to YOUR postscript printer.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
545 ;; If you send it to ghostscript or to another postscript printer,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
546 ;; you may get slightly different results.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
547 ;; Anyway, as ghostscript fonts are autoload, you won't get
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
548 ;; much font info.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
549 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
550 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
551 ;; How Ps-Print Deals With Faces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
552 ;; -----------------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
553 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
554 ;; The ps-print-*-with-faces commands attempt to determine which faces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
555 ;; should be printed in bold or italic, but their guesses aren't
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
556 ;; always right. For example, you might want to map colors into faces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
557 ;; so that blue faces print in bold, and red faces in italic.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
558 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
559 ;; It is possible to force ps-print to consider specific faces bold or
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
560 ;; italic, no matter what font they are displayed in, by setting the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
561 ;; variables `ps-bold-faces' and `ps-italic-faces'. These variables
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
562 ;; contain lists of faces that ps-print should consider bold or
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
563 ;; italic; to set them, put code like the following into your .emacs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
564 ;; file:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
565 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
566 ;; (setq ps-bold-faces '(my-blue-face))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
567 ;; (setq ps-italic-faces '(my-red-face))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
568 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
569 ;; Faces like bold-italic that are both bold and italic should go in
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
570 ;; *both* lists.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
572 ;; Ps-print keeps internal lists of which fonts are bold and which are
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
573 ;; italic; these lists are built the first time you invoke ps-print.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
574 ;; For the sake of efficiency, the lists are built only once; the same
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
575 ;; lists are referred in later invocations of ps-print.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
576 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
577 ;; Because these lists are built only once, it's possible for them to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
578 ;; get out of sync, if a face changes, or if new faces are added. To
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
579 ;; get the lists back in sync, you can set the variable
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
580 ;; `ps-build-face-reference' to t, and the lists will be rebuilt the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
581 ;; next time ps-print is invoked.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
582 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
583 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
584 ;; How Ps-Print Deals With Color
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
585 ;; -----------------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
586 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
587 ;; Ps-print detects faces with foreground and background colors
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
588 ;; defined and embeds color information in the PostScript image.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
589 ;; The default foreground and background colors are defined by the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
590 ;; variables `ps-default-fg' and `ps-default-bg'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
591 ;; On black-and-white printers, colors are displayed in grayscale.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
592 ;; To turn off color output, set `ps-print-color-p' to nil.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
593 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
594 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
595 ;; Utilities
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
596 ;; ---------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
597 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
598 ;; Some tools are provided to help you customize your font setup.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
599 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
600 ;; `ps-setup' returns (some part of) the current setup.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
601 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
602 ;; To avoid wrapping too many lines, you may want to adjust the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
603 ;; left and right margins and the font size. On UN*X systems, do:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
604 ;; pr -t file | awk '{printf "%3d %s\n", length($0), $0}' | sort -r | head
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
605 ;; to determine the longest lines of your file.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
606 ;; Then, the command `ps-line-lengths' will give you the correspondence
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
607 ;; between a line length (number of characters) and the maximum font
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
608 ;; size which doesn't wrap such a line with the current ps-print setup.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
609 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
610 ;; The commands `ps-nb-pages-buffer' and `ps-nb-pages-region' display
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
611 ;; the correspondence between a number of pages and the maximum font
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
612 ;; size which allow the number of lines of the current buffer or of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
613 ;; its current region to fit in this number of pages.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
614 ;; Note: line folding is not taken into account in this process
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
615 ;; and could change the results.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
616 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
617 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 ;; New since version 1.5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ;; ---------------------
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
620 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;; Color output capability.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ;; Automatic detection of font attributes (bold, italic).
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
623 ;; Configurable headers with page numbers.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
624 ;; Slightly faster.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
625 ;; Support for different paper sizes.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
626 ;; Better conformance to PostScript Document Structure Conventions.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
629 ;; New since version 2.8
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
630 ;; ---------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
631 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
632 ;; [jack] 960517 Jacques Duthen <duthen@cegelec-red.fr>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
634 ;; Font familiy and float size for text and header.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
635 ;; Landscape mode.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
636 ;; Multiple columns.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
637 ;; Tools for page setup.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 ;; Known bugs and limitations of ps-print:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ;; --------------------------------------
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
642 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ;; Although color printing will work in XEmacs 19.12, it doesn't work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 ;; well; in particular, bold or italic fonts don't print in the right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 ;; background color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 ;; Invisible properties aren't correctly ignored in XEmacs 19.12.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ;; Automatic font-attribute detection doesn't work well, especially
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 ;; with hilit19 and older versions of get-create-face. Users having
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
651 ;; problems with auto-font detection should use the lists
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
652 ;; `ps-italic-faces' and `ps-bold-faces' and/or turn off automatic
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
653 ;; detection by setting `ps-auto-font-detect' to nil.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; Automatic font-attribute detection doesn't work with XEmacs 19.12
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
656 ;; in tty mode; use the lists `ps-italic-faces' and `ps-bold-faces'
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ;; instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 ;; Still too slow; could use some hand-optimization.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;; ASCII Control characters other than tab, linefeed and pagefeed are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;; not handled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 ;; Default background color isn't working.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 ;; Faces are always treated as opaque.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 ;; Epoch and Emacs 18 not supported. At all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
670 ;; Fixed-pitch fonts work better for line folding, but are not required.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
672 ;; `ps-nb-pages-buffer' and `ps-nb-pages-region' don't take care
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
673 ;; of folding lines.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
674 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
675 ;;
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
676 ;; Things to change:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
677 ;; ----------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ;;
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
679 ;; Add `ps-print-hook' (I don't know how to do that (yet!)).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
680 ;; Add 4-up capability (really needed?).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
681 ;; Add line numbers (should not be too hard).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
682 ;; Add `ps-non-bold-faces' and `ps-non-italic-faces' (should be easy).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
683 ;; Put one header per page over the columns (easy but needed?).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
684 ;; Improve the memory management for big files (hard?).
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
685 ;; `ps-nb-pages-buffer' and `ps-nb-pages-region' should take care
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
686 ;; of folding lines.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 ;; Acknowledgements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 ;; ----------------
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
691 ;; Thanks to Jim Thompson <?@?> for the 2.8 version I started from.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
692 ;; [jack]
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
693 ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 ;; Thanks to Kevin Rodgers <kevinr@ihs.com> for adding support for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 ;; color and the invisible property.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 ;; Thanks to Avishai Yacobi, avishaiy@mcil.comm.mot.com, for writing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 ;; the initial port to Emacs 19. His code is no longer part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 ;; ps-print, but his work is still appreciated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 ;; Thanks to Remi Houdaille and Michel Train, michel@metasoft.fdn.org,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 ;; for adding underline support. Their code also is no longer part of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 ;; ps-print, but their efforts are not forgotten.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 ;; Thanks also to all of you who mailed code to add features to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 ;; ps-print; although I didn't use your code, I still appreciate your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 ;; sharing it with me.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 ;; Thanks to all who mailed comments, encouragement, and criticism.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 ;; Thanks also to all who responded to my survey; I had too many
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 ;; responses to reply to them all, but I greatly appreciate your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 ;; interest.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 ;; Jim
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
719 (eval-when-compile
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
720 (require 'cl))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
721
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
722 (unless (featurep 'lisp-float-type)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
723 (error "`ps-print' requires floating point support"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 ;; User Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
728 ;;; Interface to the command system
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
729
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (defvar ps-lpr-command lpr-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 "*The shell command for printing a PostScript file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (defvar ps-lpr-switches lpr-switches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 "*A list of extra switches to pass to `ps-lpr-command'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
736 ;;; Page layout
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
737
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
738 ;; All page dimensions are in PostScript points.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
739 ;; 1 inch == 2.54 cm == 72 points
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
740 ;; 1 cm == (/ 1 2.54) inch == (/ 72 2.54) points
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
741
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
742 ;; Letter 8.5 inch x 11.0 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
743 ;; Legal 8.5 inch x 14.0 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
744 ;; A4 8.26 inch x 11.69 inch = 21.0 cm x 29.7 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
745
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
746 ;; LetterSmall 7.68 inch x 10.16 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
747 ;; Tabloid 11.0 inch x 17.0 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
748 ;; Ledger 17.0 inch x 11.0 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
749 ;; Statement 5.5 inch x 8.5 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
750 ;; Executive 7.5 inch x 10.0 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
751 ;; A3 11.69 inch x 16.5 inch = 29.7 cm x 42.0 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
752 ;; A4Small 7.47 inch x 10.85 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
753 ;; B4 10.125 inch x 14.33 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
754 ;; B5 7.16 inch x 10.125 inch
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
755
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
756 (defvar ps-page-dimensions-database
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
757 (list (list 'a4 (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
758 (list 'a3 (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
759 (list 'letter (* 72 8.5) (* 72 11.0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
760 (list 'legal (* 72 8.5) (* 72 14.0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
761 (list 'letter-small (* 72 7.68) (* 72 10.16))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
762 (list 'tabloid (* 72 11.0) (* 72 17.0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
763 (list 'ledger (* 72 17.0) (* 72 11.0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
764 (list 'statement (* 72 5.5) (* 72 8.5))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
765 (list 'executive (* 72 7.5) (* 72 10.0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
766 (list 'a4small (* 72 7.47) (* 72 10.85))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
767 (list 'b4 (* 72 10.125) (* 72 14.33))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
768 (list 'b5 (* 72 7.16) (* 72 10.125)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
769 "*List associating a symbolic paper type to its width and height.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
770 see `ps-paper-type'.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 ;;;###autoload
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
773 (defvar ps-paper-type 'letter
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
774 "*Specifies the size of paper to format for.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
775 Should be one of the paper types defined in `ps-page-dimensions-database', for
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
776 example `letter', `legal' or `a4'.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
777
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
778 (defvar ps-landscape-mode 'nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
779 "*Non-nil means print in landscape mode.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
780
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
781 (defvar ps-number-of-columns (if ps-landscape-mode 2 1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
782 "*Specifies the number of columns")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
783
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
784 ;;; Horizontal layout
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
785
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
786 ;; ------------------------------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
787 ;; | | | | | | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
788 ;; | lm | text | ic | text | ic | text | rm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
789 ;; | | | | | | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
790 ;; ------------------------------------------
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
791
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
792 (defvar ps-left-margin (/ (* 72 2.0) 2.54) ; 2 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
793 "*Left margin in points (1/72 inch).")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
794
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
795 (defvar ps-right-margin (/ (* 72 2.0) 2.54) ; 2 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
796 "*Right margin in points (1/72 inch).")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
797
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
798 (defvar ps-inter-column (/ (* 72 2.0) 2.54) ; 2 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
799 "*Horizontal space between columns in points (1/72 inch).")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
800
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
801 ;;; Vertical layout
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
802
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
803 ;; |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
804 ;; | tm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
805 ;; |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
806 ;; | header |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
807 ;; |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
808 ;; | ho |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
809 ;; |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
810 ;; | text |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
811 ;; |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
812 ;; | bm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
813 ;; |--------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
814
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
815 (defvar ps-bottom-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
816 "*Bottom margin in points (1/72 inch).")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
817
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
818 (defvar ps-top-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
819 "*Top margin in points (1/72 inch).")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
820
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
821 (defvar ps-header-offset (/ (* 72 1.0) 2.54) ; 1.0 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
822 "*Vertical space in points (1/72 inch) between the main text and the header.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
823
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
824 (defvar ps-header-line-pad 0.15
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
825 "*Portion of a header title line height to insert between the header frame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
826 and the text it contains, both in the vertical and horizontal directions.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
827
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
828 ;;; Header setup
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (defvar ps-print-header t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 "*Non-nil means print a header at the top of each page.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 By default, the header displays the buffer name, page number, and, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 the buffer is visiting a file, the file's directory. Headers are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 customizable by changing variables `ps-header-left' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 `ps-header-right'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (defvar ps-print-header-frame t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 "*Non-nil means draw a gaudy frame around the header.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
840 (defvar ps-header-lines 2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
841 "*Number of lines to display in page header, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
842 (make-variable-buffer-local 'ps-header-lines)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
843
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (defvar ps-show-n-of-n t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 "*Non-nil means show page numbers as N/M, meaning page N of M.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 Note: page numbers are displayed as part of headers, see variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 `ps-print-headers'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
849 (defvar ps-spool-duplex nil ; Not many people have duplex
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
850 ; printers, so default to nil.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
851 "*Non-nil indicates spooling is for a two-sided printer.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
852 For a duplex printer, the `ps-spool-*' commands will insert blank pages
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
853 as needed between print jobs so that the next buffer printed will
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
854 start on the right page. Also, if headers are turned on, the headers
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
855 will be reversed on duplex printers so that the page numbers fall to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
856 the left on even-numbered pages.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
857
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
858 ;;; Fonts
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
859
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
860 (defvar ps-font-info-database
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
861 '((Courier ; the family key
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
862 "Courier" "Courier-Bold" "Courier-Oblique" "Courier-BoldOblique"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
863 10.0 10.55 6.0 6.0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
864 (Helvetica ; the family key
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
865 "Helvetica" "Helvetica-Bold" "Helvetica-Oblique" "Helvetica-BoldOblique"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
866 10.0 11.56 2.78 5.09243)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
867 (Times
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
868 "Times-Roman" "Times-Bold" "Times-Italic" "Times-BoldItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
869 10.0 11.0 2.5 4.71432)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
870 (Palatino
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
871 "Palatino-Roman" "Palatino-Bold" "Palatino-Italic" "Palatino-BoldItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
872 10.0 12.1 2.5 5.08676)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
873 (Helvetica-Narrow
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
874 "Helvetica-Narrow" "Helvetica-Narrow-Bold"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
875 "Helvetica-Narrow-Oblique" "Helvetica-Narrow-BoldOblique"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
876 10.0 11.56 2.2796 4.17579)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
877 (NewCenturySchlbk
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
878 "NewCenturySchlbk-Roman" "NewCenturySchlbk-Bold"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
879 "NewCenturySchlbk-Italic" "NewCenturySchlbk-BoldItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
880 10.0 12.15 2.78 5.31162)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
881 ;; got no bold for the next ones
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
882 (AvantGarde-Book
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
883 "AvantGarde-Book" "AvantGarde-Book"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
884 "AvantGarde-BookOblique" "AvantGarde-BookOblique"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
885 10.0 11.77 2.77 5.45189)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
886 (AvantGarde-Demi
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
887 "AvantGarde-Demi" "AvantGarde-Demi"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
888 "AvantGarde-DemiOblique" "AvantGarde-DemiOblique"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
889 10.0 12.72 2.8 5.51351)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
890 (Bookman-Demi
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
891 "Bookman-Demi" "Bookman-Demi"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
892 "Bookman-DemiItalic" "Bookman-DemiItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
893 10.0 11.77 3.4 6.05946)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
894 (Bookman-Light
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
895 "Bookman-Light" "Bookman-Light"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
896 "Bookman-LightItalic" "Bookman-LightItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
897 10.0 11.79 3.2 5.67027)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
898 ;; got no bold and no italic for the next ones
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
899 (Symbol
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
900 "Symbol" "Symbol" "Symbol" "Symbol"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
901 10.0 13.03 2.5 3.24324)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
902 (Zapf-Dingbats
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
903 "Zapf-Dingbats" "Zapf-Dingbats" "Zapf-Dingbats" "Zapf-Dingbats"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
904 10.0 9.63 2.78 2.78)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
905 (Zapf-Chancery-MediumItalic
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
906 "Zapf-Chancery-MediumItalic" "Zapf-Chancery-MediumItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
907 "Zapf-Chancery-MediumItalic" "Zapf-Chancery-MediumItalic"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
908 10.0 11.45 2.2 4.10811)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
909 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
910 "*Font info database: font family (the key), name, bold, italic, bold-italic,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
911 reference size, line height, space width, average character width.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
912 To get the info for another specific font (say Helvetica), do the following:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
913 - create a new buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
914 - generate the PostScript image to a file (C-u M-x ps-print-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
915 - open this file and delete the leading `%' (which is the Postscript
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
916 comment character) from the line
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
917 `% 3 cm 20 cm moveto 10 /Courier ReportFontInfo showpage'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
918 to get the line
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
919 `3 cm 20 cm moveto 10 /Helvetica ReportFontInfo showpage'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
920 - add the values to `ps-font-info-database'.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
921 You can get all the fonts of YOUR printer using `ReportAllFontInfo'.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
922
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
923 (defvar ps-font-family 'Courier
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
924 "Font family name for ordinary text, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
925
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
926 (defvar ps-font-size (if ps-landscape-mode 7 8.5)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
927 "Font size, in points, for ordinary text, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
928
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
929 (defvar ps-header-font-family 'Helvetica
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
930 "Font family name for text in the header, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
931
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
932 (defvar ps-header-font-size (if ps-landscape-mode 10 12)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
933 "Font size, in points, for text in the header, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
934
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
935 (defvar ps-header-title-font-size (if ps-landscape-mode 12 14)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
936 "Font size, in points, for the top line of text in the header,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
937 when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
938
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
939 ;;; Colors
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
940
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 ;;;###autoload
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
942 ;;; The 19.33 fsf version includes a test on pixel components instead
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
943 ;;; of color-instance-rgb-components
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
944 (defvar ps-print-color-p (or (fboundp 'x-color-values) ; fsf
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
945 (fboundp 'color-instance-rgb-components))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ; xemacs
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
947 ; Printing color requires x-color-values.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 "*If non-nil, print the buffer's text in color.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (defvar ps-default-fg '(0.0 0.0 0.0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 "*RGB values of the default foreground color. Defaults to black.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (defvar ps-default-bg '(1.0 1.0 1.0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 "*RGB values of the default background color. Defaults to white.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (defvar ps-auto-font-detect t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 "*Non-nil means automatically detect bold/italic face attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 nil means rely solely on the lists `ps-bold-faces', `ps-italic-faces',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 and `ps-underlined-faces'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
961 (defvar ps-bold-faces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
962 (unless ps-print-color-p
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
963 '(font-lock-function-name-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
964 font-lock-builtin-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
965 font-lock-variable-name-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
966 font-lock-keyword-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
967 font-lock-warning-face))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 "*A list of the \(non-bold\) faces that should be printed in bold font.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 This applies to generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
971 (defvar ps-italic-faces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
972 (unless ps-print-color-p
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
973 '(font-lock-variable-name-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
974 font-lock-string-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
975 font-lock-comment-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
976 font-lock-warning-face))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 "*A list of the \(non-italic\) faces that should be printed in italic font.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 This applies to generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
980 (defvar ps-underlined-faces
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
981 (unless ps-print-color-p
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
982 '(font-lock-function-name-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
983 font-lock-type-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
984 font-lock-reference-face
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
985 font-lock-warning-face))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 "*A list of the \(non-underlined\) faces that should be printed underlined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 This applies to generating Postscript.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (defvar ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (list 'ps-get-buffer-name 'ps-header-dirpart)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
991 "*The items to display (each on a line) on the left part of the page header.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 This applies to generating Postscript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 The value should be a list of strings and symbols, each representing an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 entry in the PostScript array HeaderLinesLeft.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 Strings are inserted unchanged into the array; those representing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 PostScript string literals should be delimited with PostScript string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 delimiters '(' and ')'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 For symbols with bound functions, the function is called and should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 return a string to be inserted into the array. For symbols with bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 values, the value should be a string to be inserted into the array.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 In either case, function or variable, the string value has PostScript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 string delimiters added to it.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (make-variable-buffer-local 'ps-left-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (defvar ps-right-header
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1009 (list "/pagenumberstring load" 'time-stamp-mon-dd-yyyy 'time-stamp-hh:mm:ss)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1010 "*The items to display (each on a line) on the right part of the page header.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 This applies to generating Postscript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 See the variable `ps-left-header' for a description of the format of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 this variable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (make-variable-buffer-local 'ps-right-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (defvar ps-razzle-dazzle t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 "*Non-nil means report progress while formatting buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1020 (defvar ps-adobe-tag "%!PS-Adobe-3.0\n"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 "*Contains the header line identifying the output as PostScript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 By default, `ps-adobe-tag' contains the standard identifier. Some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 printers require slightly different versions of this line.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (defvar ps-build-face-reference t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 "*Non-nil means build the reference face lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 Ps-print sets this value to nil after it builds its internal reference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 lists of bold and italic faces. By settings its value back to t, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 can force ps-print to rebuild the lists the next time you invoke one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 of the ...-with-faces commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 You should set this value back to t after you change the attributes of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 any face, or create new faces. Most users shouldn't have to worry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 about its setting, though.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (defvar ps-always-build-face-reference nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 "*Non-nil means always rebuild the reference face lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 If this variable is non-nil, ps-print will rebuild its internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 reference lists of bold and italic faces *every* time one of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 -with-faces commands is called. Most users shouldn't need to set this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 variable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 ;; User commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (defun ps-print-buffer (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 "Generate and print a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 When called with a numeric prefix argument (C-u), prompts the user for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 the name of a file to save the PostScript image in, instead of sending
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 it to the printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 More specifically, the FILENAME argument is treated as follows: if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 is nil, send the image to the printer. If FILENAME is a string, save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 the PostScript image in a file with that name. If FILENAME is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 number, prompt the user for the name of the file to save in."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (interactive (list (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 'ps-generate-postscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (defun ps-print-buffer-with-faces (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 "Generate and print a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 Like `ps-print-buffer', but includes font, color, and underline
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1071 information in the generated image. This command works only if you
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1072 are using a window system, so it has a way to determine color values."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (interactive (list (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 'ps-generate-postscript-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (defun ps-print-region (from to &optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 "Generate and print a PostScript image of the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 Like `ps-print-buffer', but prints just the current region."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 'ps-generate-postscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (defun ps-print-region-with-faces (from to &optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 "Generate and print a PostScript image of the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 Like `ps-print-region', but includes font, color, and underline
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1094 information in the generated image. This command works only if you
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1095 are using a window system, so it has a way to determine color values."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (interactive (list (point) (mark) (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 'ps-generate-postscript-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 (defun ps-spool-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 "Generate and spool a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 Like `ps-print-buffer' except that the PostScript image is saved in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 local buffer to be sent to the printer later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 'ps-generate-postscript))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (defun ps-spool-buffer-with-faces ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 "Generate and spool a PostScript image of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 Like `ps-spool-buffer', but includes font, color, and underline
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1119 information in the generated image. This command works only if you
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1120 are using a window system, so it has a way to determine color values.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (ps-generate (current-buffer) (point-min) (point-max)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 'ps-generate-postscript-with-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (defun ps-spool-region (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 "Generate a PostScript image of the region and spool locally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 Like `ps-spool-buffer', but spools just the current region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 'ps-generate-postscript))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (defun ps-spool-region-with-faces (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 "Generate a PostScript image of the region and spool locally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 Like `ps-spool-region', but includes font, color, and underline
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1144 information in the generated image. This command works only if you
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1145 are using a window system, so it has a way to determine color values.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 Use the command `ps-despool' to send the spooled images to the printer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (ps-generate (current-buffer) from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 'ps-generate-postscript-with-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (defun ps-despool (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 "Send the spooled PostScript to the printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 When called with a numeric prefix argument (C-u), prompt the user for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 the name of a file to save the spooled PostScript in, instead of sending
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 it to the printer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 More specifically, the FILENAME argument is treated as follows: if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 is nil, send the image to the printer. If FILENAME is a string, save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 the PostScript image in a file with that name. If FILENAME is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 number, prompt the user for the name of the file to save in."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (interactive (list (ps-print-preprint current-prefix-arg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (ps-do-despool filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1167 ;;;###autoload
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1168 (defun ps-line-lengths ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1169 "*Display the correspondence between a line length and a font size,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1170 using the current ps-print setup.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1171 Try: pr -t file | awk '{printf \"%3d %s\n\", length($0), $0}' | sort -r | head"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1172 (interactive)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1173 (ps-line-lengths-internal))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1174
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1175 ;;;###autoload
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1176 (defun ps-nb-pages-buffer (nb-lines)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1177 "*Display an approximate correspondence between a font size and the number
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1178 of pages the current buffer would require to print
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1179 using the current ps-print setup."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1180 (interactive (list (count-lines (point-min) (point-max))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1181 (ps-nb-pages nb-lines))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1182
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1183 ;;;###autoload
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1184 (defun ps-nb-pages-region (nb-lines)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1185 "*Display an approximate correspondence between a font size and the number
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1186 of pages the current region would require to print
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1187 using the current ps-print setup."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1188 (interactive (list (count-lines (mark) (point))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1189 (ps-nb-pages nb-lines))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1190
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1191 ;;;###autoload
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1192 (defun ps-setup ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1193 "*Return the current setup"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1194 (format "
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1195 (setq ps-print-color-p %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1196 ps-lpr-command \"%s\"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1197 ps-lpr-switches %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1198
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1199 ps-paper-type '%s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1200 ps-landscape-mode %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1201 ps-number-of-columns %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1202
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1203 ps-left-margin %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1204 ps-right-margin %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1205 ps-inter-column %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1206 ps-bottom-margin %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1207 ps-top-margin %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1208 ps-header-offset %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1209 ps-header-line-pad %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1210 ps-print-header %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1211 ps-print-header-frame %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1212 ps-header-lines %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1213 ps-show-n-of-n %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1214 ps-spool-duplex %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1215
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1216 ps-font-family '%s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1217 ps-font-size %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1218 ps-header-font-family '%s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1219 ps-header-font-size %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1220 ps-header-title-font-size %s)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1221 "
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1222 ps-print-color-p
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1223 ps-lpr-command
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1224 ps-lpr-switches
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1225 ps-paper-type
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1226 ps-landscape-mode
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1227 ps-number-of-columns
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1228 ps-left-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1229 ps-right-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1230 ps-inter-column
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1231 ps-bottom-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1232 ps-top-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1233 ps-header-offset
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1234 ps-header-line-pad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1235 ps-print-header
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1236 ps-print-header-frame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1237 ps-header-lines
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1238 ps-show-n-of-n
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1239 ps-spool-duplex
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1240 ps-font-family
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1241 ps-font-size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1242 ps-header-font-family
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1243 ps-header-font-size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1244 ps-header-title-font-size))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1245
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 ;; Utility functions and variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (defvar ps-print-emacs-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (cond ((string-match "XEmacs" emacs-version) 'xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 ((string-match "Lucid" emacs-version) 'lucid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 ((string-match "Epoch" emacs-version) 'epoch)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (t 'emacs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (if (or (eq ps-print-emacs-type 'lucid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (eq ps-print-emacs-type 'xemacs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 (if (< emacs-minor-version 12)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 (setq ps-print-color-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 (require 'faces)) ; face-font, face-underline-p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 ; x-font-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1262 ;; Return t if the device (which can be changed during an emacs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1263 ;; session) can handle colors.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1264 ;; This is function is not yet implemented for GNU emacs.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1265 (defun ps-color-device ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (if (and (eq ps-print-emacs-type 'xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (>= emacs-minor-version 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (eq (device-class) 'color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (require 'time-stamp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1273 (defvar ps-font nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1274 "Font family name for ordinary text, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1275
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1276 (defvar ps-font-bold nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1277 "Font family name for bold text, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1278
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1279 (defvar ps-font-italic nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1280 "Font family name for italic text, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1281
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1282 (defvar ps-font-bold-italic nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1283 "Font family name for bold italic text, when generating Postscript.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1284
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1285 (defvar ps-avg-char-width nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1286 "The average width, in points, of a character, for generating Postscript.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1287 This is the value that ps-print uses to determine the length,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1288 x-dimension, of the text it has printed, and thus affects the point at
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1289 which long lines wrap around.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1290
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1291 (defvar ps-space-width nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1292 "The width of a space character, for generating Postscript.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1293 This value is used in expanding tab characters.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1294
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1295 (defvar ps-line-height nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1296 "The height of a line, for generating Postscript.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1297 This is the value that ps-print uses to determine the height,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1298 y-dimension, of the lines of text it has printed, and thus affects the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1299 point at which page-breaks are placed.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1300 The line-height is *not* the same as the point size of the font.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1301
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1302 (defvar ps-print-prologue-1
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1303 "% ISOLatin1Encoding stolen from ps_init.ps in GhostScript 2.6.1.4:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 /ISOLatin1Encoding where { pop } {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1305 % -- The ISO Latin-1 encoding vector isn't known, so define it.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1306 % -- The first half is the same as the standard encoding,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1307 % -- except for minus instead of hyphen at code 055.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 /ISOLatin1Encoding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 StandardEncoding 0 45 getinterval aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 /minus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 StandardEncoding 46 82 getinterval aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 %*** NOTE: the following are missing in the Adobe documentation,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 %*** but appear in the displayed table:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 %*** macron at 0225, dieresis at 0230, cedilla at 0233, space at 0240.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1315 % 0200 (128)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1320 % 0240 (160)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 /space /exclamdown /cent /sterling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 /currency /yen /brokenbar /section
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 /dieresis /copyright /ordfeminine /guillemotleft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 /logicalnot /hyphen /registered /macron
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 /degree /plusminus /twosuperior /threesuperior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 /acute /mu /paragraph /periodcentered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 /cedilla /onesuperior /ordmasculine /guillemotright
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 /onequarter /onehalf /threequarters /questiondown
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1329 % 0300 (192)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 /Agrave /Aacute /Acircumflex /Atilde
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 /Adieresis /Aring /AE /Ccedilla
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 /Egrave /Eacute /Ecircumflex /Edieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 /Igrave /Iacute /Icircumflex /Idieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 /Eth /Ntilde /Ograve /Oacute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 /Ocircumflex /Otilde /Odieresis /multiply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 /Oslash /Ugrave /Uacute /Ucircumflex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 /Udieresis /Yacute /Thorn /germandbls
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1338 % 0340 (224)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 /agrave /aacute /acircumflex /atilde
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 /adieresis /aring /ae /ccedilla
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 /egrave /eacute /ecircumflex /edieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 /igrave /iacute /icircumflex /idieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 /eth /ntilde /ograve /oacute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 /ocircumflex /otilde /odieresis /divide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 /oslash /ugrave /uacute /ucircumflex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 /udieresis /yacute /thorn /ydieresis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 256 packedarray def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 } ifelse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 /reencodeFontISO { %def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 dup
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1352 length 5 add dict % Make a new font (a new dict the same size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1353 % as the old one) with room for our new symbols.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1354
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1355 begin % Make the new font the current dictionary.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 { 1 index /FID ne
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 { def } { pop pop } ifelse
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1360 } forall % Copy each of the symbols from the old dictionary
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1361 % to the new one except for the font ID.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 /Encoding ISOLatin1Encoding def % Override the encoding with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 % the ISOLatin1 encoding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 % Use the font's bounding box to determine the ascent, descent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 % and overall height; don't forget that these values have to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 % transformed using the font's matrix.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1369
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1370 % ^ (x2 y2)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1371 % | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1372 % | v
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1373 % | +----+ - -
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1374 % | | | ^
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1375 % | | | | Ascent (usually > 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1376 % | | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1377 % (0 0) -> +--+----+-------->
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1378 % | | |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1379 % | | v Descent (usually < 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1380 % (x1 y1) --> +----+ - -
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1381
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1382 FontBBox % -- x1 y1 x2 y2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1383 FontMatrix transform /Ascent exch def pop
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 FontMatrix transform /Descent exch def pop
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1385 /FontHeight Ascent Descent sub def % use `sub' because descent < 0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1386
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1387 % Define these in case they're not in the FontInfo
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1388 % (also, here they're easier to get to.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1389 /UnderlinePosition 1 def
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 /UnderlineThickness 1 def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 % Get the underline position and thickness if they're defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 currentdict /FontInfo known {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 FontInfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 dup /UnderlinePosition known {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 dup /UnderlinePosition get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 0 exch FontMatrix transform exch pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 /UnderlinePosition exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 dup /UnderlineThickness known {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 /UnderlineThickness get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 0 exch FontMatrix transform exch pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 /UnderlineThickness exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1410 currentdict % Leave the new font on the stack
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1411 end % Stop using the font as the current dictionary.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1412 definefont % Put the font into the font dictionary
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1413 pop % Discard the returned font.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 } bind def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1416 /DefFont { % Font definition
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 findfont exch scalefont reencodeFontISO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1420 /F { % Font selection
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 findfont
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1422 dup /Ascent get /Ascent exch def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1423 dup /Descent get /Descent exch def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1424 dup /FontHeight get /FontHeight exch def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1425 dup /UnderlinePosition get /UnderlinePosition exch def
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 dup /UnderlineThickness get /UnderlineThickness exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 setfont
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 /FG /setrgbcolor load def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 /bg false def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 /BG {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 dup /bg exch def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 { mark 4 1 roll ] /bgcolor exch def } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1438 % B width C
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1439 % +-----------+
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1440 % | Ascent (usually > 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1441 % A + +
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1442 % | Descent (usually < 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1443 % +-----------+
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1444 % E width D
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1445
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 /dobackground { % width --
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1447 currentpoint % -- width x y
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 newpath
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1450 moveto % A (x y)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1451 0 Ascent rmoveto % B
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1452 dup 0 rlineto % C
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1453 0 Descent Ascent sub rlineto % D
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1454 neg 0 rlineto % E
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 closepath
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 bgcolor aload pop setrgbcolor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 fill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 /dobackgroundstring { % string --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 stringwidth pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 dobackground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 /dounderline { % fromx fromy --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 currentpoint
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 UnderlineThickness setlinewidth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 4 2 roll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 UnderlinePosition add moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 UnderlinePosition add lineto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 stroke
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1477 /eolbg { % dobackground until right margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1478 PrintWidth % -- x-eol
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1479 currentpoint pop % -- cur-x
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1480 sub % -- width until eol
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1481 dobackground
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1484 /eolul { % idem for underline
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1485 PrintWidth % -- x-eol
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1486 currentpoint exch pop % -- x-eol cur-y
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1487 dounderline
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 /SL { % Soft Linefeed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 bg { eolbg } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 ul { eolul } if
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1493 0 currentpoint exch pop LineHeight sub moveto
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 /HL /SL load def % Hard Linefeed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 /sp1 { currentpoint 3 -1 roll } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 % Some debug
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 /dcp { currentpoint exch 40 string cvs print (, ) print = } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 /dp { print 2 copy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 exch 40 string cvs print (, ) print = } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 /S {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 bg { dup dobackgroundstring } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 ul { sp1 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 ul { dounderline } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 /W {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ul { sp1 } if
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1514 ( ) stringwidth % Get the width of a space in the current font.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1515 pop % Discard the Y component.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1516 mul % Multiply the width of a space
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1517 % by the number of spaces to plot
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 bg { dup dobackground } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 0 rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 ul { dounderline } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1523 /BeginDoc {
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1524 % ---- save the state of the document (useful for ghostscript!)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1525 /docState save def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1526 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1527 /JackGhostscript where {
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1528 pop 1 27.7 29.7 div scale
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1529 } if
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1530 LandscapeMode {
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1531 % ---- translate to bottom-right corner of Portrait page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1532 LandscapePageHeight 0 translate
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1533 90 rotate
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1534 } if
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1535 /ColumnWidth PrintWidth InterColumn add def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1536 % ---- translate to lower left corner of TEXT
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1537 LeftMargin BottomMargin translate
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1538 % ---- define where printing will start
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1539 /f0 F % this installs Ascent
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1540 /PrintStartY PrintHeight Ascent sub def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1541 /ColumnIndex 1 def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1542 } def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1543
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1544 /EndDoc {
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1545 % ---- on last page but not last column, spit out the page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1546 ColumnIndex 1 eq not { showpage } if
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1547 % ---- restore the state of the document (useful for ghostscript!)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1548 docState restore
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1549 } def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1550
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 /BeginDSCPage {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1552 % ---- when 1st column, save the state of the page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1553 ColumnIndex 1 eq { /pageState save def } if
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1554 % ---- save the state of the column
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1555 /columnState save def
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 /BeginPage {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 PrintHeader {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 PrintHeaderFrame { HeaderFrame } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 HeaderText
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 } if
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1563 0 PrintStartY moveto % move to where printing will start
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 /EndPage {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 bg { eolbg } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 ul { eolul } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 /EndDSCPage {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1572 ColumnIndex NumberOfColumns eq {
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1573 % ---- on last column, spit out the page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1574 showpage
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1575 % ---- restore the state of the page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1576 pageState restore
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1577 /ColumnIndex 1 def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1578 } { % else
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1579 % ---- restore the state of the current column
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1580 columnState restore
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1581 % ---- and translate to the next column
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1582 ColumnWidth 0 translate
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1583 /ColumnIndex ColumnIndex 1 add def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1584 } ifelse
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 /ul false def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 /UL { /ul exch def } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1591 /SetHeaderLines { % nb-lines --
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 /HeaderLines exch def
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1593 % ---- bottom up
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1594 HeaderPad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1595 HeaderLines 1 sub HeaderLineHeight mul add
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1596 HeaderTitleLineHeight add
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1597 HeaderPad add
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1598 /HeaderHeight exch def
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1601 % |---------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1602 % | tm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1603 % |---------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1604 % | header |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1605 % |-+-------| <-- (x y)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1606 % | ho |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1607 % |---------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1608 % | text |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1609 % |-+-------| <-- (0 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1610 % | bm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1611 % |---------|
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1612
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1613 /HeaderFrameStart { % -- x y
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1614 0 PrintHeight HeaderOffset add
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 /HeaderFramePath {
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1618 PrintWidth 0 rlineto
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1619 0 HeaderHeight rlineto
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1620 PrintWidth neg 0 rlineto
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1621 0 HeaderHeight neg rlineto
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 /HeaderFrame {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 0.4 setlinewidth
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1627 % ---- fill a black rectangle (the shadow of the next one)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 HeaderFrameStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 1 -1 rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 HeaderFramePath
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 0 setgray fill
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1632 % ---- do the next rectangle ...
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 HeaderFrameStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 HeaderFramePath
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1635 gsave 0.9 setgray fill grestore % filled with grey
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1636 gsave 0 setgray stroke grestore % drawn with black
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 /HeaderStart {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 HeaderFrameStart
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1642 exch HeaderPad add exch % horizontal pad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1643 % ---- bottom up
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1644 HeaderPad add % vertical pad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1645 HeaderDescent sub
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1646 HeaderLineHeight HeaderLines 1 sub mul add
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 /strcat {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 dup length 3 -1 roll dup length dup 4 -1 roll add string dup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 0 5 -1 roll putinterval
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 dup 4 2 roll exch putinterval
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 /pagenumberstring {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 PageNumber 32 string cvs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 ShowNofN {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 (/) strcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 PageCount 32 string cvs strcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 /HeaderText {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 HeaderStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1666 HeaderLinesRight HeaderLinesLeft % -- rightLines leftLines
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1667
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1668 % ---- hack: `PN 1 and' == `PN 2 modulo'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1669
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1670 % ---- if duplex and even page number, then exchange left and right
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 Duplex PageNumber 1 and 0 eq and { exch } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1673 { % ---- process the left lines
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 exch F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 dup xcheck { exec } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 0 HeaderLineHeight neg rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 } forall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 HeaderStart moveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1685 { % ---- process the right lines
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 aload pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 exch F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 dup xcheck { exec } if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 dup stringwidth pop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 PrintWidth exch sub HeaderPad 2 mul sub 0 rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 0 HeaderLineHeight neg rmoveto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 } forall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 /ReportFontInfo {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 2 copy
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1700 /t0 3 1 roll DefFont
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 /t0 F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 /lh FontHeight def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 /sw ( ) stringwidth pop def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 /aw (01234567890abcdefghijklmnopqrstuvwxyz) dup length exch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 stringwidth pop exch div def
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1706 /t1 12 /Helvetica-Oblique DefFont
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 /t1 F
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 gsave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 (For ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 128 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 ( ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 32 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 ( point, the line height is ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 lh 32 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 (, the space width is ) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 sw 32 string cvs show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 (,) show
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 grestore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 0 FontHeight neg rmoveto
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1720 gsave
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1721 (and a crude estimate of average character width is ) show
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1722 aw 32 string cvs show
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1723 (.) show
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1724 grestore
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1725 0 FontHeight neg rmoveto
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1726 } def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1727
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1728 /cm { % cm to point
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1729 72 mul 2.54 div
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1730 } def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1731
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1732 /ReportAllFontInfo {
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1733 FontDirectory
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1734 { % key = font name value = font dictionary
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1735 pop 10 exch ReportFontInfo
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1736 } forall
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 } def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1739 % 3 cm 20 cm moveto 10 /Courier ReportFontInfo showpage
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1740 % 3 cm 20 cm moveto ReportAllFontInfo showpage
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1741
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1742 ")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1743
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1744 (defvar ps-print-prologue-2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1745 "
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1746 % ---- These lines must be kept together because...
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1747
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1748 /h0 F
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1749 /HeaderTitleLineHeight FontHeight def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1750
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1751 /h1 F
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1752 /HeaderLineHeight FontHeight def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1753 /HeaderDescent Descent def
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1754
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1755 % ---- ...because `F' has a side-effect on `FontHeight' and `Descent'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1756
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 ;; Start Editing Here:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 (defvar ps-source-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 (defvar ps-spool-buffer-name "*PostScript*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 (defvar ps-spool-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 (defvar ps-output-head nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 (defvar ps-output-tail nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 (defvar ps-page-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 (defvar ps-showpage-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 (defvar ps-current-font 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 (defvar ps-current-underline-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 (defvar ps-default-color (if ps-print-color-p ps-default-fg)) ; black
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 (defvar ps-current-color ps-default-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 (defvar ps-current-bg nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (defvar ps-razchunk 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1779 (defvar ps-color-format
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1780 (if (eq ps-print-emacs-type 'emacs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1781
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1782 ;;Emacs understands the %f format; we'll
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1783 ;;use it to limit color RGB values to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1784 ;;three decimals to cut down some on the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1785 ;;size of the PostScript output.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1786 "%0.3f %0.3f %0.3f"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1787
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1788 ;; Lucid emacsen will have to make do with
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1789 ;; %s (princ) for floats.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1790 "%s %s %s"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 ;; These values determine how much print-height to deduct when headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 ;; are turned on. This is a pretty clumsy way of handling it, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 ;; it'll do for now.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1795
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1796 (defvar ps-header-font)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1797 (defvar ps-header-title-font)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1798
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1799 (defvar ps-header-line-height)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1800 (defvar ps-header-title-line-height)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1801 (defvar ps-header-pad 0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1802 "Vertical and horizontal space in points (1/72 inch) between the header frame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1803 and the text it contains.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1804
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1805 ;; Define accessors to the dimensions list.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1806
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1807 (defmacro ps-page-dimensions-get-width (dims) `(nth 0 ,dims))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1808 (defmacro ps-page-dimensions-get-height (dims) `(nth 1 ,dims))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1809
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1810 (defvar ps-landscape-page-height)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1811
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 (defvar ps-print-width nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 (defvar ps-print-height nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 (defvar ps-height-remaining)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 (defvar ps-width-remaining)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (defvar ps-ref-bold-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (defvar ps-ref-italic-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (defvar ps-ref-underlined-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1822 (defvar ps-print-color-scale nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1823
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 ;; Internal functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1827 (defun ps-line-lengths-internal ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1828 "Display the correspondence between a line length and a font size,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1829 using the current ps-print setup.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1830 Try: pr -t file | awk '{printf \"%3d %s\n\", length($0), $0}' | sort -r | head"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1831 (let ((buf (get-buffer-create "*Line-lengths*"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1832 (ifs ps-font-size) ; initial font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1833 (icw ps-avg-char-width) ; initial character width
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1834 (print-width (progn (ps-get-page-dimensions)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1835 ps-print-width))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1836 (ps-setup (ps-setup)) ; setup for the current buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1837 (fs-min 5) ; minimum font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1838 cw-min ; minimum character width
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1839 nb-cpl-max ; maximum nb of characters per line
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1840 (fs-max 14) ; maximum font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1841 cw-max ; maximum character width
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1842 nb-cpl-min ; minimum nb of characters per line
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1843 fs ; current font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1844 cw ; current character width
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1845 nb-cpl ; current nb of characters per line
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1846 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1847 (setq cw-min (/ (* icw fs-min) ifs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1848 nb-cpl-max (floor (/ print-width cw-min))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1849 cw-max (/ (* icw fs-max) ifs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1850 nb-cpl-min (floor (/ print-width cw-max)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1851 (setq nb-cpl nb-cpl-min)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1852 (set-buffer buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1853 (goto-char (point-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1854 (if (not (bolp)) (insert "\n"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1855 (insert ps-setup)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1856 (insert "nb char per line / font size\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1857 (while (<= nb-cpl nb-cpl-max)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1858 (setq cw (/ print-width (float nb-cpl))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1859 fs (/ (* ifs cw) icw))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1860 (insert (format "%3s %s\n" nb-cpl fs))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1861 (setq nb-cpl (1+ nb-cpl)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1862 (insert "\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1863 (display-buffer buf 'not-this-window)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1864
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1865 (defun ps-nb-pages (nb-lines)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1866 "Display an approximate correspondence between a font size and the number
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1867 of pages the number of lines would require to print
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1868 using the current ps-print setup."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1869 (let ((buf (get-buffer-create "*Nb-Pages*"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1870 (ifs ps-font-size) ; initial font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1871 (ilh ps-line-height) ; initial line height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1872 (page-height (progn (ps-get-page-dimensions)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1873 ps-print-height))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1874 (ps-setup (ps-setup)) ; setup for the current buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1875 (fs-min 4) ; minimum font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1876 lh-min ; minimum line height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1877 nb-lpp-max ; maximum nb of lines per page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1878 nb-page-min ; minimum nb of pages
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1879 (fs-max 14) ; maximum font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1880 lh-max ; maximum line height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1881 nb-lpp-min ; minimum nb of lines per page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1882 nb-page-max ; maximum nb of pages
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1883 fs ; current font size
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1884 lh ; current line height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1885 nb-lpp ; current nb of lines per page
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1886 nb-page ; current nb of pages
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1887 )
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1888 (setq lh-min (/ (* ilh fs-min) ifs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1889 nb-lpp-max (floor (/ page-height lh-min))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1890 nb-page-min (ceiling (/ (float nb-lines) nb-lpp-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1891 lh-max (/ (* ilh fs-max) ifs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1892 nb-lpp-min (floor (/ page-height lh-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1893 nb-page-max (ceiling (/ (float nb-lines) nb-lpp-min)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1894 (setq nb-page nb-page-min)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1895 (set-buffer buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1896 (goto-char (point-max))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1897 (if (not (bolp)) (insert "\n"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1898 (insert ps-setup)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1899 (insert (format "%d lines\n" nb-lines))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1900 (insert "nb page / font size\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1901 (while (<= nb-page nb-page-max)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1902 (setq nb-lpp (ceiling (/ nb-lines (float nb-page)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1903 lh (/ page-height nb-lpp)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1904 fs (/ (* ifs lh) ilh))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1905 (insert (format "%s %s\n" nb-page fs))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1906 (setq nb-page (1+ nb-page)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1907 (insert "\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1908 (display-buffer buf 'not-this-window)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1909
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1910 (defun ps-select-font ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1911 "Choose the font name and size (scaling data)."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1912 (let ((assoc (assq ps-font-family ps-font-info-database))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1913 l fn fb fi bi sz lh sw aw)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1914 (if (null assoc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1915 (error "Don't have data to scale font %s. Known fonts families are %s"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1916 ps-font-family
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1917 (mapcar 'car ps-font-info-database)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1918 (setq l (cdr assoc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1919 fn (prog1 (car l) (setq l (cdr l))) ; need `pop'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1920 fb (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1921 fi (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1922 bi (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1923 sz (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1924 lh (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1925 sw (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1926 aw (prog1 (car l) (setq l (cdr l))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1927
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1928 (setq ps-font fn)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1929 (setq ps-font-bold fb)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1930 (setq ps-font-italic fi)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1931 (setq ps-font-bold-italic bi)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1932 ;; These data just need to be rescaled:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1933 (setq ps-line-height (/ (* lh ps-font-size) sz))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1934 (setq ps-space-width (/ (* sw ps-font-size) sz))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1935 (setq ps-avg-char-width (/ (* aw ps-font-size) sz))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1936 ps-font-family))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1937
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1938 (defun ps-select-header-font ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1939 "Choose the font name and size (scaling data) for the header."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1940 (let ((assoc (assq ps-header-font-family ps-font-info-database))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1941 l fn fb fi bi sz lh sw aw)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1942 (if (null assoc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1943 (error "Don't have data to scale font %s. Known fonts families are %s"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1944 ps-font-family
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1945 (mapcar 'car ps-font-info-database)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1946 (setq l (cdr assoc)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1947 fn (prog1 (car l) (setq l (cdr l))) ; need `pop'
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1948 fb (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1949 fi (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1950 bi (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1951 sz (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1952 lh (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1953 sw (prog1 (car l) (setq l (cdr l)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1954 aw (prog1 (car l) (setq l (cdr l))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1955
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1956 ;; Font name
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1957 (setq ps-header-font fn)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1958 (setq ps-header-title-font fb)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1959 ;; Line height: These data just need to be rescaled:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1960 (setq ps-header-title-line-height (/ (* lh ps-header-title-font-size) sz))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1961 (setq ps-header-line-height (/ (* lh ps-header-font-size) sz))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1962 ps-header-font-family))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1963
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 (defun ps-get-page-dimensions ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1965 (let ((page-dimensions (cdr (assq ps-paper-type ps-page-dimensions-database)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1966 page-width page-height)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1967 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1968 ((null page-dimensions)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1969 (error "`ps-paper-type' must be one of:\n%s"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1970 (mapcar 'car ps-page-dimensions-database)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1971 ((< ps-number-of-columns 1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1972 (error "The number of columns %d should not be negative")))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1973
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1974 (ps-select-font)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1975 (ps-select-header-font)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1976
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1977 (setq page-width (ps-page-dimensions-get-width page-dimensions)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1978 page-height (ps-page-dimensions-get-height page-dimensions))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1979
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1980 ;; Landscape mode
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1981 (if ps-landscape-mode
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1982 ;; exchange width and height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1983 (setq page-width (prog1 page-height (setq page-height page-width))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1984
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1985 ;; It is used to get the lower right corner (only in landscape mode)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1986 (setq ps-landscape-page-height page-height)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1987
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1988 ;; | lm | text | ic | text | ic | text | rm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1989 ;; page-width == lm + n * pw + (n - 1) * ic + rm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1990 ;; => pw == (page-width - lm -rm - (n - 1) * ic) / n
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1991 (setq ps-print-width
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1992 (/ (- page-width
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1993 ps-left-margin ps-right-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1994 (* (1- ps-number-of-columns) ps-inter-column))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1995 ps-number-of-columns))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1996 (if (<= ps-print-width 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1997 (error "Bad horizontal layout:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1998 page-width == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
1999 ps-left-margin == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2000 ps-right-margin == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2001 ps-inter-column == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2002 ps-number-of-columns == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2003 | lm | text | ic | text | ic | text | rm |
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2004 page-width == lm + n * print-width + (n - 1) * ic + rm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2005 => print-width == %d !"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2006 page-width
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2007 ps-left-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2008 ps-right-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2009 ps-inter-column
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2010 ps-number-of-columns
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2011 ps-print-width))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2012
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2013 (setq ps-print-height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2014 (- page-height ps-bottom-margin ps-top-margin))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2015 (if (<= ps-print-height 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2016 (error "Bad vertical layout:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2017 ps-top-margin == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2018 ps-bottom-margin == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2019 page-height == bm + print-height + tm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2020 => print-height == %d !"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2021 ps-top-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2022 ps-bottom-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2023 ps-print-height))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2024 ;; If headers are turned on, deduct the height of the header from
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2025 ;; the print height.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2026 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2027 (ps-print-header
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2028 (setq ps-header-pad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2029 (* ps-header-line-pad ps-header-title-line-height))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2030 (setq ps-print-height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2031 (- ps-print-height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2032 ps-header-offset
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2033 ps-header-pad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2034 ps-header-title-line-height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2035 (* ps-header-line-height (- ps-header-lines 1))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2036 ps-header-pad))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2037 (if (<= ps-print-height 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2038 (error "Bad vertical layout:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2039 ps-top-margin == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2040 ps-bottom-margin == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2041 ps-header-offset == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2042 ps-header-pad == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2043 header-height == %s
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2044 page-height == bm + print-height + tm - ho - hh
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2045 => print-height == %d !"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2046 ps-top-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2047 ps-bottom-margin
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2048 ps-header-offset
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2049 ps-header-pad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2050 (+ ps-header-pad
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2051 ps-header-title-line-height
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2052 (* ps-header-line-height (- ps-header-lines 1))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2053 ps-header-pad)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2054 ps-print-height))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 (defun ps-print-preprint (&optional filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 (if (and filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 (or (numberp filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 (listp filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 (let* ((name (concat (buffer-name) ".ps"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 (prompt (format "Save PostScript to file: (default %s) "
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2062 name))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2063 (res (read-file-name prompt default-directory name nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2064 (if (file-directory-p res)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2065 (expand-file-name name (file-name-as-directory res))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2066 res))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 ;; The following functions implement a simple list-buffering scheme so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 ;; that ps-print doesn't have to repeatedly switch between buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 ;; while spooling. The functions ps-output and ps-output-string build
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 ;; up the lists; the function ps-flush-output takes the lists and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 ;; insert its contents into the spool buffer (*PostScript*).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 (defun ps-output-string-prim (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 (insert "(") ;insert start-string delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 (save-excursion ;insert string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 (insert string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 ;; Find and quote special characters as necessary for PS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 (while (re-search-forward "[()\\]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 (insert "\\")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 (insert ")")) ;insert end-string delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 (defun ps-init-output-queue ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 (setq ps-output-head (list ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 (setq ps-output-tail ps-output-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 (defun ps-output (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 (setcdr ps-output-tail args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 (while (cdr ps-output-tail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 (setq ps-output-tail (cdr ps-output-tail))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 (defun ps-output-string (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 (ps-output t string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 (defun ps-flush-output ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 (while ps-output-head
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 (let ((it (car ps-output-head)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 (if (not (eq t it))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 (insert it)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 (setq ps-output-head (cdr ps-output-head))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 (ps-output-string-prim (car ps-output-head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 (setq ps-output-head (cdr ps-output-head))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 (ps-init-output-queue))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 (defun ps-insert-file (fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 ;; Check to see that the file exists and is readable; if not, throw
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2117 ;; an error.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 (if (not (file-readable-p fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 (error "Could not read file `%s'" fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 (insert-file fname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 ;; These functions insert the arrays that define the contents of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 ;; headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 (defun ps-generate-header-line (fonttag &optional content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 (ps-output " [ " fonttag " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132 ;; Literal strings should be output as is -- the string must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 ;; contain its own PS string delimiters, '(' and ')', if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 ((stringp content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 (ps-output content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 ;; Functions are called -- they should return strings; they will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 ;; inserted as strings and the PS string delimiters added.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 ((and (symbolp content) (fboundp content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 (ps-output-string (funcall content)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 ;; Variables will have their contents inserted. They should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 ;; contain strings, and will be inserted as strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 ((and (symbolp content) (boundp content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145 (ps-output-string (symbol-value content)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 ;; Anything else will get turned into an empty string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 (ps-output-string "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 (ps-output " ]\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 (defun ps-generate-header (name contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 (ps-output "/" name " [\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 (if (> ps-header-lines 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 (let ((count 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 (ps-generate-header-line "/h0" (car contents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 (while (and (< count ps-header-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 (setq contents (cdr contents)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 (ps-generate-header-line "/h1" (car contents))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160 (setq count (+ count 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 (ps-output "] def\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 (defun ps-output-boolean (name bool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 (ps-output (format "/%s %s def\n" name (if bool "true" "false"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 (defun ps-begin-file ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2167 (ps-get-page-dimensions)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 (setq ps-showpage-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 (ps-output ps-adobe-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 (ps-output "%%Title: " (buffer-name) "\n") ;Take job name from name of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 ;first buffer printed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 (ps-output "%%Creator: " (user-full-name) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 (ps-output "%%CreationDate: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 (time-stamp-hh:mm:ss) " " (time-stamp-mon-dd-yyyy) "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 (ps-output "%%Pages: (atend)\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177 (ps-output "%%EndComments\n\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2179 (ps-output "%%BeginProlog\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2180 (ps-output-boolean "LandscapeMode" ps-landscape-mode)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2181 (ps-output (format "/NumberOfColumns %d def\n" ps-number-of-columns))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2182
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2183 (ps-output (format "/LandscapePageHeight %s def\n" ps-landscape-page-height))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2184 (ps-output (format "/PrintWidth %s def\n" ps-print-width))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2185 (ps-output (format "/PrintHeight %s def\n" ps-print-height))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2186
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2187 (ps-output (format "/LeftMargin %s def\n" ps-left-margin))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2188 (ps-output (format "/RightMargin %s def\n" ps-right-margin)) ; not used
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2189 (ps-output (format "/InterColumn %s def\n" ps-inter-column))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2190
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2191 (ps-output (format "/BottomMargin %s def\n" ps-bottom-margin))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2192 (ps-output (format "/TopMargin %s def\n" ps-top-margin)) ; not used
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2193 (ps-output (format "/HeaderOffset %s def\n" ps-header-offset))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2194 (ps-output (format "/HeaderPad %s def\n" ps-header-pad))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2195
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2196 (ps-output-boolean "PrintHeader" ps-print-header)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 (ps-output-boolean "PrintHeaderFrame" ps-print-header-frame)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2198 (ps-output-boolean "ShowNofN" ps-show-n-of-n)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2199 (ps-output-boolean "Duplex" ps-spool-duplex)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2200
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2201 (ps-output (format "/LineHeight %s def\n" ps-line-height))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2202
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2203 (ps-output ps-print-prologue-1)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2204 (ps-output "%%EndProlog\n\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2205
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2206
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2207 (ps-output "%%BeginSetup\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2208
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2209 ;; Header fonts
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2210 (ps-output ; /h0 14 /Helvetica-Bold Font
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2211 (format "/h0 %s /%s DefFont\n" ps-header-title-font-size ps-header-title-font))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2212 (ps-output ; /h1 12 /Helvetica Font
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2213 (format "/h1 %s /%s DefFont\n" ps-header-font-size ps-header-font))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2214
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2215 (ps-output ps-print-prologue-2)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2216
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2217 ;; Text fonts
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2218 (ps-output (format "/f0 %s /%s DefFont\n" ps-font-size ps-font))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2219 (ps-output (format "/f1 %s /%s DefFont\n" ps-font-size ps-font-bold))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2220 (ps-output (format "/f2 %s /%s DefFont\n" ps-font-size ps-font-italic))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2221 (ps-output (format "/f3 %s /%s DefFont\n" ps-font-size ps-font-bold-italic))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2222
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2223 (ps-output "\nBeginDoc\n\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2224 (ps-output "%%EndSetup\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2225 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 (defun ps-header-dirpart ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 (let ((fname (buffer-file-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 (if fname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 (if (string-equal (buffer-name) (file-name-nondirectory fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231 (file-name-directory fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233 "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 (defun ps-get-buffer-name ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2236 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2237 ;; Indulge Jim this little easter egg:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2238 ((string= (buffer-name) "ps-print.el")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2239 "Hey, Cool! It's ps-print.el!!!")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2240 ;; Indulge Jack this other little easter egg:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2241 ((string= (buffer-name) "sokoban.el")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2242 "Super! C'est sokoban.el!")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2243 (t (buffer-name))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 (defun ps-begin-job ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 (setq ps-page-count 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 (defun ps-end-file ()
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2249 (ps-output "\n\n%%Trailer\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2250 (ps-output (format "%%%%Pages: %d\n" (1+ (/ (1- ps-page-count)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2251 ps-number-of-columns))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2252 (ps-output "EndDoc\n")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2253 (ps-output "%%EOF\n"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255 (defun ps-next-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 (ps-end-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258 (ps-begin-page))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 (defun ps-begin-page (&optional dummypage)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 (ps-get-page-dimensions)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2262 (setq ps-width-remaining ps-print-width)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 (setq ps-height-remaining ps-print-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2265 ;; Print only when a new real page begins.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2266 (when (zerop (mod ps-page-count ps-number-of-columns))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2267 (ps-output (format "\n%%%%Page: %d %d\n"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2268 (1+ (/ ps-page-count ps-number-of-columns))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2269 (1+ (/ ps-page-count ps-number-of-columns)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2270
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 (ps-output "BeginDSCPage\n")
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2272 (ps-output (format "/PageNumber %d def\n" (incf ps-page-count)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 (ps-output "/PageCount 0 def\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2275 (when ps-print-header
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2276 (ps-generate-header "HeaderLinesLeft" ps-left-header)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2277 (ps-generate-header "HeaderLinesRight" ps-right-header)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2278 (ps-output (format "%d SetHeaderLines\n" ps-header-lines)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280 (ps-output "BeginPage\n")
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2281 (ps-set-font ps-current-font)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2282 (ps-set-bg ps-current-bg)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2283 (ps-set-color ps-current-color)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284 (ps-set-underline ps-current-underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 (defun ps-end-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 (setq ps-showpage-count (+ 1 ps-showpage-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 (ps-output "EndPage\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 (ps-output "EndDSCPage\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 (defun ps-dummy-page ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 (setq ps-showpage-count (+ 1 ps-showpage-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 (ps-output "%%Page: " (format "- %d\n" ps-showpage-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 "BeginDSCPage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 /PrintHeader false def
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 BeginPage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 EndPage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 EndDSCPage\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 (defun ps-next-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 (if (< ps-height-remaining ps-line-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 (ps-next-page)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2303 (setq ps-width-remaining ps-print-width)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 (setq ps-height-remaining (- ps-height-remaining ps-line-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 (ps-hard-lf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 (defun ps-continue-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 (if (< ps-height-remaining ps-line-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 (ps-next-page)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2310 (setq ps-width-remaining ps-print-width)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311 (setq ps-height-remaining (- ps-height-remaining ps-line-height))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312 (ps-soft-lf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2314 ;; [jack] Why hard and soft ?
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2315
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316 (defun ps-hard-lf ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317 (ps-output "HL\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319 (defun ps-soft-lf ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320 (ps-output "SL\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322 (defun ps-find-wrappoint (from to char-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323 (let ((avail (truncate (/ ps-width-remaining char-width)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324 (todo (- to from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325 (if (< todo avail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326 (cons to (* todo char-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327 (cons (+ from avail) ps-width-remaining))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329 (defun ps-basic-plot-string (from to &optional bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330 (let* ((wrappoint (ps-find-wrappoint from to ps-avg-char-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331 (to (car wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 (string (buffer-substring from to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333 (ps-output-string string)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2334 (ps-output " S\n")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2335 wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2337 (defun ps-basic-plot-whitespace (from to &optional bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2338 (let* ((wrappoint (ps-find-wrappoint from to ps-space-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2339 (to (car wrappoint)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2341 (ps-output (format "%d W\n" (- to from)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2342 wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2344 (defun ps-plot (plotfunc from to &optional bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2345 (while (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2346 (let* ((wrappoint (funcall plotfunc from to bg-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 (plotted-to (car wrappoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2348 (plotted-width (cdr wrappoint)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349 (setq from plotted-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350 (setq ps-width-remaining (- ps-width-remaining plotted-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2351 (if (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 (ps-continue-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 (let* ((q-todo (- (point-max) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 (q-done (- (point) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 (chunkfrac (/ q-todo 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 (chunksize (if (> chunkfrac 1000) 1000 chunkfrac)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 (if (> (- q-done ps-razchunk) chunksize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359 (let (foo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 (setq ps-razchunk q-done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 (setq foo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362 (if (< q-todo 100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 (/ (* 100 q-done) q-todo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 (/ q-done (/ q-todo 100))))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2365 (message "Formatting...%3d%%" foo))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 (defun ps-set-font (font)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 (setq ps-current-font font)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 (ps-output (format "/f%d F\n" ps-current-font)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371 (defun ps-set-bg (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372 (if (setq ps-current-bg color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373 (ps-output (format ps-color-format (nth 0 color) (nth 1 color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 (nth 2 color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 " true BG\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376 (ps-output "false BG\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 (defun ps-set-color (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379 (if (setq ps-current-color color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 (setq ps-current-color ps-default-fg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 (ps-output (format ps-color-format (nth 0 ps-current-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 (nth 1 ps-current-color) (nth 2 ps-current-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384 " FG\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 (defun ps-set-underline (underline-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387 (ps-output (if underline-p "true" "false") " UL\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388 (setq ps-current-underline-p underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 (defun ps-plot-region (from to font fg-color &optional bg-color underline-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 (if (not (equal font ps-current-font))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 (ps-set-font font))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 ;; Specify a foreground color only if one's specified and it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 ;; different than the current.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 (if (not (equal fg-color ps-current-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398 (ps-set-color fg-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 (if (not (equal bg-color ps-current-bg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 (ps-set-bg bg-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 ;; Toggle underlining if different.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 (if (not (equal underline-p ps-current-underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 (ps-set-underline underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 ;; Starting at the beginning of the specified region...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 (goto-char from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411 ;; ...break the region up into chunks separated by tabs, linefeeds,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 ;; and pagefeeds, and plot each chunk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 (while (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414 (if (re-search-forward "[\t\n\f]" to t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 (let ((match (char-after (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 ((= match ?\t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 (let ((linestart
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 (save-excursion (beginning-of-line) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 (ps-plot 'ps-basic-plot-string from (- (point) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 (setq from (+ linestart (current-column)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424 (if (re-search-forward "[ \t]+" to t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 (ps-plot 'ps-basic-plot-whitespace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 from (+ linestart (current-column))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427 bg-color))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429 ((= match ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 (ps-plot 'ps-basic-plot-string from (- (point) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431 bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 (ps-next-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435 ((= match ?\f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 (ps-plot 'ps-basic-plot-string from (- (point) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437 bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438 (ps-next-page)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 (setq from (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 (ps-plot 'ps-basic-plot-string from to bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 (setq from to)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 (defun ps-color-value (x-color-value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 ;; Scale 16-bit X-COLOR-VALUE to PostScript color value in [0, 1] interval.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 (/ x-color-value ps-print-color-scale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447 (defun ps-color-values (x-color)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2448 (cond ((fboundp 'color-instance-rgb-components)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2449 (if (ps-color-device)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2450 (color-instance-rgb-components
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2451 (if (color-instance-p x-color) x-color
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2452 (if (color-specifier-p x-color)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2453 (make-color-instance (color-name x-color))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2454 (make-color-instance x-color))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2455 (error "No available function to determine X color values.")))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
2456 ((fboundp 'x-color-values)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 (x-color-values x-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 (t (error "No available function to determine X color values."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 (defun ps-face-attributes (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461 (let ((differs (face-differs-from-default-p face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462 (list (memq face ps-ref-bold-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 (memq face ps-ref-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 (memq face ps-ref-underlined-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 (and differs (face-foreground face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466 (and differs (face-background face)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 (defun ps-face-attribute-list (face-or-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469 (if (listp face-or-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 (let (bold-p italic-p underline-p foreground background face-attr face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471 (while face-or-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 (setq face (car face-or-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2473 (setq face-attr (ps-face-attributes face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 (setq bold-p (or bold-p (nth 0 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 (setq italic-p (or italic-p (nth 1 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476 (setq underline-p (or underline-p (nth 2 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477 (if foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 (setq foreground (nth 3 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 (if background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 (setq background (nth 4 face-attr)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 (setq face-or-list (cdr face-or-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484 (list bold-p italic-p underline-p foreground background))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 (ps-face-attributes face-or-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 (defun ps-plot-with-face (from to face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 (if face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490 (let* ((face-attr (ps-face-attribute-list face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 (bold-p (nth 0 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 (italic-p (nth 1 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 (underline-p (nth 2 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 (foreground (nth 3 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 (background (nth 4 face-attr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 (fg-color (if (and ps-print-color-p
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2497 (ps-color-device)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 foreground)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 (mapcar 'ps-color-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 (ps-color-values foreground))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501 ps-default-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 (bg-color (if (and ps-print-color-p
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2503 (ps-color-device)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 background)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 (mapcar 'ps-color-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506 (ps-color-values background)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507 (ps-plot-region from to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 (cond ((and bold-p italic-p) 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509 (italic-p 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 (bold-p 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511 (t 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2512 ; (or fg-color '(0.0 0.0 0.0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 fg-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514 bg-color underline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2515 (goto-char to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518 (defun ps-emacs-face-kind-p (face kind kind-regex kind-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519 (let ((frame-font (face-font face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520 (face-defaults (face-font face t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2521 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2522 ;; Check FACE defaults:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2523 (and (listp face-defaults)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524 (memq kind face-defaults))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526 ;; Check the user's preferences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 (memq face kind-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529 (defun ps-xemacs-face-kind-p (face kind kind-regex kind-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530 (let* ((frame-font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2531 (or (face-font-instance face) (face-font-instance 'default)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2532 (kind-cons (and frame-font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 (assq kind (font-instance-properties frame-font))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 (kind-spec (cdr-safe kind-cons))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2535 (case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 (or (and kind-spec (string-match kind-regex kind-spec))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538 ;; Kludge-compatible:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 (memq face kind-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 (defun ps-face-bold-p (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 (if (eq ps-print-emacs-type 'emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543 (ps-emacs-face-kind-p face 'bold "-\\(bold\\|demibold\\)-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544 ps-bold-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 ps-bold-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548 (defun ps-face-italic-p (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 (if (eq ps-print-emacs-type 'emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550 (ps-emacs-face-kind-p face 'italic "-[io]-" ps-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552 (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o" ps-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 (ps-xemacs-face-kind-p face 'SLANT "i\\|o" ps-italic-faces))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2555 (defun ps-face-underlined-p (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556 (or (face-underline-p face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557 (memq face ps-underlined-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559 ;; Ensure that face-list is fbound.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560 (or (fboundp 'face-list) (defalias 'face-list 'list-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562 (defun ps-build-reference-face-lists ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563 (if ps-auto-font-detect
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
2564 (let ((faces (if (eq ps-print-emacs-type 'xemacs)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
2565 (face-list 5)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
2566 (face-list)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 (setq ps-ref-bold-faces nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569 ps-ref-italic-faces nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2570 ps-ref-underlined-faces nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 (while faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2572 (setq the-face (car faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573 (if (ps-face-italic-p the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574 (setq ps-ref-italic-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 (cons the-face ps-ref-italic-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576 (if (ps-face-bold-p the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577 (setq ps-ref-bold-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578 (cons the-face ps-ref-bold-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579 (if (ps-face-underlined-p the-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2580 (setq ps-ref-underlined-faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581 (cons the-face ps-ref-underlined-faces)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582 (setq faces (cdr faces))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583 (setq ps-ref-bold-faces ps-bold-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584 (setq ps-ref-italic-faces ps-italic-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585 (setq ps-ref-underlined-faces ps-underlined-faces))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 (setq ps-build-face-reference nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588 (defun ps-mapper (extent list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 (nconc list (list (list (extent-start-position extent) 'push extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590 (list (extent-end-position extent) 'pull extent)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2593 (defun ps-extent-sorter (a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2594 (< (extent-priority a) (extent-priority b)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596 (defun ps-print-ensure-fontified (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597 (if (and (boundp 'lazy-lock-mode) lazy-lock-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598 (if (fboundp 'lazy-lock-fontify-region)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2599 (lazy-lock-fontify-region start end) ; the new
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2600 (lazy-lock-fontify-buffer)))) ; the old
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 (defun ps-generate-postscript-with-faces (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603 ;; Build the reference lists of faces if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 (if (or ps-always-build-face-reference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605 ps-build-face-reference)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607 (message "Collecting face information...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608 (ps-build-reference-face-lists)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609 ;; Set the color scale. We do it here instead of in the defvar so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2610 ;; that ps-print can be dumped into emacs. This expression can't be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611 ;; evaluated at dump-time because X isn't initialized.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612 (setq ps-print-color-scale
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2613 (if (and ps-print-color-p (ps-color-device))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 (float (car (ps-color-values "white")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2615 1.0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616 ;; Generate some PostScript.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618 (narrow-to-region from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619 (let ((face 'default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 (position to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621 (ps-print-ensure-fontified from to)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2622 (cond ((or (eq ps-print-emacs-type 'lucid)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2623 (eq ps-print-emacs-type 'xemacs))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 ;; Build the list of extents...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625 (let ((a (cons 'dummy nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 record type extent extent-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627 (map-extents 'ps-mapper nil from to a)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2628 (setq a (sort (cdr a) 'car-less-than-car))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630 (setq extent-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 ;; Loop through the extents...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633 (while a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634 (setq record (car a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636 (setq position (car record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 (setq record (cdr record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639 (setq type (car record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 (setq record (cdr record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642 (setq extent (car record))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644 ;; Plot up to this record.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 ;; XEmacs 19.12: for some reason, we're getting into a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646 ;; situation in which some of the records have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647 ;; positions less than 'from'. Since we've narrowed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 ;; the buffer, this'll generate errors. This is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649 ;; hack, but don't call ps-plot-with-face unless from >
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 ;; point-min.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651 (if (and (>= from (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652 (<= position (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653 (ps-plot-with-face from position face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656 ((eq type 'push)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 (if (extent-face extent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 (setq extent-list (sort (cons extent extent-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659 'ps-extent-sorter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 ((eq type 'pull)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2662 (setq extent-list (sort (delq extent extent-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 'ps-extent-sorter))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 (setq face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666 (if extent-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667 (extent-face (car extent-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668 'default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670 (setq from position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2671 (setq a (cdr a)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 ((eq ps-print-emacs-type 'emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674 (let ((property-change from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2675 (overlay-change from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676 (while (< from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 (if (< property-change to) ; Don't search for property change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678 ; unless previous search succeeded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679 (setq property-change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680 (next-property-change from nil to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 (if (< overlay-change to) ; Don't search for overlay change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2682 ; unless previous search succeeded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683 (setq overlay-change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684 (min (next-overlay-change from) to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685 (setq position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 (min property-change overlay-change))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2687 ;; The code below is not quite correct,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2688 ;; because a non-nil overlay invisible property
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2689 ;; which is inactive according to the current value
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2690 ;; of buffer-invisibility-spec nonetheless overrides
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2691 ;; a face text property.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692 (setq face
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2693 (cond ((let ((prop (get-text-property from 'invisible)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2694 ;; Decide whether this invisible property
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2695 ;; really makes the text invisible.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2696 (if (eq buffer-invisibility-spec t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2697 (not (null prop))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2698 (or (memq prop buffer-invisibility-spec)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2699 (assq prop buffer-invisibility-spec))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2700 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 ((get-text-property from 'face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702 (t 'default)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 (let ((overlays (overlays-at from))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 (face-priority -1)) ; text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705 (while overlays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 (let* ((overlay (car overlays))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2707 (overlay-face (overlay-get overlay 'face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708 (overlay-invisible (overlay-get overlay 'invisible))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2709 (overlay-priority (or (overlay-get overlay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710 'priority)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 (if (and (or overlay-invisible overlay-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 (> overlay-priority face-priority))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2714 (setq face (cond ((if (eq buffer-invisibility-spec t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2715 (not (null overlay-invisible))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2716 (or (memq overlay-invisible buffer-invisibility-spec)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2717 (assq overlay-invisible buffer-invisibility-spec)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2718 nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719 ((and face overlay-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 face-priority overlay-priority)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 (setq overlays (cdr overlays))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722 ;; Plot up to this record.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2723 (ps-plot-with-face from position face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724 (setq from position)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 (ps-plot-with-face from to face))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 (defun ps-generate-postscript (from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728 (ps-plot-region from to 0 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2730 (defun ps-generate (buffer from to genfunc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 (let ((from (min to from))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2732 (to (max to from))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2733 ;; This avoids trouble if chars with read-only properties
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2734 ;; are copied into ps-spool-buffer.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2735 (inhibit-read-only t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2737 (narrow-to-region from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 (if ps-razzle-dazzle
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2739 (message "Formatting...%3d%%" (setq ps-razchunk 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 (setq ps-source-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2742 (setq ps-spool-buffer (get-buffer-create ps-spool-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 (ps-init-output-queue)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2744 (let (safe-marker completed-safely needs-begin-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2749 ;; Get a marker and make it point to the current end of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2750 ;; buffer, If an error occurs, we'll delete everything from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751 ;; the end of this marker onwards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752 (setq safe-marker (make-marker))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 (set-marker safe-marker (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2755 (goto-char (point-min))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2756 (if (looking-at (regexp-quote ps-adobe-tag))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2757 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2758 (setq needs-begin-file t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2760 (set-buffer ps-source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2761 (if needs-begin-file (ps-begin-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2762 (ps-begin-job)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2763 (ps-begin-page))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2764 (set-buffer ps-source-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2765 (funcall genfunc from to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2766 (ps-end-page)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2768 (if (and ps-spool-duplex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769 (= (mod ps-page-count 2) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770 (ps-dummy-page))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 ;; Back to the PS output buffer to set the page count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2774 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2775 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2776 (while (re-search-backward "^/PageCount 0 def$" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2777 (replace-match (format "/PageCount %d def" ps-page-count) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2778
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2779 ;; Setting this variable tells the unwind form that
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2780 ;; the postscript was generated without error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2781 (setq completed-safely t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2782
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2783 ;; Unwind form: If some bad mojo occurred while generating
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2784 ;; postscript, delete all the postscript that was generated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2785 ;; This protects the previously spooled files from getting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2786 ;; corrupted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2787 (if (and (markerp safe-marker) (not completed-safely))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2788 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2789 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2790 (delete-region (marker-position safe-marker) (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2791
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2792 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2793 (message "Formatting...done")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2794
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2795 ;; Permit dynamic evaluation at print time of ps-lpr-switches
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2796 (defun ps-do-despool (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2797 (if (or (not (boundp 'ps-spool-buffer))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2798 (not (symbol-value 'ps-spool-buffer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2799 (message "No spooled PostScript to print")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2800 (ps-end-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2801 (ps-flush-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2802 (if filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2803 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2804 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2805 (message "Saving..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2806 (set-buffer ps-spool-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2807 (setq filename (expand-file-name filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2808 (write-region (point-min) (point-max) filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2809 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2810 (message "Wrote %s" filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2811 ;; Else, spool to the printer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2812 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2813 (message "Printing..."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2814 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2815 (set-buffer ps-spool-buffer)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2816 (if (and (eq system-type 'ms-dos) (stringp dos-ps-printer))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2817 (write-region (point-min) (point-max) dos-ps-printer t 0)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2818 (let ((binary-process-input t) ; for MS-DOS
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2819 (ps-lpr-sw ; Dynamic evaluation
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2820 (ps-flatten-list (mapcar 'ps-eval-switch ps-lpr-switches))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2821 (apply 'call-process-region
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2822 (point-min) (point-max) ps-lpr-command nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2823 (if (fboundp 'start-process) 0 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2824 nil
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2825 ps-lpr-sw))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2826 (if ps-razzle-dazzle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2827 (message "Printing...done")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2828 (kill-buffer ps-spool-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2829
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2830 ;; Dynamic evaluation
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2831 (defun ps-eval-switch (arg)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2832 (cond ((stringp arg) arg)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2833 ((functionp arg) (apply arg nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2834 ((symbolp arg) (symbol-value arg))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2835 ((consp arg) (apply (car arg) (cdr arg)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2836 (t nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2837
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2838 ;; `ps-flatten-list' is defined here (copied from "message.el" and
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2839 ;; enhanced to handle dotted pairs as well) until we can get some
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2840 ;; sensible autoloads, or `flatten-list' gets put somewhere decent.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2841
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2842 ;; (ps-flatten-list '((a . b) c (d . e) (f g h) i . j))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2843 ;; => (a b c d e f g h i j)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2844
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2845 (defun ps-flatten-list (&rest list)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2846 (ps-flatten-list-1 list))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2847
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2848 (defun ps-flatten-list-1 (list)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2849 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2850 ((null list) (list))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2851 ((consp list)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2852 (append (ps-flatten-list-1 (car list))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2853 (ps-flatten-list-1 (cdr list))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2854 (t (list list))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2855
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2856 (defun ps-kill-emacs-check ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2857 (let (ps-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2858 (if (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2859 (buffer-modified-p ps-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2860 (if (y-or-n-p "Unprinted PostScript waiting; print now? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2861 (ps-despool)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2862 (if (and (setq ps-buffer (get-buffer ps-spool-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2863 (buffer-modified-p ps-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2864 (if (yes-or-no-p "Unprinted PostScript waiting; exit anyway? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2865 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2866 (error "Unprinted PostScript")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2868 (if (fboundp 'add-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2869 (add-hook 'kill-emacs-hook 'ps-kill-emacs-check)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2870 (if kill-emacs-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2871 (message "Won't override existing kill-emacs-hook")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2872 (setq kill-emacs-hook 'ps-kill-emacs-check)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2874 ;;; Sample Setup Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2876 ;; This stuff is for anybody that's brave enough to look this far,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2877 ;; and able to figure out how to use it. It isn't really part of ps-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2878 ;; print, but I'll leave it here in hopes it might be useful:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2880 ;; WARNING!!! The following code is *sample* code only. Don't use it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2881 ;; unless you understand what it does!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2883 (defmacro ps-prsc () (list 'if (list 'eq 'ps-print-emacs-type ''emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2884 [f22] ''f22))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2885 (defmacro ps-c-prsc () (list 'if (list 'eq 'ps-print-emacs-type ''emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2886 [C-f22]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2887 ''(control f22)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2888 (defmacro ps-s-prsc () (list 'if (list 'eq 'ps-print-emacs-type ''emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2889 [S-f22]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2890 ''(shift f22)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2892 ;; Look in an article or mail message for the Subject: line. To be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2893 ;; placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2894 (defun ps-article-subject ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2895 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2896 (goto-char (point-min))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2897 (if (re-search-forward "^Subject:[ \t]+\\(.*\\)$" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2898 (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2899 "Subject ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2901 ;; Look in an article or mail message for the From: line. Sorta-kinda
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2902 ;; understands RFC-822 addresses and can pull the real name out where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2903 ;; it's provided. To be placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2904 (defun ps-article-author ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2905 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2906 (goto-char (point-min))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2907 (if (re-search-forward "^From:[ \t]+\\(.*\\)$" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2908 (let ((fromstring (buffer-substring (match-beginning 1) (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2909 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2911 ;; Try first to match addresses that look like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2912 ;; thompson@wg2.waii.com (Jim Thompson)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2913 ((string-match ".*[ \t]+(\\(.*\\))" fromstring)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2914 (substring fromstring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2915
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2916 ;; Next try to match addresses that look like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2917 ;; Jim Thompson <thompson@wg2.waii.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2918 ((string-match "\\(.*\\)[ \t]+<.*>" fromstring)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2919 (substring fromstring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2921 ;; Couldn't find a real name -- show the address instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2922 (t fromstring)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2923 "From ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 ;; A hook to bind to gnus-Article-prepare-hook. This will set the ps-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 ;; left-headers specially for gnus articles. Unfortunately, gnus-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927 ;; article-mode-hook is called only once, the first time the *Article*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 ;; buffer enters that mode, so it would only work for the first time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929 ;; we ran gnus. The second time, this hook wouldn't get set up. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 ;; only alternative is gnus-article-prepare-hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 (defun ps-gnus-article-prepare-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 (setq ps-header-lines 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933 (setq ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 ;; The left headers will display the article's subject, its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 ;; author, and the newsgroup it was in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 (list 'ps-article-subject 'ps-article-author 'gnus-newsgroup-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938 ;; A hook to bind to vm-mode-hook to locally bind prsc and set the ps-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939 ;; left-headers specially for mail messages. This header setup would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940 ;; also work, I think, for RMAIL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2941 (defun ps-vm-mode-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942 (local-set-key (ps-prsc) 'ps-vm-print-message-from-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2943 (setq ps-header-lines 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2944 (setq ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2945 ;; The left headers will display the message's subject, its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2946 ;; author, and the name of the folder it was in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2947 (list 'ps-article-subject 'ps-article-author 'buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2949 ;; Every now and then I forget to switch from the *Summary* buffer to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2950 ;; the *Article* before hitting prsc, and a nicely formatted list of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 ;; article subjects shows up at the printer. This function, bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2952 ;; prsc for the gnus *Summary* buffer means I don't have to switch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2953 ;; buffers first.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2954 ;; sb: Updated for Gnus 5.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2955 (defun ps-gnus-print-article-from-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2956 (interactive)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2957 (let ((ps-buf (if (boundp 'gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2958 gnus-article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2959 "*Article*")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2960 (if (get-buffer ps-buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2961 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2962 (set-buffer ps-buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents: 2
diff changeset
2963 (ps-spool-buffer-with-faces)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965 ;; See ps-gnus-print-article-from-summary. This function does the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 ;; same thing for vm.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 (defun ps-vm-print-message-from-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968 (interactive)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2969 (if (and (boundp 'vm-mail-buffer) (symbol-value 'vm-mail-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2970 (save-excursion
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
2971 (set-buffer (symbol-value 'vm-mail-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972 (ps-spool-buffer-with-faces))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974 ;; A hook to bind to bind to gnus-summary-setup-buffer to locally bind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2975 ;; prsc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 (defun ps-gnus-summary-setup ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977 (local-set-key (ps-prsc) 'ps-gnus-print-article-from-summary))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2979 ;; Look in an article or mail message for the Subject: line. To be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980 ;; placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2981 (defun ps-info-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2983 (goto-char (point-min))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2984 (if (re-search-forward "File:[ \t]+\\([^, \t\n]*\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2985 (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2986 "File ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2988 ;; Look in an article or mail message for the Subject: line. To be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2989 ;; placed in ps-left-headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2990 (defun ps-info-node ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2991 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2992 (goto-char (point-min))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2993 (if (re-search-forward "Node:[ \t]+\\([^,\t\n]*\\)" nil t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2994 (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2995 "Node ???")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2997 (defun ps-info-mode-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2998 (setq ps-left-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2999 ;; The left headers will display the node name and file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000 (list 'ps-info-node 'ps-info-file)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3002 ;; WARNING! The following function is a *sample* only, and is *not*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3003 ;; meant to be used as a whole unless you understand what the effects
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3004 ;; will be! (In fact, this is a copy of Jim's setup for ps-print --
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3005 ;; I'd be very surprised if it was useful to *anybody*, without
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3006 ;; modification.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3008 (defun ps-jts-ps-setup ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3009 (global-set-key (ps-prsc) 'ps-spool-buffer-with-faces) ;f22 is prsc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 (global-set-key (ps-s-prsc) 'ps-spool-region-with-faces)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3011 (global-set-key (ps-c-prsc) 'ps-despool)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 (add-hook 'gnus-article-prepare-hook 'ps-gnus-article-prepare-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3013 (add-hook 'gnus-summary-mode-hook 'ps-gnus-summary-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3014 (add-hook 'vm-mode-hook 'ps-vm-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3015 (add-hook 'vm-mode-hooks 'ps-vm-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3016 (add-hook 'Info-mode-hook 'ps-info-mode-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3017 (setq ps-spool-duplex t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 (setq ps-print-color-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3019 (setq ps-lpr-command "lpr")
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3020 (setq ps-lpr-switches '("-Jjct,duplex_long"))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3021 'ps-jts-ps-setup)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3022
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3023 ;; WARNING! The following function is a *sample* only, and is *not*
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3024 ;; meant to be used as a whole unless it corresponds to your needs.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3025 ;; (In fact, this is a copy of Jack's setup for ps-print --
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3026 ;; I would not be that surprised if it was useful to *anybody*,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3027 ;; without modification.)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3028
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3029 (defun ps-jack-setup ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3030 (setq ps-print-color-p 'nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3031 ps-lpr-command "lpr"
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3032 ps-lpr-switches (list)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3033
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3034 ps-paper-type 'a4
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3035 ps-landscape-mode 't
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3036 ps-number-of-columns 2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3037
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3038 ps-left-margin (/ (* 72 1.0) 2.54) ; 1.0 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3039 ps-right-margin (/ (* 72 1.0) 2.54) ; 1.0 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3040 ps-inter-column (/ (* 72 1.0) 2.54) ; 1.0 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3041 ps-bottom-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3042 ps-top-margin (/ (* 72 1.5) 2.54) ; 1.5 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3043 ps-header-offset (/ (* 72 1.0) 2.54) ; 1.0 cm
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3044 ps-header-line-pad .15
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3045 ps-print-header t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3046 ps-print-header-frame t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3047 ps-header-lines 2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3048 ps-show-n-of-n t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3049 ps-spool-duplex nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3050
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3051 ps-font-family 'Courier
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3052 ps-font-size 5.5
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3053 ps-header-font-family 'Helvetica
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3054 ps-header-font-size 6
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3055 ps-header-title-font-size 8)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 6
diff changeset
3056 'ps-jack-setup)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3057
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3058 (provide 'ps-print)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3060 ;;; ps-print.el ends here