Mercurial > hg > xemacs-beta
comparison lisp/w3/font.el @ 116:9f59509498e1 r20-1b10
Import from CVS: tag r20-1b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:23:06 +0200 |
parents | 8619ce7e4c50 |
children | 7d55a9ba150c |
comparison
equal
deleted
inserted
replaced
115:f109f7dabbe2 | 116:9f59509498e1 |
---|---|
1 ;;; font.el --- New font model | 1 ;;; font.el --- New font model |
2 ;; Author: wmperry | 2 ;; Author: wmperry |
3 ;; Created: 1997/03/19 18:28:10 | 3 ;; Created: 1997/03/26 20:08:55 |
4 ;; Version: 1.38 | 4 ;; Version: 1.40 |
5 ;; Keywords: faces | 5 ;; Keywords: faces |
6 | 6 |
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 ;;; Copyright (c) 1995, 1996 by William M. Perry (wmperry@cs.indiana.edu) | 8 ;;; Copyright (c) 1995, 1996 by William M. Perry (wmperry@cs.indiana.edu) |
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. | 9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc. |
977 (list r g b) )) | 977 (list r g b) )) |
978 | 978 |
979 (defsubst font-rgb-color-p (obj) | 979 (defsubst font-rgb-color-p (obj) |
980 (or (and (vectorp obj) | 980 (or (and (vectorp obj) |
981 (= (length obj) 4) | 981 (= (length obj) 4) |
982 (eq (aref obj 0) 'rgb)) | 982 (eq (aref obj 0) 'rgb)))) |
983 (string-match "^#[0-9a-fA-F]+$" obj))) | |
984 | 983 |
985 (defsubst font-rgb-color-red (obj) (aref obj 1)) | 984 (defsubst font-rgb-color-red (obj) (aref obj 1)) |
986 (defsubst font-rgb-color-green (obj) (aref obj 2)) | 985 (defsubst font-rgb-color-green (obj) (aref obj 2)) |
987 (defsubst font-rgb-color-blue (obj) (aref obj 3)) | 986 (defsubst font-rgb-color-blue (obj) (aref obj 3)) |
988 | 987 |
1091 | 1090 |
1092 (defun font-set-face-background (&optional face color &rest args) | 1091 (defun font-set-face-background (&optional face color &rest args) |
1093 (interactive) | 1092 (interactive) |
1094 (condition-case nil | 1093 (condition-case nil |
1095 (cond | 1094 (cond |
1096 ((font-rgb-color-p color) | 1095 ((or (font-rgb-color-p color) |
1096 (string-match "^#[0-9a-fA-F]+$" color)) | |
1097 (apply 'set-face-background face | 1097 (apply 'set-face-background face |
1098 (font-normalize-color color) args)) | 1098 (font-normalize-color color) args)) |
1099 (t | 1099 (t |
1100 (apply 'set-face-background face color args))) | 1100 (apply 'set-face-background face color args))) |
1101 (error nil))) | 1101 (error nil))) |
1102 | 1102 |
1103 (defun font-set-face-foreground (&optional face color &rest args) | 1103 (defun font-set-face-foreground (&optional face color &rest args) |
1104 (interactive) | 1104 (interactive) |
1105 (condition-case nil | 1105 (condition-case nil |
1106 (cond | 1106 (cond |
1107 ((font-rgb-color-p color) | 1107 ((or (font-rgb-color-p color) |
1108 (string-match "^#[0-9a-fA-F]+$" color)) | |
1108 (apply 'set-face-foreground face (font-normalize-color color) args)) | 1109 (apply 'set-face-foreground face (font-normalize-color color) args)) |
1109 (t | 1110 (t |
1110 (apply 'set-face-foreground face color args))) | 1111 (apply 'set-face-foreground face color args))) |
1111 (error nil))) | 1112 (error nil))) |
1112 | 1113 |