;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters)
;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br>
;; Keywords: wp, print, PostScript
-;; Time-stamp: <2000/11/29 17:35:39 vinicius>
-;; Version: 6.3.2
+;; Time-stamp: <2000/12/26 23:19:24 Vinicius>
+;; Version: 6.3.3
;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
-(defconst ps-print-version "6.3.2"
- "ps-print.el, v 6.3.2 <2000/11/29 vinicius>
+(defconst ps-print-version "6.3.3"
+ "ps-print.el, v 6.3.3 <2000/12/26 vinicius>
Vinicius's last change version -- this file may have been edited as part of
Emacs without changes to the version number. When reporting bugs, please also
:type 'boolean
:group 'ps-print-printer)
-(defcustom ps-end-with-control-d ps-windows-system
+(defcustom ps-end-with-control-d (and ps-windows-system t)
"*Non-nil means insert C-d at end of PostScript file generated."
:type 'boolean
:group 'ps-print-printer)
`odd-page' print only odd pages.
`even-sheet' print only even sheets.
- That is, if `ps-n-up-printing' is 1, it behaves as `even'; but
- for values greater than 1, it'll print only the even sheet of
- paper.
+ That is, if `ps-n-up-printing' is 1, it behaves as `even-page';
+ but for values greater than 1, it'll print only the even sheet
+ of paper.
`odd-sheet' print only odd sheets.
- That is, if `ps-n-up-printing' is 1, it behaves as `odd'; but
- for values greater than 1, it'll print only the odd sheet of
- paper.
+ That is, if `ps-n-up-printing' is 1, it behaves as `odd-page';
+ but for values greater than 1, it'll print only the odd sheet
+ of paper.
Any other value is treated as nil.
ps-printer-name-option %s
ps-print-region-function %s
ps-manual-feed %S
+ ps-end-with-control-d %S
ps-paper-type %s
ps-warn-paper-type %s
ps-line-number-step %s
ps-line-number-start %S
- ps-default-fg %s
- ps-default-bg %s
+ ps-default-fg %s
+ ps-default-bg %s
+ ps-razzle-dazzle %S
ps-use-face-background %s
ps-print-background-text %s
- ps-error-handler-message %s
- ps-user-defined-prologue %s
- ps-print-prologue-header %s
+ ps-error-handler-message %s
+ ps-user-defined-prologue %s
+ ps-print-prologue-header %s
+ ps-postscript-code-directory %S
+ ps-adobe-tag %S
ps-left-margin %s
ps-right-margin %s
ps-spool-duplex %s
ps-spool-tumble %s
ps-banner-page-when-duplexing %s
+ ps-left-header %s
+ ps-right-header %s
ps-n-up-printing %s
ps-n-up-margin %s
ps-even-or-odd-pages %s
ps-selected-pages %s
- ps-last-selected-pages %s)
+ ps-last-selected-pages %s
+
+ ps-build-face-reference %S
+ ps-always-build-face-reference %S
+
+ ps-auto-font-detect %S
+ ps-bold-faces %s
+ ps-italic-faces %s
+ ps-underlined-faces %s)
+
+;; The following customized variables have long lists and are seldom modified:
+;; ps-page-dimensions-database
+;; ps-font-info-database
;;; ps-print - end of settings
"
(ps-print-quote ps-printer-name-option)
(ps-print-quote ps-print-region-function)
ps-manual-feed
+ ps-end-with-control-d
(ps-print-quote ps-paper-type)
ps-warn-paper-type
ps-landscape-mode
ps-line-number-start
(ps-print-quote ps-default-fg)
(ps-print-quote ps-default-bg)
+ ps-razzle-dazzle
(ps-print-quote ps-use-face-background)
(ps-print-quote ps-print-control-characters)
(ps-print-quote ps-print-background-image)
(ps-print-quote ps-error-handler-message)
(ps-print-quote ps-user-defined-prologue)
(ps-print-quote ps-print-prologue-header)
+ ps-postscript-code-directory
+ ps-adobe-tag
ps-left-margin
ps-right-margin
ps-inter-column
ps-spool-duplex
ps-spool-tumble
ps-banner-page-when-duplexing
+ (ps-print-quote ps-left-header)
+ (ps-print-quote ps-right-header)
ps-n-up-printing
ps-n-up-margin
ps-n-up-border-p
(ps-print-quote ps-line-number-font-size)
(ps-print-quote ps-even-or-odd-pages)
(ps-print-quote ps-selected-pages)
- (ps-print-quote ps-last-selected-pages)))
+ (ps-print-quote ps-last-selected-pages)
+ ps-build-face-reference
+ ps-always-build-face-reference
+ ps-auto-font-detect
+ (ps-print-quote ps-bold-faces)
+ (ps-print-quote ps-italic-faces)
+ (ps-print-quote ps-underlined-faces)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ps-prologue-file (filenumber)
(save-excursion
- (let* ((filename (format "%sps-prin%d.ps"
- ps-postscript-code-directory filenumber))
+ (let* ((filename (convert-standard-filename
+ (expand-file-name (format "ps-prin%d.ps" filenumber)
+ ps-postscript-code-directory)))
(buffer
(or (find-file-noselect filename 'no-warn 'rawfile)
(error "ps-print PostScript prologue `%s' file was not found."
(defvar ps-page-column 0) ; column counter
(defvar ps-page-printed 0) ; total pages printed
(defvar ps-page-n-up 0) ; n-up counter
-(defvar ps-showline-count 1)
+(defvar ps-lines-printed 0) ; total lines printed
+(defvar ps-showline-count 1) ; line number counter
(defvar ps-first-page nil)
(defvar ps-last-page nil)
(defvar ps-print-page-p t)
(defun ps-begin-job ()
;; prologue files
- (let ((last-char (aref ps-postscript-code-directory
- (1- (length ps-postscript-code-directory)))))
- (or (eq last-char ?/)
- (and ps-windows-system (eq last-char ?\\))
- (setq ps-postscript-code-directory
- (concat ps-postscript-code-directory "/"))))
(or (equal ps-mark-code-directory ps-postscript-code-directory)
(setq ps-print-prologue-0 (ps-prologue-file 0)
ps-print-prologue-1 (ps-prologue-file 1)
ps-page-sheet 0
ps-page-n-up 0
ps-page-column 0
+ ps-lines-printed 0
ps-print-page-p t
ps-showline-count (car ps-printing-region)
ps-font-size-internal (ps-get-font-size 'ps-font-size)
(ps-generate-header "HeaderLinesRight" ps-right-header)
(ps-output (format "%d SetHeaderLines\n" ps-header-lines)))
- (ps-output "BeginPage\n")
+ (ps-output (number-to-string ps-lines-printed) " BeginPage\n")
(ps-set-font ps-current-font)
(ps-set-bg ps-current-bg)
(ps-set-color ps-current-color)
(defun ps-end-page ()
(ps-output "EndPage\nEndDSCPage\n"))
+(defun ps-skip-newline (limit)
+ (setq ps-showline-count (1+ ps-showline-count)
+ ps-lines-printed (1+ ps-lines-printed))
+ (and (< (point) limit)
+ (forward-char 1)))
+
(defun ps-next-line ()
- (setq ps-showline-count (1+ ps-showline-count))
+ (setq ps-showline-count (1+ ps-showline-count)
+ ps-lines-printed (1+ ps-lines-printed))
(let ((lh (ps-line-height 'ps-font-for-text)))
(if (< ps-height-remaining lh)
(ps-next-page)
(ps-output "HL\n"))))
(defun ps-continue-line ()
+ (setq ps-lines-printed (1+ ps-lines-printed))
(let ((lh (ps-line-height 'ps-font-for-text)))
(if (< ps-height-remaining lh)
(ps-next-page)
bg-color))))
((= match ?\n) ; newline
- (ps-next-line))
+ (if (looking-at "\f[^\n]")
+ ;; \n\ftext\n ==>> next page, but keep line counting!!
+ (progn
+ (ps-skip-newline to)
+ (ps-next-page))
+ ;; \n\f\n ==>> it'll be handled by form feed
+ ;; \ntext\n ==>> next line
+ (ps-next-line)))
((= match ?\f) ; form feed
;; do not skip page if previous character is NEWLINE and
;; it is a beginning of page.
- (or (and (equal (char-after (1- match-point)) ?\n)
- (= ps-height-remaining ps-print-height))
- (ps-next-page)))
+ (unless (and (equal (char-after (1- match-point)) ?\n)
+ (= ps-height-remaining ps-print-height))
+ ;; \f\n ==>> skip \n, but keep line counting!!
+ (and (equal (following-char) ?\n)
+ (ps-skip-newline to))
+ (ps-next-page)))
(composition ; a composite sequence
(ps-plot 'ps-mule-plot-composition match-point (point) bg-color))
;; Loop through the extents...
(while a
(setq record (car a)
-
position (car record)
- record (cdr record)
- type (car record)
record (cdr record)
+ type (car record)
+ record (cdr record)
extent (car record))
;; Plot up to this record.
(let ((ps-n-up-printing 0))
(ps-header-sheet)
(ps-output "/PrintHeader false def\n/ColumnIndex 0 def\n"
- "/PrintLineNumber false def\nBeginPage\n")
+ "/PrintLineNumber false def\n"
+ (number-to-string ps-lines-printed) " BeginPage\n")
(ps-end-page)))
;; Set end of PostScript file
(and previous-print