Steve Youngs wrote:
> 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
> come from
> (defun describe-face-at-point ()
> "Return face used at point."
> (interactive)
> (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,
symbolp error.
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))
(mapcar
#'(lambda (f)
(face-font-instance f)) faces))
(faces
(list (face-font-instance faces)))
(t
default))))
For 21.4.21-Mule, I need:
-(face-font-instance f)
+(face-font-instance f nil (charset-after (point)))
Otherwise, it reports:
#<font-instance "-*-fixed-medium-r-*--24-*-jisx0208.1983-*" on #<x-device
on "wxp:0.0" 0xa85643> 0x800050 0xa8654d>
when it should be (for ASCII or ISO-8859-1):
#<font-instance "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1"
on #<x-device on "wxp:0.0" 0xa85643> 0x800015 0xa85806>
--
Glynn Clements <glynn(a)gclements.plus.com>
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta