emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 97b80912e9 2/2: Move some definitions from ps-def.el to ps-print.


From: Stefan Kangas
Subject: master 97b80912e9 2/2: Move some definitions from ps-def.el to ps-print.el
Date: Sun, 31 Jul 2022 12:16:31 -0400 (EDT)

branch: master
commit 97b80912e9fb74d8a7881b74f1cd556a03f5fae8
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Move some definitions from ps-def.el to ps-print.el
    
    * lisp/ps-def.el (ps-face-bold-p, ps-face-italic-p)
    (ps-face-strikeout-p, ps-face-overline-p, ps-face-box-p)
    (ps-color-format, ps-float-format)
    (ps-generate-postscript-with-faces1): Move from here...
    * lisp/ps-print.el (ps-face-bold-p, ps-face-italic-p)
    (ps-face-strikeout-p, ps-face-overline-p, ps-face-box-p)
    (ps-color-format, ps-float-format)
    (ps-generate-postscript-with-faces1): ...to here.
---
 lisp/ps-def.el   | 67 --------------------------------------------------------
 lisp/ps-print.el | 52 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 67 deletions(-)

diff --git a/lisp/ps-def.el b/lisp/ps-def.el
index 8235d6c7f3..ed4cd7b248 100644
--- a/lisp/ps-def.el
+++ b/lisp/ps-def.el
@@ -29,12 +29,6 @@
 
 ;;; Code:
 
-(declare-function ps-plot-with-face "ps-print" (from to face))
-(declare-function ps-plot-string    "ps-print" (string))
-
-(defvar ps-bold-faces)                  ; in ps-print.el
-(defvar ps-italic-faces)
-
 
 ;; Emacs Definitions
 
@@ -54,67 +48,6 @@
 (define-obsolete-function-alias 'ps-color-device #'display-color-p "29.1")
 (define-obsolete-function-alias 'ps-color-values #'color-values "28.1")
 
-(defun ps-face-bold-p (face)
-  (or (face-bold-p face)
-      (memq face ps-bold-faces)))
-
-
-(defun ps-face-italic-p (face)
-  (or (face-italic-p face)
-      (memq face ps-italic-faces)))
-
-
-(defun ps-face-strikeout-p (face)
-  (eq (face-attribute face :strike-through) t))
-
-
-(defun ps-face-overline-p (face)
-  (eq (face-attribute face :overline) t))
-
-
-(defun ps-face-box-p (face)
-  (not (memq (face-attribute face :box) '(nil unspecified))))
-
-
-;; Emacs understands the %f format; we'll use it to limit color RGB values
-;; to three decimals to cut down some on the size of the PostScript output.
-(defvar ps-color-format "%0.3f %0.3f %0.3f")
-(defvar ps-float-format "%0.3f ")
-
-
-(defun ps-generate-postscript-with-faces1 (from to)
-  ;; Generate some PostScript.
-  (let ((face 'default)
-       (position to)
-       ;; Emacs
-       (property-change from)
-       (overlay-change from)
-       before-string after-string)
-    (while (< from to)
-      (and (< property-change to)  ; Don't search for property change
-                                       ; unless previous search succeeded.
-          (setq property-change (next-property-change from nil to)))
-      (and (< overlay-change to)   ; Don't search for overlay change
-                                       ; unless previous search succeeded.
-          (setq overlay-change (min (next-overlay-change from)
-                                    to)))
-      (setq position (min property-change overlay-change)
-           before-string nil
-           after-string nil)
-      (setq face
-           (cond ((invisible-p from)
-                  'emacs--invisible--face)
-                 ((get-char-property from 'face))
-                 (t 'default)))
-      ;; Plot up to this record.
-      (and before-string
-          (ps-plot-string before-string))
-      (ps-plot-with-face from position face)
-      (and after-string
-          (ps-plot-string after-string))
-      (setq from position))
-    (ps-plot-with-face from to face)))
-
 (provide 'ps-def)
 
 ;;; ps-def.el ends here
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index fe60fcc288..4a7e5bbd3d 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -4733,6 +4733,10 @@ page-height == ((floor print-height ((th + ls) * zh)) * 
((th + ls) * zh)) - th
 (defun ps-output-boolean (name bool)
   (ps-output (format "/%s %s def\n" name (if bool "true" "false"))))
 
+;; Limit color RGB values to three decimals to cut down some on the
+;; size of the PostScript output.
+(defvar ps-color-format "%0.3f %0.3f %0.3f")
+(defvar ps-float-format "%0.3f ")
 
 (defun ps-output-frame-properties (name alist)
   (ps-output "/" name " ["
@@ -6312,6 +6316,22 @@ If FACE is not a valid face name, use default face."
       (setq ps-print-face-alist (cons face-map ps-print-face-alist)))
     face-map))
 
+(defun ps-face-bold-p (face)
+  (or (face-bold-p face)
+      (memq face ps-bold-faces)))
+
+(defun ps-face-italic-p (face)
+  (or (face-italic-p face)
+      (memq face ps-italic-faces)))
+
+(defun ps-face-strikeout-p (face)
+  (eq (face-attribute face :strike-through) t))
+
+(defun ps-face-overline-p (face)
+  (eq (face-attribute face :overline) t))
+
+(defun ps-face-box-p (face)
+  (not (memq (face-attribute face :box) '(nil unspecified))))
 
 (defun ps-screen-to-bit-face (face)
   (cons face
@@ -6325,6 +6345,38 @@ If FACE is not a valid face name, use default face."
                 (face-background face nil t))))
 
 
+(defun ps-generate-postscript-with-faces1 (from to)
+  ;; Generate some PostScript.
+  (let ((face 'default)
+        (position to)
+        (property-change from)
+        (overlay-change from)
+        before-string after-string)
+    (while (< from to)
+      (and (< property-change to)       ; Don't search for property change
+                                        ; unless previous search succeeded.
+           (setq property-change (next-property-change from nil to)))
+      (and (< overlay-change to)        ; Don't search for overlay change
+                                        ; unless previous search succeeded.
+           (setq overlay-change (min (next-overlay-change from)
+                                     to)))
+      (setq position (min property-change overlay-change)
+            before-string nil
+            after-string nil)
+      (setq face
+            (cond ((invisible-p from)
+                   'emacs--invisible--face)
+                  ((get-char-property from 'face))
+                  (t 'default)))
+      ;; Plot up to this record.
+      (and before-string
+           (ps-plot-string before-string))
+      (ps-plot-with-face from position face)
+      (and after-string
+           (ps-plot-string after-string))
+      (setq from position))
+    (ps-plot-with-face from to face)))
+
 (defun ps-generate-postscript-with-faces (from to)
   ;; Some initialization...
   (setq ps-current-effect 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]