[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to determine whether a char can be displayed or not

From: Stefan Monnier
Subject: Re: how to determine whether a char can be displayed or not
Date: Sun, 08 Oct 2000 23:49:22 -0400

> > How can I tell whether a given char (or charset) will be displayed
> > properly (i.e. a font will be found for it) ?
> Dave wrote latin1-display-check-font for international/latin1-disp.el,
> but the comment there says he will be happy to hear some alternatives

Fair enough.  I think there should be a way to find it out from elisp.
Looking at Dave's code and at fontset.el, I came up with the following:

(defun display-check-font (char)
  "Return non-nil if a font is available to display CHAR."
  (if (symbolp char) (setq char (make-char char)))
  (let* ((spec (fontset-font t char)))
     ((memq window-system '(x))
       (concat "*-" (or (car spec) (face-attribute 'default :family))
               "-*-" (cdr spec))))
     ;; In doubt, let's say no.
     (t nil))))

I'd like to add the above to fontset.el, but:
- is the function name appropriate ?
- shouldn't this be implemented in C instead, reusing the existing
  font selection code, so as to be 100% sure of the answer ?
  I looked at the C code and it seems that an elisp interface to
  choose_face_font (in xfaces.c) would be what we want, but I can't
  quite firgure how to find appropriate arguments to pass to it.
  Any help ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]