aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-08-18 02:32:18 +0000
committerRichard M. Stallman1997-08-18 02:32:18 +0000
commit1bcb155cb1eec09f08dad8aab5b48f5a721d3389 (patch)
treee4dddb11d7155a084d63cf321f9c47a32eb8e3f0
parent423957633969a4c056a066b6cba3bb0018af4163 (diff)
downloademacs-1bcb155cb1eec09f08dad8aab5b48f5a721d3389.tar.gz
emacs-1bcb155cb1eec09f08dad8aab5b48f5a721d3389.zip
Faces now have 2 more elements, bold-p and italic-p.
(internal-facep, make-face, x-create-frame-with-faces): Create frames with those elements. (face-bold-p, face-italic-p): Just fetch those elements. (set-face-italic-p, set-face-bold-p): Doc fixes. (make-face-bold, make-face-italic, make-face-bold-italic) (make-face-unbold, make-face-unitalic): Set those new elements.
-rw-r--r--lisp/faces.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 8f6c03e7aed..2cf5d82abcf 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -50,7 +50,7 @@
50 50
51;;; Type checkers. 51;;; Type checkers.
52(defsubst internal-facep (x) 52(defsubst internal-facep (x)
53 (and (vectorp x) (= (length x) 10) (eq (aref x 0) 'face))) 53 (and (vectorp x) (= (length x) 12) (eq (aref x 0) 'face)))
54 54
55(defun facep (x) 55(defun facep (x)
56 "Return t if X is a face name or an internal face vector." 56 "Return t if X is a face name or an internal face vector."
@@ -80,10 +80,6 @@ If FRAME is t, report on the defaults for face FACE (for new frames).
80If FRAME is omitted or nil, use the selected frame." 80If FRAME is omitted or nil, use the selected frame."
81 (aref (internal-get-face face frame) 3)) 81 (aref (internal-get-face face frame) 3))
82 82
83(defun face-font-explicit (face &optional frame)
84 "Return non-nil if this face's font was explicitly specified."
85 (aref (internal-get-face face frame) 9))
86
87(defun face-foreground (face &optional frame) 83(defun face-foreground (face &optional frame)
88 "Return the foreground color name of face FACE, or nil if unspecified. 84 "Return the foreground color name of face FACE, or nil if unspecified.
89If the optional argument FRAME is given, report on face FACE in that frame. 85If the optional argument FRAME is given, report on face FACE in that frame.
@@ -121,29 +117,23 @@ If FRAME is t, report on the defaults for face FACE (for new frames).
121If FRAME is omitted or nil, use the selected frame." 117If FRAME is omitted or nil, use the selected frame."
122 (aref (internal-get-face face frame) 8)) 118 (aref (internal-get-face face frame) 8))
123 119
120(defun face-font-explicit (face &optional frame)
121 "Return non-nil if this face's font was explicitly specified."
122 (aref (internal-get-face face frame) 9))
123
124(defun face-bold-p (face &optional frame) 124(defun face-bold-p (face &optional frame)
125 "Return non-nil if the font of FACE is bold. 125 "Return non-nil if the font of FACE is bold.
126If the optional argument FRAME is given, report on face FACE in that frame. 126If the optional argument FRAME is given, report on face FACE in that frame.
127If FRAME is t, report on the defaults for face FACE (for new frames). 127If FRAME is t, report on the defaults for face FACE (for new frames).
128 The font default for a face is either nil, or a list
129 of the form (bold), (italic) or (bold italic).
130If FRAME is omitted or nil, use the selected frame." 128If FRAME is omitted or nil, use the selected frame."
131 (let ((font (face-font face frame))) 129 (aref (internal-get-face face frame) 10))
132 (if (stringp font)
133 (not (equal font (x-make-font-unbold font)))
134 (memq 'bold font))))
135 130
136(defun face-italic-p (face &optional frame) 131(defun face-italic-p (face &optional frame)
137 "Return non-nil if the font of FACE is italic. 132 "Return non-nil if the font of FACE is italic.
138If the optional argument FRAME is given, report on face FACE in that frame. 133If the optional argument FRAME is given, report on face FACE in that frame.
139If FRAME is t, report on the defaults for face FACE (for new frames). 134If FRAME is t, report on the defaults for face FACE (for new frames).
140 The font default for a face is either nil, or a list
141 of the form (bold), (italic) or (bold italic).
142If FRAME is omitted or nil, use the selected frame." 135If FRAME is omitted or nil, use the selected frame."
143 (let ((font (face-font face frame))) 136 (aref (internal-get-face face frame) 11))
144 (if (stringp font)
145 (not (equal font (x-make-font-unitalic font)))
146 (memq 'italic font))))
147 137
148(defalias 'face-doc-string 'face-documentation) 138(defalias 'face-doc-string 'face-documentation)
149(defun face-documentation (face) 139(defun face-documentation (face)
@@ -510,7 +500,7 @@ and always make a face whose attributes are all nil.
510If the face already exists, it is unmodified." 500If the face already exists, it is unmodified."
511 (interactive "SMake face: ") 501 (interactive "SMake face: ")
512 (or (internal-find-face name) 502 (or (internal-find-face name)
513 (let ((face (make-vector 10 nil))) 503 (let ((face (make-vector 12 nil)))
514 (aset face 0 'face) 504 (aset face 0 'face)
515 (aset face 1 name) 505 (aset face 1 name)
516 (let* ((frames (frame-list)) 506 (let* ((frames (frame-list))
@@ -905,6 +895,8 @@ If that can't be done, return nil."
905 "Make the font of the given face be bold, if possible. 895 "Make the font of the given face be bold, if possible.
906If NOERROR is non-nil, return nil on failure." 896If NOERROR is non-nil, return nil on failure."
907 (interactive (list (read-face-name "Make which face bold: "))) 897 (interactive (list (read-face-name "Make which face bold: ")))
898 ;; Set the bold-p flag, first of all.
899 (internal-set-face-1 face nil t 10 frame)
908 (if (and (eq frame t) (listp (face-font face t))) 900 (if (and (eq frame t) (listp (face-font face t)))
909 (set-face-font face (if (memq 'italic (face-font face t)) 901 (set-face-font face (if (memq 'italic (face-font face t))
910 '(bold italic) '(bold)) 902 '(bold italic) '(bold))
@@ -942,6 +934,8 @@ If NOERROR is non-nil, return nil on failure."
942 "Make the font of the given face be italic, if possible. 934 "Make the font of the given face be italic, if possible.
943If NOERROR is non-nil, return nil on failure." 935If NOERROR is non-nil, return nil on failure."
944 (interactive (list (read-face-name "Make which face italic: "))) 936 (interactive (list (read-face-name "Make which face italic: ")))
937 ;; Set the italic-p flag, first of all.
938 (internal-set-face-1 face nil t 11 frame)
945 (if (and (eq frame t) (listp (face-font face t))) 939 (if (and (eq frame t) (listp (face-font face t)))
946 (set-face-font face (if (memq 'bold (face-font face t)) 940 (set-face-font face (if (memq 'bold (face-font face t))
947 '(bold italic) '(italic)) 941 '(bold italic) '(italic))
@@ -979,6 +973,9 @@ If NOERROR is non-nil, return nil on failure."
979 "Make the font of the given face be bold and italic, if possible. 973 "Make the font of the given face be bold and italic, if possible.
980If NOERROR is non-nil, return nil on failure." 974If NOERROR is non-nil, return nil on failure."
981 (interactive (list (read-face-name "Make which face bold-italic: "))) 975 (interactive (list (read-face-name "Make which face bold-italic: ")))
976 ;; Set the bold-p and italic-p flags, first of all.
977 (internal-set-face-1 face nil t 10 frame)
978 (internal-set-face-1 face nil t 11 frame)
982 (if (and (eq frame t) (listp (face-font face t))) 979 (if (and (eq frame t) (listp (face-font face t)))
983 (set-face-font face '(bold italic) t) 980 (set-face-font face '(bold italic) t)
984 (let (font) 981 (let (font)
@@ -1030,6 +1027,8 @@ If NOERROR is non-nil, return nil on failure."
1030 "Make the font of the given face be non-bold, if possible. 1027 "Make the font of the given face be non-bold, if possible.
1031If NOERROR is non-nil, return nil on failure." 1028If NOERROR is non-nil, return nil on failure."
1032 (interactive (list (read-face-name "Make which face non-bold: "))) 1029 (interactive (list (read-face-name "Make which face non-bold: ")))
1030 ;; Clear the bold-p flag, first of all.
1031 (internal-set-face-1 face nil nil 10 frame)
1033 (if (and (eq frame t) (listp (face-font face t))) 1032 (if (and (eq frame t) (listp (face-font face t)))
1034 (set-face-font face (if (memq 'italic (face-font face t)) 1033 (set-face-font face (if (memq 'italic (face-font face t))
1035 '(italic) nil) 1034 '(italic) nil)
@@ -1060,6 +1059,8 @@ If NOERROR is non-nil, return nil on failure."
1060 "Make the font of the given face be non-italic, if possible. 1059 "Make the font of the given face be non-italic, if possible.
1061If NOERROR is non-nil, return nil on failure." 1060If NOERROR is non-nil, return nil on failure."
1062 (interactive (list (read-face-name "Make which face non-italic: "))) 1061 (interactive (list (read-face-name "Make which face non-italic: ")))
1062 ;; Clear the italic-p flag, first of all.
1063 (internal-set-face-1 face nil nil 11 frame)
1063 (if (and (eq frame t) (listp (face-font face t))) 1064 (if (and (eq frame t) (listp (face-font face t)))
1064 (set-face-font face (if (memq 'bold (face-font face t)) 1065 (set-face-font face (if (memq 'bold (face-font face t))
1065 '(bold) nil) 1066 '(bold) nil)
@@ -1348,7 +1349,9 @@ If FRAME is nil, the current FRAME is used."
1348 (vector 'face 1349 (vector 'face
1349 (face-name (cdr elt)) 1350 (face-name (cdr elt))
1350 (face-id (cdr elt)) 1351 (face-id (cdr elt))
1351 nil nil nil nil nil nil nil))) 1352 nil
1353 nil nil nil nil
1354 nil nil nil nil)))
1352 global-face-data)) 1355 global-face-data))
1353 (set-frame-face-alist frame faces) 1356 (set-frame-face-alist frame faces)
1354 1357