diff options
| author | Gerd Moellmann | 2000-10-19 10:46:51 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-19 10:46:51 +0000 |
| commit | 3e9cb08f58cd78f8478bd8b8aabb027f0c857a21 (patch) | |
| tree | 93d29cb7855d5eb77de598138681727455b3fc57 | |
| parent | 13ab33c43bdde64caaf0b167b9fc80b89cd44041 (diff) | |
| download | emacs-3e9cb08f58cd78f8478bd8b8aabb027f0c857a21.tar.gz emacs-3e9cb08f58cd78f8478bd8b8aabb027f0c857a21.zip | |
Even/odd pages fix. Fix little bug on XEmacs. Avoid
compilation gripes. Doc fix.
(ps-print-version): New version number (6.2).
(ps-x-color-instance-p, ps-x-color-instance-rgb-components)
(ps-x-color-name, ps-x-color-specifier-p, ps-x-copy-coding-system)
(ps-x-device-class, ps-x-extent-end-position, ps-x-extent-face)
(ps-x-extent-priority, ps-x-extent-start-position)
(ps-x-face-font-instance, ps-x-find-coding-system)
(ps-x-font-instance-properties, ps-x-make-color-instance)
(ps-x-map-extents): Alias for functions without the prefix `ps-x-', to
avoid compilation gripes without defining functions.
(ps-e-find-composition): Alias for function find-composition, to have a
suitable function depending on Emacs version.
(ps-color-device, ps-color-values, ps-face-foreground-name)
(ps-face-background-name, ps-face-bold-p, ps-face-italic-p, ps-mapper)
(ps-extent-sorter, ps-xemacs-face-kind-p, ps-xemacs-color-name)
(ps-print-ensure-fontified): Function definitions surrounded by
`eval-and-compile' to avoid compilation gripes.
(ps-font-lock-face-attributes): `font-lock-face-attributes' evaluated
by symbol-value to avoid compilation gripes.
(ps-end-file, ps-header-sheet, ps-plot-region): Even/odd pages fix.
(ps-generate-postscript-with-faces): Fix little bug on XEmacs.
| -rw-r--r-- | lisp/ChangeLog | 25 | ||||
| -rw-r--r-- | lisp/ps-print.el | 347 |
2 files changed, 197 insertions, 175 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1539e0df30f..2272474cb54 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,28 @@ | |||
| 1 | 2000-10-19 Vinicius Jose Latorre <vinicius@cpqd.com.br> | ||
| 2 | |||
| 3 | * ps-print.el: Even/odd pages fix. Fix little bug on XEmacs. Avoid | ||
| 4 | compilation gripes. Doc fix. | ||
| 5 | (ps-print-version): New version number (6.2). | ||
| 6 | (ps-x-color-instance-p, ps-x-color-instance-rgb-components) | ||
| 7 | (ps-x-color-name, ps-x-color-specifier-p, ps-x-copy-coding-system) | ||
| 8 | (ps-x-device-class, ps-x-extent-end-position, ps-x-extent-face) | ||
| 9 | (ps-x-extent-priority, ps-x-extent-start-position) | ||
| 10 | (ps-x-face-font-instance, ps-x-find-coding-system) | ||
| 11 | (ps-x-font-instance-properties, ps-x-make-color-instance) | ||
| 12 | (ps-x-map-extents): Alias for functions without the prefix `ps-x-', to | ||
| 13 | avoid compilation gripes without defining functions. | ||
| 14 | (ps-e-find-composition): Alias for function find-composition, to have a | ||
| 15 | suitable function depending on Emacs version. | ||
| 16 | (ps-color-device, ps-color-values, ps-face-foreground-name) | ||
| 17 | (ps-face-background-name, ps-face-bold-p, ps-face-italic-p, ps-mapper) | ||
| 18 | (ps-extent-sorter, ps-xemacs-face-kind-p, ps-xemacs-color-name) | ||
| 19 | (ps-print-ensure-fontified): Function definitions surrounded by | ||
| 20 | `eval-and-compile' to avoid compilation gripes. | ||
| 21 | (ps-font-lock-face-attributes): `font-lock-face-attributes' evaluated | ||
| 22 | by symbol-value to avoid compilation gripes. | ||
| 23 | (ps-end-file, ps-header-sheet, ps-plot-region): Even/odd pages fix. | ||
| 24 | (ps-generate-postscript-with-faces): Fix little bug on XEmacs. | ||
| 25 | |||
| 1 | 2000-10-19 Miles Bader <miles@lsi.nec.co.jp> | 26 | 2000-10-19 Miles Bader <miles@lsi.nec.co.jp> |
| 2 | 27 | ||
| 3 | * startup.el (normal-top-level): Call `frame-set-background-mode' | 28 | * startup.el (normal-top-level): Call `frame-set-background-mode' |
diff --git a/lisp/ps-print.el b/lisp/ps-print.el index 03112b4d0f8..0e88614c847 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el | |||
| @@ -9,12 +9,12 @@ | |||
| 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: wp, print, PostScript | 11 | ;; Keywords: wp, print, PostScript |
| 12 | ;; Time-stamp: <2000/10/10 14:04:29 vinicius> | 12 | ;; Time-stamp: <2000/10/18 18:31:37 vinicius> |
| 13 | ;; Version: 6.1 | 13 | ;; Version: 6.2 |
| 14 | ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ | 14 | ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
| 15 | 15 | ||
| 16 | (defconst ps-print-version "6.1" | 16 | (defconst ps-print-version "6.2" |
| 17 | "ps-print.el, v 6.1 <2000/10/10 vinicius> | 17 | "ps-print.el, v 6.2 <2000/10/18 vinicius> |
| 18 | 18 | ||
| 19 | Vinicius's last change version -- this file may have been edited as part of | 19 | Vinicius's last change version -- this file may have been edited as part of |
| 20 | Emacs without changes to the version number. When reporting bugs, please also | 20 | Emacs without changes to the version number. When reporting bugs, please also |
| @@ -1335,26 +1335,28 @@ Please send all bug fixes and enhancements to | |||
| 1335 | 1335 | ||
| 1336 | 1336 | ||
| 1337 | ;; to avoid compilation gripes | 1337 | ;; to avoid compilation gripes |
| 1338 | (eval-and-compile | 1338 | |
| 1339 | (mapcar #'(lambda (sym) | 1339 | ;; XEmacs |
| 1340 | (or (fboundp sym) | 1340 | (defalias 'ps-x-color-instance-p 'color-instance-p) |
| 1341 | (defalias sym 'ignore))) | 1341 | (defalias 'ps-x-color-instance-rgb-components 'color-instance-rgb-components) |
| 1342 | '(;; XEmacs | 1342 | (defalias 'ps-x-color-name 'color-name) |
| 1343 | color-instance-p | 1343 | (defalias 'ps-x-color-specifier-p 'color-specifier-p) |
| 1344 | color-instance-rgb-components | 1344 | (defalias 'ps-x-copy-coding-system 'copy-coding-system) |
| 1345 | color-name | 1345 | (defalias 'ps-x-device-class 'device-class) |
| 1346 | color-specifier-p | 1346 | (defalias 'ps-x-extent-end-position 'extent-end-position) |
| 1347 | copy-coding-system | 1347 | (defalias 'ps-x-extent-face 'extent-face) |
| 1348 | device-class | 1348 | (defalias 'ps-x-extent-priority 'extent-priority) |
| 1349 | extent-end-position | 1349 | (defalias 'ps-x-extent-start-position 'extent-start-position) |
| 1350 | extent-face | 1350 | (defalias 'ps-x-face-font-instance 'face-font-instance) |
| 1351 | extent-priority | 1351 | (defalias 'ps-x-find-coding-system 'find-coding-system) |
| 1352 | extent-start-position | 1352 | (defalias 'ps-x-font-instance-properties 'font-instance-properties) |
| 1353 | face-font-instance | 1353 | (defalias 'ps-x-make-color-instance 'make-color-instance) |
| 1354 | find-coding-system | 1354 | (defalias 'ps-x-map-extents 'map-extents) |
| 1355 | font-instance-properties | 1355 | |
| 1356 | make-color-instance | 1356 | ;; GNU Emacs |
| 1357 | map-extents))) | 1357 | (if (fboundp 'find-composition) |
| 1358 | (defalias 'ps-e-find-composition 'find-composition) | ||
| 1359 | (defalias 'ps-e-find-composition 'ignore)) | ||
| 1358 | 1360 | ||
| 1359 | 1361 | ||
| 1360 | (defconst ps-windows-system | 1362 | (defconst ps-windows-system |
| @@ -2893,6 +2895,7 @@ The table depends on the current ps-print setup." | |||
| 2893 | (t | 2895 | (t |
| 2894 | sym))) | 2896 | sym))) |
| 2895 | 2897 | ||
| 2898 | |||
| 2896 | (defvar ps-print-emacs-type | 2899 | (defvar ps-print-emacs-type |
| 2897 | (cond ((string-match "XEmacs" emacs-version) 'xemacs) | 2900 | (cond ((string-match "XEmacs" emacs-version) 'xemacs) |
| 2898 | ((string-match "Lucid" emacs-version) 'lucid) | 2901 | ((string-match "Lucid" emacs-version) 'lucid) |
| @@ -2905,19 +2908,112 @@ The table depends on the current ps-print setup." | |||
| 2905 | (require 'faces)) ; face-font, face-underline-p, | 2908 | (require 'faces)) ; face-font, face-underline-p, |
| 2906 | ; x-font-regexp | 2909 | ; x-font-regexp |
| 2907 | 2910 | ||
| 2908 | ;; Return t if the device (which can be changed during an emacs session) | ||
| 2909 | ;; can handle colors. | ||
| 2910 | ;; This is function is not yet implemented for GNU emacs. | ||
| 2911 | (cond ((and (eq ps-print-emacs-type 'xemacs) | ||
| 2912 | (>= emacs-minor-version 12)) ; xemacs | ||
| 2913 | (defun ps-color-device () | ||
| 2914 | (eq (device-class) 'color)) | ||
| 2915 | ) | ||
| 2916 | 2911 | ||
| 2917 | (t ; emacs | 2912 | (eval-and-compile |
| 2918 | (defun ps-color-device () | 2913 | ;; Return t if the device (which can be changed during an emacs session) |
| 2919 | t) | 2914 | ;; can handle colors. |
| 2920 | )) | 2915 | ;; This is function is not yet implemented for GNU emacs. |
| 2916 | (cond ((and (eq ps-print-emacs-type 'xemacs) | ||
| 2917 | (>= emacs-minor-version 12)) ; xemacs | ||
| 2918 | (defun ps-color-device () | ||
| 2919 | (eq (ps-x-device-class) 'color)) | ||
| 2920 | ) | ||
| 2921 | |||
| 2922 | (t ; emacs | ||
| 2923 | (defun ps-color-device () | ||
| 2924 | t) | ||
| 2925 | )) | ||
| 2926 | |||
| 2927 | (cond ((eq ps-print-emacs-type 'emacs) ; emacs | ||
| 2928 | |||
| 2929 | (defun ps-color-values (x-color) | ||
| 2930 | (if (fboundp 'x-color-values) | ||
| 2931 | (x-color-values x-color) | ||
| 2932 | (error "No available function to determine X color values."))) | ||
| 2933 | |||
| 2934 | (defalias 'ps-face-foreground-name 'face-foreground) | ||
| 2935 | (defalias 'ps-face-background-name 'face-background) | ||
| 2936 | |||
| 2937 | (defun ps-face-bold-p (face) | ||
| 2938 | (or (face-bold-p face) | ||
| 2939 | (memq face ps-bold-faces))) | ||
| 2940 | |||
| 2941 | (defun ps-face-italic-p (face) | ||
| 2942 | (or (face-italic-p face) | ||
| 2943 | (memq face ps-italic-faces))) | ||
| 2944 | ) | ||
| 2945 | ; xemacs | ||
| 2946 | ; lucid | ||
| 2947 | (t ; epoch | ||
| 2948 | |||
| 2949 | (or (ps-x-find-coding-system 'raw-text-unix) | ||
| 2950 | (ps-x-copy-coding-system 'no-conversion-unix 'raw-text-unix)) | ||
| 2951 | |||
| 2952 | (defun ps-mapper (extent list) | ||
| 2953 | (nconc list | ||
| 2954 | (list (list (ps-x-extent-start-position extent) 'push extent) | ||
| 2955 | (list (ps-x-extent-end-position extent) 'pull extent))) | ||
| 2956 | nil) | ||
| 2957 | |||
| 2958 | (defun ps-extent-sorter (a b) | ||
| 2959 | (< (ps-x-extent-priority a) (ps-x-extent-priority b))) | ||
| 2960 | |||
| 2961 | (defun ps-xemacs-face-kind-p (face kind kind-regex) | ||
| 2962 | (let* ((frame-font (or (ps-x-face-font-instance face) | ||
| 2963 | (ps-x-face-font-instance 'default))) | ||
| 2964 | (kind-cons | ||
| 2965 | (and frame-font | ||
| 2966 | (assq kind | ||
| 2967 | (ps-x-font-instance-properties frame-font)))) | ||
| 2968 | (kind-spec (cdr-safe kind-cons)) | ||
| 2969 | (case-fold-search t)) | ||
| 2970 | (and kind-spec (string-match kind-regex kind-spec)))) | ||
| 2971 | |||
| 2972 | (defun ps-xemacs-color-name (color) | ||
| 2973 | (if (ps-x-color-specifier-p color) | ||
| 2974 | (ps-x-color-name color) | ||
| 2975 | color)) | ||
| 2976 | |||
| 2977 | (defun ps-color-values (x-color) | ||
| 2978 | (let ((color (ps-xemacs-color-name x-color))) | ||
| 2979 | (cond | ||
| 2980 | ((fboundp 'x-color-values) | ||
| 2981 | (x-color-values color)) | ||
| 2982 | ((and (fboundp 'color-instance-rgb-components) | ||
| 2983 | (ps-color-device)) | ||
| 2984 | (ps-x-color-instance-rgb-components | ||
| 2985 | (if (ps-x-color-instance-p x-color) | ||
| 2986 | x-color | ||
| 2987 | (ps-x-make-color-instance color)))) | ||
| 2988 | (t | ||
| 2989 | (error "No available function to determine X color values."))))) | ||
| 2990 | |||
| 2991 | (defun ps-face-foreground-name (face) | ||
| 2992 | (ps-xemacs-color-name (face-foreground face))) | ||
| 2993 | |||
| 2994 | (defun ps-face-background-name (face) | ||
| 2995 | (ps-xemacs-color-name (face-background face))) | ||
| 2996 | |||
| 2997 | (defun ps-face-bold-p (face) | ||
| 2998 | (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold") | ||
| 2999 | (memq face ps-bold-faces))) ; Kludge-compatible | ||
| 3000 | |||
| 3001 | (defun ps-face-italic-p (face) | ||
| 3002 | (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o") | ||
| 3003 | (ps-xemacs-face-kind-p face 'SLANT "i\\|o") | ||
| 3004 | (memq face ps-italic-faces))) ; Kludge-compatible | ||
| 3005 | ))) | ||
| 3006 | |||
| 3007 | |||
| 3008 | (defun ps-color-scale (color) | ||
| 3009 | ;; Scale 16-bit X-COLOR-VALUE to PostScript color value in [0, 1] interval. | ||
| 3010 | (mapcar #'(lambda (value) (/ value ps-print-color-scale)) | ||
| 3011 | (ps-color-values color))) | ||
| 3012 | |||
| 3013 | |||
| 3014 | (defun ps-face-underlined-p (face) | ||
| 3015 | (or (face-underline-p face) | ||
| 3016 | (memq face ps-underlined-faces))) | ||
| 2921 | 3017 | ||
| 2922 | 3018 | ||
| 2923 | (require 'time-stamp) | 3019 | (require 'time-stamp) |
| @@ -3154,7 +3250,7 @@ If EXTENSION is any other symbol, it is ignored." | |||
| 3154 | (defun ps-font-lock-face-attributes () | 3250 | (defun ps-font-lock-face-attributes () |
| 3155 | (and (boundp 'font-lock-mode) (symbol-value 'font-lock-mode) | 3251 | (and (boundp 'font-lock-mode) (symbol-value 'font-lock-mode) |
| 3156 | (boundp 'font-lock-face-attributes) | 3252 | (boundp 'font-lock-face-attributes) |
| 3157 | (let ((face-attributes font-lock-face-attributes)) | 3253 | (let ((face-attributes (symbol-value 'font-lock-face-attributes))) |
| 3158 | (while face-attributes | 3254 | (while face-attributes |
| 3159 | (let* ((face-attribute | 3255 | (let* ((face-attribute |
| 3160 | (car (prog1 face-attributes | 3256 | (car (prog1 face-attributes |
| @@ -4642,30 +4738,32 @@ XSTART YSTART are the relative position for the first page in a sheet.") | |||
| 4642 | `(1+ (/ (1- ps-page-count) ps-number-of-columns))) | 4738 | `(1+ (/ (1- ps-page-count) ps-number-of-columns))) |
| 4643 | 4739 | ||
| 4644 | (defun ps-end-file (needs-begin-file) | 4740 | (defun ps-end-file (needs-begin-file) |
| 4645 | (ps-flush-output) | 4741 | (let (ps-even-or-odd-pages) |
| 4646 | ;; Back to the PS output buffer to set the last page n-up printing | 4742 | (ps-flush-output) |
| 4647 | (save-excursion | 4743 | ;; Back to the PS output buffer to set the last page n-up printing |
| 4648 | (let ((pages-per-sheet (mod ps-page-postscript ps-n-up-printing)) | 4744 | (save-excursion |
| 4649 | case-fold-search) | 4745 | (let ((pages-per-sheet (mod ps-page-postscript ps-n-up-printing)) |
| 4650 | (set-buffer ps-spool-buffer) | 4746 | case-fold-search) |
| 4651 | (goto-char (point-max)) | 4747 | (set-buffer ps-spool-buffer) |
| 4652 | (and (> pages-per-sheet 0) | 4748 | (goto-char (point-max)) |
| 4653 | (re-search-backward "^[0-9]+ BeginSheet$" nil t) | 4749 | (and (> pages-per-sheet 0) |
| 4654 | (replace-match (format "%d BeginSheet" pages-per-sheet) t)))) | 4750 | (re-search-backward "^[0-9]+ BeginSheet$" nil t) |
| 4655 | ;; Set dummy page | 4751 | (replace-match (format "%d BeginSheet" pages-per-sheet) t)))) |
| 4656 | (and ps-spool-duplex (= (mod ps-page-order 2) 1) | 4752 | ;; Set dummy page |
| 4657 | (let (ps-first-page) | 4753 | (and ps-spool-duplex (= (mod ps-page-order 2) 1) |
| 4658 | (ps-dummy-page))) | 4754 | (let (ps-first-page) |
| 4659 | ;; Set end of PostScript file | 4755 | (ps-dummy-page))) |
| 4660 | (or ps-first-page | 4756 | ;; Set end of PostScript file |
| 4661 | (ps-output "EndSheet\n")) | 4757 | (or ps-first-page |
| 4662 | (setq ps-first-page nil) ; disable selected pages | 4758 | (ps-output "EndSheet\n")) |
| 4663 | (ps-output "\n%%Trailer\n%%Pages: " | 4759 | (setq ps-first-page nil) ; disable selected pages |
| 4664 | (format "%d" | 4760 | (ps-output "\n%%Trailer\n%%Pages: " |
| 4665 | (if (and needs-begin-file ps-banner-page-when-duplexing) | 4761 | (format "%d" |
| 4666 | (1+ ps-page-order) | 4762 | (if (and needs-begin-file |
| 4667 | ps-page-order)) | 4763 | ps-banner-page-when-duplexing) |
| 4668 | "\n\nEndDoc\n\n%%EOF\n")) | 4764 | (1+ ps-page-order) |
| 4765 | ps-page-order)) | ||
| 4766 | "\n\nEndDoc\n\n%%EOF\n"))) | ||
| 4669 | 4767 | ||
| 4670 | 4768 | ||
| 4671 | (defun ps-next-page () | 4769 | (defun ps-next-page () |
| @@ -4680,7 +4778,7 @@ XSTART YSTART are the relative position for the first page in a sheet.") | |||
| 4680 | (setq ps-page-postscript (1+ ps-page-postscript)) | 4778 | (setq ps-page-postscript (1+ ps-page-postscript)) |
| 4681 | (cond ((ps-print-page-p) | 4779 | (cond ((ps-print-page-p) |
| 4682 | (setq ps-page-order (1+ ps-page-order)) | 4780 | (setq ps-page-order (1+ ps-page-order)) |
| 4683 | (and print-posterior (> ps-page-order 1) | 4781 | (and (or print-posterior ps-even-or-odd-pages) (> ps-page-order 1) |
| 4684 | (ps-output "EndSheet\n")) | 4782 | (ps-output "EndSheet\n")) |
| 4685 | (ps-output (if ps-n-up-on | 4783 | (ps-output (if ps-n-up-on |
| 4686 | (format "\n%%%%Page: (%d \\(%d\\)) %d\n" | 4784 | (format "\n%%%%Page: (%d \\(%d\\)) %d\n" |
| @@ -4873,7 +4971,7 @@ EndDSCPage\n") | |||
| 4873 | ;; region with some control characters or some multi-byte characters | 4971 | ;; region with some control characters or some multi-byte characters |
| 4874 | (let* ((match-point (match-beginning 0)) | 4972 | (let* ((match-point (match-beginning 0)) |
| 4875 | (match (char-after match-point)) | 4973 | (match (char-after match-point)) |
| 4876 | (composition (find-composition from (1+ match-point)))) | 4974 | (composition (ps-e-find-composition from (1+ match-point)))) |
| 4877 | (if composition | 4975 | (if composition |
| 4878 | (if (and (nth 2 composition) | 4976 | (if (and (nth 2 composition) |
| 4879 | (<= (car composition) match-point)) | 4977 | (<= (car composition) match-point)) |
| @@ -4911,7 +5009,7 @@ EndDSCPage\n") | |||
| 4911 | 5009 | ||
| 4912 | ((> match 255) ; a multi-byte character | 5010 | ((> match 255) ; a multi-byte character |
| 4913 | (let* ((charset (char-charset match)) | 5011 | (let* ((charset (char-charset match)) |
| 4914 | (composition (find-composition match-point to)) | 5012 | (composition (ps-e-find-composition match-point to)) |
| 4915 | (stop (if (nth 2 composition) (car composition) to))) | 5013 | (stop (if (nth 2 composition) (car composition) to))) |
| 4916 | (or (eq charset 'composition) | 5014 | (or (eq charset 'composition) |
| 4917 | (while (and (< (point) stop) (eq (charset-after) charset)) | 5015 | (while (and (< (point) stop) (eq (charset-after) charset)) |
| @@ -4959,47 +5057,6 @@ EndDSCPage\n") | |||
| 4959 | (ps-output-string str) | 5057 | (ps-output-string str) |
| 4960 | (ps-output " S\n"))) | 5058 | (ps-output " S\n"))) |
| 4961 | 5059 | ||
| 4962 | (defun ps-color-scale (color) | ||
| 4963 | ;; Scale 16-bit X-COLOR-VALUE to PostScript color value in [0, 1] interval. | ||
| 4964 | (mapcar #'(lambda (value) (/ value ps-print-color-scale)) | ||
| 4965 | (ps-color-values color))) | ||
| 4966 | |||
| 4967 | |||
| 4968 | (defun ps-xemacs-color-name (color) | ||
| 4969 | (if (color-specifier-p color) | ||
| 4970 | (color-name color) | ||
| 4971 | color)) | ||
| 4972 | |||
| 4973 | |||
| 4974 | (cond ((eq ps-print-emacs-type 'emacs) ; emacs | ||
| 4975 | |||
| 4976 | (defun ps-color-values (x-color) | ||
| 4977 | (if (fboundp 'x-color-values) | ||
| 4978 | (x-color-values x-color) | ||
| 4979 | (error "No available function to determine X color values."))) | ||
| 4980 | ) | ||
| 4981 | ; xemacs | ||
| 4982 | ; lucid | ||
| 4983 | (t ; epoch | ||
| 4984 | |||
| 4985 | (or (find-coding-system 'raw-text-unix) | ||
| 4986 | (copy-coding-system 'no-conversion-unix 'raw-text-unix)) | ||
| 4987 | |||
| 4988 | (defun ps-color-values (x-color) | ||
| 4989 | (let ((color (ps-xemacs-color-name x-color))) | ||
| 4990 | (cond | ||
| 4991 | ((fboundp 'x-color-values) | ||
| 4992 | (x-color-values color)) | ||
| 4993 | ((and (fboundp 'color-instance-rgb-components) | ||
| 4994 | (ps-color-device)) | ||
| 4995 | (color-instance-rgb-components | ||
| 4996 | (if (color-instance-p x-color) | ||
| 4997 | x-color | ||
| 4998 | (make-color-instance color)))) | ||
| 4999 | (t | ||
| 5000 | (error "No available function to determine X color values."))))) | ||
| 5001 | )) | ||
| 5002 | |||
| 5003 | 5060 | ||
| 5004 | (defun ps-face-attributes (face) | 5061 | (defun ps-face-attributes (face) |
| 5005 | "Return face attribute vector. | 5062 | "Return face attribute vector. |
| @@ -5102,55 +5159,6 @@ If FACE is not a valid face name, it is used default face." | |||
| 5102 | (goto-char to)) | 5159 | (goto-char to)) |
| 5103 | 5160 | ||
| 5104 | 5161 | ||
| 5105 | (defun ps-xemacs-face-kind-p (face kind kind-regex) | ||
| 5106 | (let* ((frame-font (or (face-font-instance face) | ||
| 5107 | (face-font-instance 'default))) | ||
| 5108 | (kind-cons (and frame-font | ||
| 5109 | (assq kind | ||
| 5110 | (font-instance-properties frame-font)))) | ||
| 5111 | (kind-spec (cdr-safe kind-cons)) | ||
| 5112 | (case-fold-search t)) | ||
| 5113 | (and kind-spec (string-match kind-regex kind-spec)))) | ||
| 5114 | |||
| 5115 | |||
| 5116 | (cond ((eq ps-print-emacs-type 'emacs) ; emacs | ||
| 5117 | |||
| 5118 | (defalias 'ps-face-foreground-name 'face-foreground) | ||
| 5119 | (defalias 'ps-face-background-name 'face-background) | ||
| 5120 | |||
| 5121 | (defun ps-face-bold-p (face) | ||
| 5122 | (or (face-bold-p face) | ||
| 5123 | (memq face ps-bold-faces))) | ||
| 5124 | |||
| 5125 | (defun ps-face-italic-p (face) | ||
| 5126 | (or (face-italic-p face) | ||
| 5127 | (memq face ps-italic-faces))) | ||
| 5128 | ) | ||
| 5129 | ; xemacs | ||
| 5130 | ; lucid | ||
| 5131 | (t ; epoch | ||
| 5132 | (defun ps-face-foreground-name (face) | ||
| 5133 | (ps-xemacs-color-name (face-foreground face))) | ||
| 5134 | |||
| 5135 | (defun ps-face-background-name (face) | ||
| 5136 | (ps-xemacs-color-name (face-background face))) | ||
| 5137 | |||
| 5138 | (defun ps-face-bold-p (face) | ||
| 5139 | (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold") | ||
| 5140 | (memq face ps-bold-faces))) ; Kludge-compatible | ||
| 5141 | |||
| 5142 | (defun ps-face-italic-p (face) | ||
| 5143 | (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o") | ||
| 5144 | (ps-xemacs-face-kind-p face 'SLANT "i\\|o") | ||
| 5145 | (memq face ps-italic-faces))) ; Kludge-compatible | ||
| 5146 | )) | ||
| 5147 | |||
| 5148 | |||
| 5149 | (defun ps-face-underlined-p (face) | ||
| 5150 | (or (face-underline-p face) | ||
| 5151 | (memq face ps-underlined-faces))) | ||
| 5152 | |||
| 5153 | |||
| 5154 | ;; Ensure that face-list is fbound. | 5162 | ;; Ensure that face-list is fbound. |
| 5155 | (or (fboundp 'face-list) (defalias 'face-list 'list-faces)) | 5163 | (or (fboundp 'face-list) (defalias 'face-list 'list-faces)) |
| 5156 | 5164 | ||
| @@ -5207,23 +5215,12 @@ If FACE is not a valid face name, it is used default face." | |||
| 5207 | (ps-face-background-name face)))) | 5215 | (ps-face-background-name face)))) |
| 5208 | 5216 | ||
| 5209 | 5217 | ||
| 5210 | (cond ((not (eq ps-print-emacs-type 'emacs)) | 5218 | ;; to avoid compilation gripes |
| 5211 | ; xemacs | 5219 | (eval-and-compile |
| 5212 | ; lucid | 5220 | (defun ps-print-ensure-fontified (start end) |
| 5213 | ; epoch | 5221 | (and (boundp 'lazy-lock-mode) (symbol-value 'lazy-lock-mode) |
| 5214 | (defun ps-mapper (extent list) | 5222 | (lazy-lock-fontify-region start end)))) |
| 5215 | (nconc list (list (list (extent-start-position extent) 'push extent) | ||
| 5216 | (list (extent-end-position extent) 'pull extent))) | ||
| 5217 | nil) | ||
| 5218 | |||
| 5219 | (defun ps-extent-sorter (a b) | ||
| 5220 | (< (extent-priority a) (extent-priority b))) | ||
| 5221 | )) | ||
| 5222 | |||
| 5223 | 5223 | ||
| 5224 | (defun ps-print-ensure-fontified (start end) | ||
| 5225 | (and (boundp 'lazy-lock-mode) (symbol-value 'lazy-lock-mode) | ||
| 5226 | (lazy-lock-fontify-region start end))) | ||
| 5227 | 5224 | ||
| 5228 | (defun ps-generate-postscript-with-faces (from to) | 5225 | (defun ps-generate-postscript-with-faces (from to) |
| 5229 | ;; Some initialization... | 5226 | ;; Some initialization... |
| @@ -5245,7 +5242,7 @@ If FACE is not a valid face name, it is used default face." | |||
| 5245 | ;; Build the list of extents... | 5242 | ;; Build the list of extents... |
| 5246 | (let ((a (cons 'dummy nil)) | 5243 | (let ((a (cons 'dummy nil)) |
| 5247 | record type extent extent-list) | 5244 | record type extent extent-list) |
| 5248 | (map-extents 'ps-mapper nil from to a) | 5245 | (ps-x-map-extents 'ps-mapper nil from to a) |
| 5249 | (setq a (sort (cdr a) 'car-less-than-car) | 5246 | (setq a (sort (cdr a) 'car-less-than-car) |
| 5250 | extent-list nil) | 5247 | extent-list nil) |
| 5251 | 5248 | ||
| @@ -5268,12 +5265,12 @@ If FACE is not a valid face name, it is used default face." | |||
| 5268 | ;; the buffer, this'll generate errors. This is a | 5265 | ;; the buffer, this'll generate errors. This is a |
| 5269 | ;; hack, but don't call ps-plot-with-face unless from > | 5266 | ;; hack, but don't call ps-plot-with-face unless from > |
| 5270 | ;; point-min. | 5267 | ;; point-min. |
| 5271 | (and (>= from (point-min)) (<= position (point-max)) | 5268 | (and (>= from (point-min)) |
| 5272 | (ps-plot-with-face from position face)) | 5269 | (ps-plot-with-face from (min position (point-max)) face)) |
| 5273 | 5270 | ||
| 5274 | (cond | 5271 | (cond |
| 5275 | ((eq type 'push) | 5272 | ((eq type 'push) |
| 5276 | (and (extent-face extent) | 5273 | (and (ps-x-extent-face extent) |
| 5277 | (setq extent-list (sort (cons extent extent-list) | 5274 | (setq extent-list (sort (cons extent extent-list) |
| 5278 | 'ps-extent-sorter)))) | 5275 | 'ps-extent-sorter)))) |
| 5279 | 5276 | ||
| @@ -5282,7 +5279,7 @@ If FACE is not a valid face name, it is used default face." | |||
| 5282 | 'ps-extent-sorter)))) | 5279 | 'ps-extent-sorter)))) |
| 5283 | 5280 | ||
| 5284 | (setq face (if extent-list | 5281 | (setq face (if extent-list |
| 5285 | (extent-face (car extent-list)) | 5282 | (ps-x-extent-face (car extent-list)) |
| 5286 | 'default) | 5283 | 'default) |
| 5287 | from position | 5284 | from position |
| 5288 | a (cdr a))))) | 5285 | a (cdr a))))) |