changeset 12651:4bb00f26c714

(make-face-bold, make-face-italic, make-face-bold-italic) (make-face-unbold, make-face-unitalic): No error if font is already bold, italic, or whatever.
author Richard M. Stallman <rms@gnu.org>
date Tue, 25 Jul 1995 04:50:43 +0000
parents 6f4785fee5cc
children 127ae5c0a005
files lisp/faces.el
diffstat 1 files changed, 23 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/faces.el	Tue Jul 25 04:43:05 1995 +0000
+++ b/lisp/faces.el	Tue Jul 25 04:50:43 1995 +0000
@@ -691,8 +691,7 @@
       (set-face-font face (if (memq 'italic (face-font face t))
 			      '(bold italic) '(bold))
 		     t)
-    (let ((ofont (face-font face frame))
-	  font)
+    (let (font)
       (if (null frame)
 	  (let ((frames (frame-list)))
 	    ;; Make this face bold in global-face-data.
@@ -709,10 +708,10 @@
 	(setq font (or font
 		       (face-font 'default frame)
 		       (cdr (assq 'font (frame-parameters frame)))))
-	(and font (make-face-bold-internal face frame font)))
-      (or (not (equal ofont (face-font face)))
-	  (and (not noerror)
-	       (error "No bold version of %S" font))))))
+	(or (and font (make-face-bold-internal face frame font))
+	    ;; We failed to find a bold version of the font.
+	    noerror
+	    (error "No bold version of %S" font))))))
 
 (defun make-face-bold-internal (face frame font)
   (let (f2)
@@ -729,8 +728,7 @@
       (set-face-font face (if (memq 'bold (face-font face t))
 			      '(bold italic) '(italic))
 		     t)
-    (let ((ofont (face-font face frame))
-	  font)
+    (let (font)
       (if (null frame)
 	  (let ((frames (frame-list)))
 	    ;; Make this face italic in global-face-data.
@@ -747,10 +745,10 @@
 	(setq font (or font
 		       (face-font 'default frame)
 		       (cdr (assq 'font (frame-parameters frame)))))
-	(and font (make-face-italic-internal face frame font)))
-      (or (not (equal ofont (face-font face)))
-	  (and (not noerror)
-	       (error "No italic version of %S" font))))))
+	(or (and font (make-face-italic-internal face frame font))
+	    ;; We failed to find an italic version of the font.
+	    noerror
+	    (error "No italic version of %S" font))))))
 
 (defun make-face-italic-internal (face frame font)
   (let (f2)
@@ -765,8 +763,7 @@
   (interactive (list (read-face-name "Make which face bold-italic: ")))
   (if (and (eq frame t) (listp (face-font face t)))
       (set-face-font face '(bold italic) t)
-    (let ((ofont (face-font face frame))
-	  font)
+    (let (font)
       (if (null frame)
 	  (let ((frames (frame-list)))
 	    ;; Make this face bold-italic in global-face-data.
@@ -783,10 +780,10 @@
 	(setq font (or font
 		       (face-font 'default frame)
 		       (cdr (assq 'font (frame-parameters frame)))))
-	(and font (make-face-bold-italic-internal face frame font)))
-      (or (not (equal ofont (face-font face)))
-	  (and (not noerror)
-	       (error "No bold italic version of %S" font))))))
+	(or (and font (make-face-bold-italic-internal face frame font))
+	    ;; We failed to find a bold italic version.
+	    noerror
+	    (error "No bold italic version of %S" font))))))
 
 (defun make-face-bold-italic-internal (face frame font)
   (let (f2 f3)
@@ -819,8 +816,7 @@
       (set-face-font face (if (memq 'italic (face-font face t))
 			      '(italic) nil)
 		     t)
-    (let ((ofont (face-font face frame))
-	  font font1)
+    (let (font font1)
       (if (null frame)
 	  (let ((frames (frame-list)))
 	    ;; Make this face unbold in global-face-data.
@@ -838,10 +834,9 @@
 			(face-font 'default frame)
 			(cdr (assq 'font (frame-parameters frame)))))
 	(setq font (and font1 (x-make-font-unbold font1)))
-	(if font (internal-try-face-font face font frame)))
-      (or (not (equal ofont (face-font face)))
-	  (and (not noerror)
-	       (error "No unbold version of %S" font1))))))
+	(or (if font (internal-try-face-font face font frame))
+	    noerror
+	    (error "No unbold version of %S" font1))))))
 
 (defun make-face-unitalic (face &optional frame noerror)
   "Make the font of the given face be non-italic, if possible.  
@@ -851,8 +846,7 @@
       (set-face-font face (if (memq 'bold (face-font face t))
 			      '(bold) nil)
 		     t)
-    (let ((ofont (face-font face frame))
-	  font font1)
+    (let (font font1)
       (if (null frame)
 	  (let ((frames (frame-list)))
 	    ;; Make this face unitalic in global-face-data.
@@ -870,10 +864,9 @@
 			(face-font 'default frame)
 			(cdr (assq 'font (frame-parameters frame)))))
 	(setq font (and font1 (x-make-font-unitalic font1)))
-	(if font (internal-try-face-font face font frame)))
-      (or (not (equal ofont (face-font face)))
-	  (and (not noerror)
-	       (error "No unitalic version of %S" font1))))))
+	(or (if font (internal-try-face-font face font frame))
+	    noerror
+	    (error "No unitalic version of %S" font1))))))
 
 (defvar list-faces-sample-text
   "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"