244 |
If the optional argument FRAME is given, report on face FACE in that frame. |
If the optional argument FRAME is given, report on face FACE in that frame. |
245 |
If FRAME is t, report on the defaults for face FACE (for new frames). |
If FRAME is t, report on the defaults for face FACE (for new frames). |
246 |
If FRAME is omitted or nil, use the selected frame." |
If FRAME is omitted or nil, use the selected frame." |
247 |
(if (not (equal (face-font face frame) (face-font 'default frame))) |
(let ((attrs |
248 |
;; The font is different from the default face's font, so clearly it |
'(:family :width :height :weight :slant :foreground |
249 |
;; differs. This only really works on window-systems; on ttys, the |
:foreground :background :underline :overline |
250 |
;; "font" is a constant, with attributes layered on top of it. |
:strike-through :box :inverse-video)) |
251 |
:font |
(differs nil)) |
252 |
;; General face attribute check. On graphical displays |
(while (and attrs (not differs)) |
253 |
;; `display-supports-face-attributes-p' just checks whether each |
(let* ((attr (pop attrs)) |
254 |
;; attribute is different that the default face, so we just check to |
(attr-val (face-attribute face attr frame t))) |
255 |
;; make sure each attribute of the merged face is not `unspecified'; |
(when (and |
256 |
;; we already checked the font above, so font-related attributes are |
(not (eq attr-val 'unspecified)) |
257 |
;; omitted for that reason. On a tty, |
(display-supports-face-attributes-p (list attr attr-val) |
258 |
;; display-supports-face-attributes-p actually does do further |
frame)) |
259 |
;; checks, and correctly deals with the display's capabilities, so |
(setq differs attr)))) |
260 |
;; we use it to check all attributes. |
differs)) |
|
(let ((attrs |
|
|
(if (memq (framep (or frame (selected-frame))) '(x w32 mac)) |
|
|
;; Omit font-related attributes on a window-system |
|
|
'(:foreground :foreground :background :underline :overline |
|
|
:strike-through :box :inverse-video :stipple) |
|
|
;; On a tty, check all attributes |
|
|
'(:family :width :height :weight :slant :foreground |
|
|
:foreground :background :underline :overline |
|
|
:strike-through :box :inverse-video :stipple))) |
|
|
(differs nil)) |
|
|
(while (and attrs (not differs)) |
|
|
(let* ((attr (pop attrs)) |
|
|
(attr-val (face-attribute face attr frame t))) |
|
|
(when (and |
|
|
(not (eq attr-val 'unspecified)) |
|
|
(display-supports-face-attributes-p (list attr attr-val) |
|
|
frame)) |
|
|
(setq differs attr)))) |
|
|
differs))) |
|
261 |
|
|
262 |
|
|
263 |
(defun face-nontrivial-p (face &optional frame) |
(defun face-nontrivial-p (face &optional frame) |