diff options
| author | Richard M. Stallman | 1997-07-05 19:28:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-07-05 19:28:02 +0000 |
| commit | b1eb5e6abdd53d5739738c52dd079b68a390303d (patch) | |
| tree | 313afa3643ad5972d6cf393ff59cb8317a60020d /lisp | |
| parent | f850d7828c49752a95674bd1b38902b77bf9bf01 (diff) | |
| download | emacs-b1eb5e6abdd53d5739738c52dd079b68a390303d.tar.gz emacs-b1eb5e6abdd53d5739738c52dd079b68a390303d.zip | |
(face-set-after-frame-default): New ubroutine,
taken from x-create-frame-with-faces.
(x-create-frame-with-faces): Call it.
(face-italic-p, face-bold-p): Use equal to compare fonts.
(frame-update-faces): Function now a no-op.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/faces.el | 67 |
1 files changed, 23 insertions, 44 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index 8c6c09176ad..09a8082bc3f 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -124,7 +124,7 @@ If FRAME is t, report on the defaults for face FACE (for new frames). | |||
| 124 | If FRAME is omitted or nil, use the selected frame." | 124 | If FRAME is omitted or nil, use the selected frame." |
| 125 | (let ((font (face-font face frame))) | 125 | (let ((font (face-font face frame))) |
| 126 | (if (stringp font) | 126 | (if (stringp font) |
| 127 | (not (eq font (x-make-font-unbold font))) | 127 | (not (equal font (x-make-font-unbold font))) |
| 128 | (memq 'bold font)))) | 128 | (memq 'bold font)))) |
| 129 | 129 | ||
| 130 | (defun face-italic-p (face &optional frame) | 130 | (defun face-italic-p (face &optional frame) |
| @@ -136,7 +136,7 @@ If FRAME is t, report on the defaults for face FACE (for new frames). | |||
| 136 | If FRAME is omitted or nil, use the selected frame." | 136 | If FRAME is omitted or nil, use the selected frame." |
| 137 | (let ((font (face-font face frame))) | 137 | (let ((font (face-font face frame))) |
| 138 | (if (stringp font) | 138 | (if (stringp font) |
| 139 | (not (eq font (x-make-font-unitalic font))) | 139 | (not (equal font (x-make-font-unitalic font))) |
| 140 | (memq 'italic font)))) | 140 | (memq 'italic font)))) |
| 141 | 141 | ||
| 142 | (defun face-doc-string (face) | 142 | (defun face-doc-string (face) |
| @@ -1211,7 +1211,6 @@ If FRAME is nil, the current FRAME is used." | |||
| 1211 | (setq frame (x-create-frame (cons '(visibility . nil) parameters))) | 1211 | (setq frame (x-create-frame (cons '(visibility . nil) parameters))) |
| 1212 | (unwind-protect | 1212 | (unwind-protect |
| 1213 | (progn | 1213 | (progn |
| 1214 | |||
| 1215 | ;; Copy the face alist, copying the face vectors | 1214 | ;; Copy the face alist, copying the face vectors |
| 1216 | ;; and emptying out their attributes. | 1215 | ;; and emptying out their attributes. |
| 1217 | (setq faces | 1216 | (setq faces |
| @@ -1251,27 +1250,7 @@ If FRAME is nil, the current FRAME is used." | |||
| 1251 | 1250 | ||
| 1252 | (frame-set-background-mode frame) | 1251 | (frame-set-background-mode frame) |
| 1253 | 1252 | ||
| 1254 | ;; Set up faces from the defface information | 1253 | (face-set-after-frame-default frame) |
| 1255 | (mapcar (lambda (symbol) | ||
| 1256 | (let ((spec (or (get symbol 'saved-face) | ||
| 1257 | (get symbol 'face-defface-spec)))) | ||
| 1258 | (when spec | ||
| 1259 | (face-spec-set symbol spec frame)))) | ||
| 1260 | (face-list)) | ||
| 1261 | |||
| 1262 | ;; Set up faces from the global face data. | ||
| 1263 | (setq rest faces) | ||
| 1264 | (while rest | ||
| 1265 | (let* ((face (car (car rest))) | ||
| 1266 | (global (cdr (assq face global-face-data)))) | ||
| 1267 | (face-fill-in face global frame)) | ||
| 1268 | (setq rest (cdr rest))) | ||
| 1269 | |||
| 1270 | ;; Set up faces from the X resources. | ||
| 1271 | (setq rest faces) | ||
| 1272 | (while rest | ||
| 1273 | (make-face-x-resource-internal (cdr (car rest)) frame) | ||
| 1274 | (setq rest (cdr rest))) | ||
| 1275 | 1254 | ||
| 1276 | ;; Make the frame visible, if desired. | 1255 | ;; Make the frame visible, if desired. |
| 1277 | (if (null visibility-spec) | 1256 | (if (null visibility-spec) |
| @@ -1282,6 +1261,25 @@ If FRAME is nil, the current FRAME is used." | |||
| 1282 | (delete-frame frame))))) | 1261 | (delete-frame frame))))) |
| 1283 | frame)) | 1262 | frame)) |
| 1284 | 1263 | ||
| 1264 | ;; Update a frame's faces after the frame font changes. | ||
| 1265 | ;; This is called from modify-frame-parameters | ||
| 1266 | ;; as well as from elsewhere in this file. | ||
| 1267 | (defun face-set-after-frame-default (frame) | ||
| 1268 | (let ((rest (frame-face-alist frame))) | ||
| 1269 | (while rest | ||
| 1270 | ;; Set up each face, first from the defface information, | ||
| 1271 | ;; then the global face data, and then the X resources. | ||
| 1272 | (let* ((face (car (car rest))) | ||
| 1273 | (spec (or (get face 'saved-face) | ||
| 1274 | (get face 'face-defface-spec))) | ||
| 1275 | (global (cdr (assq face global-face-data))) | ||
| 1276 | (local (cdr (car rest)))) | ||
| 1277 | (when spec | ||
| 1278 | (face-spec-set face spec frame)) | ||
| 1279 | (face-fill-in face global frame) | ||
| 1280 | (make-face-x-resource-internal local frame)) | ||
| 1281 | (setq rest (cdr rest))))) | ||
| 1282 | |||
| 1285 | (defcustom frame-background-mode nil | 1283 | (defcustom frame-background-mode nil |
| 1286 | "*The brightness of the background. | 1284 | "*The brightness of the background. |
| 1287 | Set this to the symbol dark if your background color is dark, light if | 1285 | Set this to the symbol dark if your background color is dark, light if |
| @@ -1320,26 +1318,7 @@ examine the brightness for you." | |||
| 1320 | (t 'mono))))))) | 1318 | (t 'mono))))))) |
| 1321 | 1319 | ||
| 1322 | ;; Update a frame's faces when we change its default font. | 1320 | ;; Update a frame's faces when we change its default font. |
| 1323 | (defun frame-update-faces (frame) | 1321 | (defun frame-update-faces (frame) nil) |
| 1324 | (let* ((faces global-face-data) | ||
| 1325 | (rest faces)) | ||
| 1326 | (while rest | ||
| 1327 | (let* ((face (car (car rest))) | ||
| 1328 | (font (face-font face t))) | ||
| 1329 | (if (listp font) | ||
| 1330 | (let ((bold (memq 'bold font)) | ||
| 1331 | (italic (memq 'italic font))) | ||
| 1332 | ;; Ignore any previous (string-valued) font, it might not even | ||
| 1333 | ;; be the right size anymore. | ||
| 1334 | (set-face-font face nil frame) | ||
| 1335 | (cond ((and bold italic) | ||
| 1336 | (make-face-bold-italic face frame t)) | ||
| 1337 | (bold | ||
| 1338 | (make-face-bold face frame t)) | ||
| 1339 | (italic | ||
| 1340 | (make-face-italic face frame t))))) | ||
| 1341 | (setq rest (cdr rest))) | ||
| 1342 | frame))) | ||
| 1343 | 1322 | ||
| 1344 | ;; Update the colors of FACE, after FRAME's own colors have been changed. | 1323 | ;; Update the colors of FACE, after FRAME's own colors have been changed. |
| 1345 | ;; This applies only to faces with global color specifications | 1324 | ;; This applies only to faces with global color specifications |