emacs-devel
[Top][All Lists]
Advanced

[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: Eli Zaretskii
Subject: Re: how to determine whether a char can be displayed or not
Date: Mon, 09 Oct 2000 07:31:40 +0200

> From: "Stefan Monnier" <monnier+gnu/address@hidden>
> Date: Sun, 08 Oct 2000 23:49:22 -0400
> 
> (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)))
>     (cond
>      ((memq window-system '(x))
>       (x-list-fonts
>        (concat "*-" (or (car spec) (face-attribute 'default :family))
>              "-*-" (cdr spec))))
>      ;; In doubt, let's say no.
>      (t nil))))

This should return non-nil for an ASCII font on all systems.  Also,
calling fontset-font unconditionally will signal an error on systems
which don't support fontsets (e.g., MS-DOS); you should use fboundp.
Finally, I think w32 will also work here, so (display-multi-font-p)
would be better than looking at window-system (if you call
display-multi-font-p outside the let* form, you could avoid fboundp).

> - shouldn't this be implemented in C instead, reusing the existing
>   font selection code, so as to be 100% sure of the answer ?

Is x-list-fonts slow?  If it is, then IMHO a primitive would be
better.



reply via email to

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