* Giacomo Boffi <giacomo.boffi(a)polimi.it> writes:
Julian Bradfield writes:
> Can somebody tell me how to find which font instance is being used
> to display the character at point in the current frame?
this is in my init.el, it's not mine, i cannot remember where it
(defun describe-face-at-point ()
"Return face used at point."
(hyper-describe-face (get-char-property (point) 'face)))
There are a couple small shortcomings with this. Firstly, the default
face doesn't have a `face' property (funnily enough, neither does
whitespace:-P). Second... `(get-char-property (point) 'face)' might
return a list of faces.
In the first scenario (default face/whitespace) you'll get a "Sorry,
nothing to describe" back from #'hyper-describe-face.
In the 2nd scenario (list of faces) you'll get a Wrong type argument,
This might be better...
(defun font-instance-at-point ()
"Return a list of font instances of char at point.
If there is no char \(whitespace for example\) then a list of font
instances for the default face are returned."
(let ((default (list (face-font-instance 'default)))
(faces (get-char-property (point) 'face)))
(cond ((and faces (listp faces))
(face-font-instance f)) faces))
(list (face-font-instance faces)))
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
| SXEmacs - The only _______ you'll ever need. |
| Fill in the blank, yes, it's THAT good! |
XEmacs-Beta mailing list