Mercurial > emacs
comparison lisp/ps-print.el @ 24414:971efbc0ac2c
Doc fix, font size specifies landscape and portrait sizes.
(ps-print-version): New version number (4.1.4).
(ps-font-size, ps-header-font-size, ps-header-title-font-size):
Specifies landscape and portrait sizes.
(ps-setup, ps-print-quote, ps-line-lengths-internal, ps-nb-pages)
(ps-get-page-dimensions, ps-begin-file, ps-begin-job, ps-generate): Fun
fix.
(ps-get-font-size): New fun.
(ps-font-size-internal, ps-header-font-size-internal)
(ps-header-title-font-size-internal): New vars.
PostScript programming fix.
(ps-print-prologue-1): Fix BeginDoc PostScript procedure (do'nt use
setpagedevice operator).
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 27 Feb 1999 01:37:15 +0000 |
parents | 3a9da940e5f2 |
children | 77ab1bf09106 |
comparison
equal
deleted
inserted
replaced
24413:e2c5b1571392 | 24414:971efbc0ac2c |
---|---|
1 ;;; ps-print.el --- Print text from the buffer as PostScript | 1 ;;; ps-print.el --- Print text from the buffer as PostScript |
2 | 2 |
3 ;; Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>) | 5 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>) |
6 ;; Author: Jacques Duthen (was <duthen@cegelec-red.fr>) | 6 ;; Author: Jacques Duthen (was <duthen@cegelec-red.fr>) |
7 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> | 7 ;; Author: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
8 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 8 ;; Author: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
9 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) | 9 ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) |
10 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> | 10 ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> |
11 ;; Keywords: print, PostScript | 11 ;; Keywords: print, PostScript |
12 ;; Time-stamp: <98/11/23 15:02:20 vinicius> | 12 ;; Time-stamp: <99/02/19 11:47:32 vinicius> |
13 ;; Version: 4.1.3 | 13 ;; Version: 4.1.4 |
14 | 14 |
15 (defconst ps-print-version "4.1.3" | 15 (defconst ps-print-version "4.1.4" |
16 "ps-print.el, v 4.1.3 <98/11/23 vinicius> | 16 "ps-print.el, v 4.1.4 <99/02/19 vinicius> |
17 | 17 |
18 Vinicius's last change version -- this file may have been edited as part of | 18 Vinicius's last change version -- this file may have been edited as part of |
19 Emacs without changes to the version number. When reporting bugs, | 19 Emacs without changes to the version number. When reporting bugs, |
20 please also report the version of Emacs, if any, that ps-print was | 20 please also report the version of Emacs, if any, that ps-print was |
21 distributed with. | 21 distributed with. |
499 ;; | 499 ;; |
500 ;; | 500 ;; |
501 ;; Font Managing | 501 ;; Font Managing |
502 ;; ------------- | 502 ;; ------------- |
503 ;; | 503 ;; |
504 ;; ps-print now knows rather precisely some fonts: | 504 ;; ps-print now knows rather precisely some fonts: the variable |
505 ;; the variable `ps-font-info-database' contains information | 505 ;; `ps-font-info-database' contains information for a list of font families |
506 ;; for a list of font families (currently mainly `Courier' `Helvetica' | 506 ;; (currently mainly `Courier' `Helvetica' `Times' `Palatino' `Helvetica-Narrow' |
507 ;; `Times' `Palatino' `Helvetica-Narrow' `NewCenturySchlbk'). | 507 ;; `NewCenturySchlbk'). Each font family contains the font names for standard, |
508 ;; Each font family contains the font names for standard, bold, italic | 508 ;; bold, italic and bold-italic characters, a reference size (usually 10) and |
509 ;; and bold-italic characters, a reference size (usually 10) and the | 509 ;; the corresponding line height, width of a space and average character width. |
510 ;; corresponding line height, width of a space and average character width. | 510 ;; |
511 ;; | 511 ;; The variable `ps-font-family' determines which font family is to be used for |
512 ;; The variable `ps-font-family' determines which font family | 512 ;; ordinary text. If its value does not correspond to a known font family, an |
513 ;; is to be used for ordinary text. | 513 ;; error message is printed into the `*Messages*' buffer, which lists the |
514 ;; If its value does not correspond to a known font family, | 514 ;; currently available font families. |
515 ;; an error message is printed into the `*Messages*' buffer, | 515 ;; |
516 ;; which lists the currently available font families. | 516 ;; The variable `ps-font-size' determines the size (in points) of the font for |
517 ;; | 517 ;; ordinary text, when generating PostScript. Its value is a float or a cons of |
518 ;; The variable `ps-font-size' determines the size (in points) | 518 ;; floats which has the following form: |
519 ;; of the font for ordinary text, when generating PostScript. | 519 ;; |
520 ;; Its value is a float. | 520 ;; (LANDSCAPE-SIZE . PORTRAIT-SIZE) |
521 ;; | 521 ;; |
522 ;; Similarly, the variable `ps-header-font-family' determines | 522 ;; Similarly, the variable `ps-header-font-family' determines which font family |
523 ;; which font family is to be used for text in the header. | 523 ;; is to be used for text in the header. |
524 ;; The variable `ps-header-font-size' determines the font size, | 524 ;; |
525 ;; in points, for text in the header. | 525 ;; The variable `ps-header-font-size' determines the font size, in points, for |
526 ;; The variable `ps-header-title-font-size' determines the font size, | 526 ;; text in the header (similar to `ps-font-size'). |
527 ;; in points, for the top line of text in the header. | 527 ;; |
528 ;; The variable `ps-header-title-font-size' determines the font size, in points, | |
529 ;; for the top line of text in the header (similar to `ps-font-size'). | |
528 ;; | 530 ;; |
529 ;; | 531 ;; |
530 ;; Adding a New Font Family | 532 ;; Adding a New Font Family |
531 ;; ------------------------ | 533 ;; ------------------------ |
532 ;; | 534 ;; |
1523 (defcustom ps-font-family 'Courier | 1525 (defcustom ps-font-family 'Courier |
1524 "*Font family name for ordinary text, when generating PostScript." | 1526 "*Font family name for ordinary text, when generating PostScript." |
1525 :type 'symbol | 1527 :type 'symbol |
1526 :group 'ps-print-font) | 1528 :group 'ps-print-font) |
1527 | 1529 |
1528 (defcustom ps-font-size (if ps-landscape-mode 7 8.5) | 1530 (defcustom ps-font-size '(7 . 8.5) |
1529 "*Font size, in points, for ordinary text, when generating PostScript." | 1531 "*Font size, in points, for ordinary text, when generating PostScript." |
1530 :type 'number | 1532 :type '(choice (number :tag "Text Size") |
1533 (cons :tag "Landscape/Portrait" | |
1534 (number :tag "Landscape Text Size") | |
1535 (number :tag "Portrait Text Size"))) | |
1531 :group 'ps-print-font) | 1536 :group 'ps-print-font) |
1532 | 1537 |
1533 (defcustom ps-header-font-family 'Helvetica | 1538 (defcustom ps-header-font-family 'Helvetica |
1534 "*Font family name for text in the header, when generating PostScript." | 1539 "*Font family name for text in the header, when generating PostScript." |
1535 :type 'symbol | 1540 :type 'symbol |
1536 :group 'ps-print-font) | 1541 :group 'ps-print-font) |
1537 | 1542 |
1538 (defcustom ps-header-font-size (if ps-landscape-mode 10 12) | 1543 (defcustom ps-header-font-size '(10 . 12) |
1539 "*Font size, in points, for text in the header, when generating PostScript." | 1544 "*Font size, in points, for text in the header, when generating PostScript." |
1540 :type 'number | 1545 :type '(choice (number :tag "Header Size") |
1546 (cons :tag "Landscape/Portrait" | |
1547 (number :tag "Landscape Header Size") | |
1548 (number :tag "Portrait Header Size"))) | |
1541 :group 'ps-print-font) | 1549 :group 'ps-print-font) |
1542 | 1550 |
1543 (defcustom ps-header-title-font-size (if ps-landscape-mode 12 14) | 1551 (defcustom ps-header-title-font-size '(12 . 14) |
1544 "*Font size, in points, for the top line of text in header, in PostScript." | 1552 "*Font size, in points, for the top line of text in header, in PostScript." |
1545 :type 'number | 1553 :type '(choice (number :tag "Header Title Size") |
1554 (cons :tag "Landscape/Portrait" | |
1555 (number :tag "Landscape Header Title Size") | |
1556 (number :tag "Portrait Header Title Size"))) | |
1546 :group 'ps-print-font) | 1557 :group 'ps-print-font) |
1547 | 1558 |
1548 ;;; Colors | 1559 ;;; Colors |
1549 | 1560 |
1550 ;; Printing color requires x-color-values. | 1561 ;; Printing color requires x-color-values. |
1805 "Return the current PostScript-generation setup." | 1816 "Return the current PostScript-generation setup." |
1806 (format | 1817 (format |
1807 " | 1818 " |
1808 \(setq ps-print-color-p %s | 1819 \(setq ps-print-color-p %s |
1809 ps-lpr-command %S | 1820 ps-lpr-command %S |
1810 ps-lpr-switches %S | 1821 ps-lpr-switches %s |
1811 ps-printer-name %S | 1822 ps-printer-name %S |
1812 | 1823 |
1813 ps-paper-type %S | 1824 ps-paper-type %s |
1814 ps-landscape-mode %s | 1825 ps-landscape-mode %s |
1815 ps-number-of-columns %s | 1826 ps-number-of-columns %s |
1816 | 1827 |
1817 ps-zebra-stripes %s | 1828 ps-zebra-stripes %s |
1818 ps-zebra-stripe-height %s | 1829 ps-zebra-stripe-height %s |
1819 ps-line-number %s | 1830 ps-line-number %s |
1820 | 1831 |
1821 ps-print-control-characters %S | 1832 ps-print-control-characters %s |
1822 | 1833 |
1823 ps-print-background-image %S | 1834 ps-print-background-image %s |
1824 | 1835 |
1825 ps-print-background-text %S | 1836 ps-print-background-text %s |
1826 | 1837 |
1827 ps-print-prologue-header %S | 1838 ps-print-prologue-header %s |
1828 | 1839 |
1829 ps-left-margin %s | 1840 ps-left-margin %s |
1830 ps-right-margin %s | 1841 ps-right-margin %s |
1831 ps-inter-column %s | 1842 ps-inter-column %s |
1832 ps-bottom-margin %s | 1843 ps-bottom-margin %s |
1838 ps-print-header-frame %s | 1849 ps-print-header-frame %s |
1839 ps-header-lines %s | 1850 ps-header-lines %s |
1840 ps-show-n-of-n %s | 1851 ps-show-n-of-n %s |
1841 ps-spool-duplex %s | 1852 ps-spool-duplex %s |
1842 | 1853 |
1843 ps-multibyte-buffer %S | 1854 ps-multibyte-buffer %s |
1844 ps-font-family %S | 1855 ps-font-family %s |
1845 ps-font-size %s | 1856 ps-font-size %s |
1846 ps-header-font-family %S | 1857 ps-header-font-family %s |
1847 ps-header-font-size %s | 1858 ps-header-font-size %s |
1848 ps-header-title-font-size %s) | 1859 ps-header-title-font-size %s) |
1849 " | 1860 " |
1850 ps-print-color-p | 1861 ps-print-color-p |
1851 ps-lpr-command | 1862 ps-lpr-command |
1874 ps-header-lines | 1885 ps-header-lines |
1875 ps-show-n-of-n | 1886 ps-show-n-of-n |
1876 ps-spool-duplex | 1887 ps-spool-duplex |
1877 (ps-print-quote ps-multibyte-buffer) ; see `ps-mule.el' | 1888 (ps-print-quote ps-multibyte-buffer) ; see `ps-mule.el' |
1878 (ps-print-quote ps-font-family) | 1889 (ps-print-quote ps-font-family) |
1879 ps-font-size | 1890 (ps-print-quote ps-font-size) |
1880 (ps-print-quote ps-header-font-family) | 1891 (ps-print-quote ps-header-font-family) |
1881 ps-header-font-size | 1892 (ps-print-quote ps-header-font-size) |
1882 ps-header-title-font-size)) | 1893 (ps-print-quote ps-header-title-font-size))) |
1883 | 1894 |
1884 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1895 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1885 ;; Utility functions and variables: | 1896 ;; Utility functions and variables: |
1886 | 1897 |
1887 (defun ps-print-quote (sym) | 1898 (defun ps-print-quote (sym) |
1888 (and sym | 1899 (cond ((null sym) |
1889 (if (or (symbolp sym) (listp sym)) | 1900 nil) |
1890 (format "'%S" sym) | 1901 ((or (symbolp sym) (listp sym)) |
1902 (format "'%S" sym)) | |
1903 ((stringp sym) | |
1904 (format "%S" sym)) | |
1905 (t | |
1891 sym))) | 1906 sym))) |
1892 | 1907 |
1893 (defvar ps-print-emacs-type | 1908 (defvar ps-print-emacs-type |
1894 (cond ((string-match "XEmacs" emacs-version) 'xemacs) | 1909 (cond ((string-match "XEmacs" emacs-version) 'xemacs) |
1895 ((string-match "Lucid" emacs-version) 'lucid) | 1910 ((string-match "Lucid" emacs-version) 'lucid) |
2312 % ---- save the state of the document (useful for ghostscript!) | 2327 % ---- save the state of the document (useful for ghostscript!) |
2313 /docState save def | 2328 /docState save def |
2314 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7 | 2329 % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7 |
2315 /JackGhostscript where {pop 1 27.7 29.7 div scale}if | 2330 /JackGhostscript where {pop 1 27.7 29.7 div scale}if |
2316 % ---- [andrewi] set PageSize based on chosen dimensions | 2331 % ---- [andrewi] set PageSize based on chosen dimensions |
2317 /setpagedevice where { | 2332 % /setpagedevice where { |
2318 pop | 2333 % pop |
2319 1 dict dup | 2334 % 1 dict dup |
2320 /PageSize [ PrintPageWidth LeftMargin add RightMargin add | 2335 % /PageSize [ PrintPageWidth LeftMargin add RightMargin add |
2321 LandscapePageHeight ] put | 2336 % LandscapePageHeight ] put |
2322 setpagedevice | 2337 % setpagedevice |
2323 }{ | 2338 % }{ |
2324 LandscapeMode { | 2339 LandscapeMode { |
2325 % ---- translate to bottom-right corner of Portrait page | 2340 % ---- translate to bottom-right corner of Portrait page |
2326 LandscapePageHeight 0 translate | 2341 LandscapePageHeight 0 translate |
2327 90 rotate | 2342 90 rotate |
2328 }if | 2343 }if |
2329 }ifelse | 2344 % }ifelse |
2330 /ColumnWidth PrintWidth InterColumn add def | 2345 /ColumnWidth PrintWidth InterColumn add def |
2331 % ---- translate to lower left corner of TEXT | 2346 % ---- translate to lower left corner of TEXT |
2332 LeftMargin BottomMargin translate | 2347 LeftMargin BottomMargin translate |
2333 % ---- define where printing will start | 2348 % ---- define where printing will start |
2334 /f0 F % this installs Ascent | 2349 /f0 F % this installs Ascent |
2617 | 2632 |
2618 (defvar ps-height-remaining nil) | 2633 (defvar ps-height-remaining nil) |
2619 (defvar ps-width-remaining nil) | 2634 (defvar ps-width-remaining nil) |
2620 | 2635 |
2621 (defvar ps-print-color-scale nil) | 2636 (defvar ps-print-color-scale nil) |
2637 | |
2638 (defvar ps-font-size-internal nil) | |
2639 (defvar ps-header-font-size-internal nil) | |
2640 (defvar ps-header-title-font-size-internal nil) | |
2622 | 2641 |
2623 | 2642 |
2624 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2643 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2625 ;; Internal Variables | 2644 ;; Internal Variables |
2626 | 2645 |
2890 (defun ps-line-lengths-internal () | 2909 (defun ps-line-lengths-internal () |
2891 "Display the correspondence between a line length and a font size, | 2910 "Display the correspondence between a line length and a font size, |
2892 using the current ps-print setup. | 2911 using the current ps-print setup. |
2893 Try: pr -t file | awk '{printf \"%3d %s\n\", length($0), $0}' | sort -r | head" | 2912 Try: pr -t file | awk '{printf \"%3d %s\n\", length($0), $0}' | sort -r | head" |
2894 (let ((buf (get-buffer-create "*Line-lengths*")) | 2913 (let ((buf (get-buffer-create "*Line-lengths*")) |
2895 (ifs ps-font-size) ; initial font size | 2914 (ifs ps-font-size-internal) ; initial font size |
2896 (icw (ps-avg-char-width 'ps-font-for-text)) ; initial character width | 2915 (icw (ps-avg-char-width 'ps-font-for-text)) ; initial character width |
2897 (print-width (progn (ps-get-page-dimensions) | 2916 (print-width (progn (ps-get-page-dimensions) |
2898 ps-print-width)) | 2917 ps-print-width)) |
2899 (ps-setup (ps-setup)) ; setup for the current buffer | 2918 (ps-setup (ps-setup)) ; setup for the current buffer |
2900 (fs-min 5) ; minimum font size | 2919 (fs-min 5) ; minimum font size |
2928 (defun ps-nb-pages (nb-lines) | 2947 (defun ps-nb-pages (nb-lines) |
2929 "Display correspondence between font size and the number of pages. | 2948 "Display correspondence between font size and the number of pages. |
2930 The correspondence is based on having NB-LINES lines of text, | 2949 The correspondence is based on having NB-LINES lines of text, |
2931 and on the current ps-print setup." | 2950 and on the current ps-print setup." |
2932 (let ((buf (get-buffer-create "*Nb-Pages*")) | 2951 (let ((buf (get-buffer-create "*Nb-Pages*")) |
2933 (ifs ps-font-size) ; initial font size | 2952 (ifs ps-font-size-internal) ; initial font size |
2934 (ilh (ps-line-height 'ps-font-for-text)) ; initial line height | 2953 (ilh (ps-line-height 'ps-font-for-text)) ; initial line height |
2935 (page-height (progn (ps-get-page-dimensions) | 2954 (page-height (progn (ps-get-page-dimensions) |
2936 ps-print-height)) | 2955 ps-print-height)) |
2937 (ps-setup (ps-setup)) ; setup for the current buffer | 2956 (ps-setup (ps-setup)) ; setup for the current buffer |
2938 (fs-min 4) ; minimum font size | 2957 (fs-min 4) ; minimum font size |
2998 ((< ps-number-of-columns 1) | 3017 ((< ps-number-of-columns 1) |
2999 (error "The number of columns %d should be positive" | 3018 (error "The number of columns %d should be positive" |
3000 ps-number-of-columns))) | 3019 ps-number-of-columns))) |
3001 | 3020 |
3002 (ps-select-font ps-font-family 'ps-font-for-text | 3021 (ps-select-font ps-font-family 'ps-font-for-text |
3003 ps-font-size ps-font-size) | 3022 ps-font-size-internal ps-font-size-internal) |
3004 (ps-select-font ps-header-font-family 'ps-font-for-header | 3023 (ps-select-font ps-header-font-family 'ps-font-for-header |
3005 ps-header-font-size ps-header-title-font-size) | 3024 ps-header-font-size-internal |
3025 ps-header-title-font-size-internal) | |
3006 | 3026 |
3007 (setq page-width (ps-page-dimensions-get-width page-dimensions) | 3027 (setq page-width (ps-page-dimensions-get-width page-dimensions) |
3008 page-height (ps-page-dimensions-get-height page-dimensions)) | 3028 page-height (ps-page-dimensions-get-height page-dimensions)) |
3009 | 3029 |
3010 ;; Landscape mode | 3030 ;; Landscape mode |
3479 (ps-output-list ps-background-all-pages) | 3499 (ps-output-list ps-background-all-pages) |
3480 (ps-output "} def\n/printLocalBackground {\n} def\n") | 3500 (ps-output "} def\n/printLocalBackground {\n} def\n") |
3481 | 3501 |
3482 ;; Header fonts | 3502 ;; Header fonts |
3483 (ps-output (format "/h0 %s (%s) cvn DefFont\n" ; /h0 14 /Helvetica-Bold DefFont | 3503 (ps-output (format "/h0 %s (%s) cvn DefFont\n" ; /h0 14 /Helvetica-Bold DefFont |
3484 ps-header-title-font-size (ps-font 'ps-font-for-header | 3504 ps-header-title-font-size-internal |
3485 'bold)) | 3505 (ps-font 'ps-font-for-header 'bold)) |
3486 (format "/h1 %s (%s) cvn DefFont\n" ; /h1 12 /Helvetica DefFont | 3506 (format "/h1 %s (%s) cvn DefFont\n" ; /h1 12 /Helvetica DefFont |
3487 ps-header-font-size (ps-font 'ps-font-for-header | 3507 ps-header-font-size-internal |
3488 'normal))) | 3508 (ps-font 'ps-font-for-header 'normal))) |
3489 | 3509 |
3490 (ps-output ps-print-prologue-2) | 3510 (ps-output ps-print-prologue-2) |
3491 | 3511 |
3492 ;; Text fonts | 3512 ;; Text fonts |
3493 (let ((font (ps-font-alist 'ps-font-for-text)) | 3513 (let ((font (ps-font-alist 'ps-font-for-text)) |
3494 (i 0)) | 3514 (i 0)) |
3495 (while font | 3515 (while font |
3496 (ps-output (format "/f%d %s (%s) cvn DefFont\n" | 3516 (ps-output (format "/f%d %s (%s) cvn DefFont\n" |
3497 i | 3517 i |
3498 ps-font-size | 3518 ps-font-size-internal |
3499 (ps-font 'ps-font-for-text (car (car font))))) | 3519 (ps-font 'ps-font-for-text (car (car font))))) |
3500 (setq font (cdr font) | 3520 (setq font (cdr font) |
3501 i (1+ i)))) | 3521 i (1+ i)))) |
3502 | 3522 |
3503 (let ((font-entry (cdr (assq ps-font-family ps-font-info-database)))) | 3523 (let ((font-entry (cdr (assq ps-font-family ps-font-info-database)))) |
3525 (t (concat | 3545 (t (concat |
3526 (and ps-printing-region "Subset of: ") | 3546 (and ps-printing-region "Subset of: ") |
3527 (buffer-name) | 3547 (buffer-name) |
3528 (and (buffer-modified-p) " (unsaved)"))))) | 3548 (and (buffer-modified-p) " (unsaved)"))))) |
3529 | 3549 |
3550 | |
3551 (defun ps-get-font-size (font-sym) | |
3552 (let ((font-size (symbol-value font-sym))) | |
3553 (cond ((numberp font-size) | |
3554 font-size) | |
3555 ((and (consp font-size) | |
3556 (numberp (car font-size)) | |
3557 (numberp (cdr font-size))) | |
3558 (if ps-landscape-mode | |
3559 (car font-size) | |
3560 (cdr font-size))) | |
3561 (t | |
3562 (error "Invalid font size `%S' for `%S'" font-size font-sym))))) | |
3563 | |
3564 | |
3530 (defun ps-begin-job () | 3565 (defun ps-begin-job () |
3531 (save-excursion | 3566 (save-excursion |
3532 (set-buffer ps-spool-buffer) | 3567 (set-buffer ps-spool-buffer) |
3533 (goto-char (point-max)) | 3568 (goto-char (point-max)) |
3534 (and (re-search-backward "^%%Trailer$" nil t) | 3569 (and (re-search-backward "^%%Trailer$" nil t) |
3535 (delete-region (match-beginning 0) (point-max)))) | 3570 (delete-region (match-beginning 0) (point-max)))) |
3536 (setq ps-showline-count (if ps-printing-region (car ps-printing-region) 1) | 3571 (setq ps-showline-count (if ps-printing-region (car ps-printing-region) 1) |
3537 ps-page-count 0 | 3572 ps-page-count 0 |
3573 ps-font-size-internal (ps-get-font-size 'ps-font-size) | |
3574 ps-header-font-size-internal (ps-get-font-size 'ps-header-font-size) | |
3575 ps-header-title-font-size-internal | |
3576 (ps-get-font-size 'ps-header-title-font-size) | |
3538 ps-control-or-escape-regexp | 3577 ps-control-or-escape-regexp |
3539 (cond ((eq ps-print-control-characters '8-bit) | 3578 (cond ((eq ps-print-control-characters '8-bit) |
3540 (string-as-unibyte "[\000-\037\177-\377]")) | 3579 (string-as-unibyte "[\000-\037\177-\377]")) |
3541 ((eq ps-print-control-characters 'control-8-bit) | 3580 ((eq ps-print-control-characters 'control-8-bit) |
3542 (string-as-unibyte "[\000-\037\177-\237]")) | 3581 (string-as-unibyte "[\000-\037\177-\237]")) |
4167 (goto-char (point-min)) | 4206 (goto-char (point-min)) |
4168 (or (looking-at (regexp-quote ps-adobe-tag)) | 4207 (or (looking-at (regexp-quote ps-adobe-tag)) |
4169 (setq needs-begin-file t)) | 4208 (setq needs-begin-file t)) |
4170 (save-excursion | 4209 (save-excursion |
4171 (set-buffer ps-source-buffer) | 4210 (set-buffer ps-source-buffer) |
4211 (ps-begin-job) | |
4172 (when needs-begin-file | 4212 (when needs-begin-file |
4173 (ps-begin-file) | 4213 (ps-begin-file) |
4174 (ps-mule-initialize)) | 4214 (ps-mule-initialize)) |
4175 (ps-begin-job) | |
4176 (ps-mule-begin-job from to) | 4215 (ps-mule-begin-job from to) |
4177 (ps-begin-page)) | 4216 (ps-begin-page)) |
4178 (set-buffer ps-source-buffer) | 4217 (set-buffer ps-source-buffer) |
4179 (funcall genfunc from to) | 4218 (funcall genfunc from to) |
4180 (ps-end-page) | 4219 (ps-end-page) |
4210 (progn | 4249 (progn |
4211 (set-buffer ps-spool-buffer) | 4250 (set-buffer ps-spool-buffer) |
4212 (delete-region (marker-position safe-marker) (point-max)))))) | 4251 (delete-region (marker-position safe-marker) (point-max)))))) |
4213 | 4252 |
4214 (and ps-razzle-dazzle (message "Formatting...done")))))) | 4253 (and ps-razzle-dazzle (message "Formatting...done")))))) |
4254 | |
4255 | |
4256 ;; to avoid compilation gripes. | |
4257 (defvar dos-ps-printer nil) | |
4215 | 4258 |
4216 | 4259 |
4217 ;; Permit dynamic evaluation at print time of `ps-lpr-switches'. | 4260 ;; Permit dynamic evaluation at print time of `ps-lpr-switches'. |
4218 (defun ps-do-despool (filename) | 4261 (defun ps-do-despool (filename) |
4219 (if (or (not (boundp 'ps-spool-buffer)) | 4262 (if (or (not (boundp 'ps-spool-buffer)) |