Mercurial > emacs
comparison lisp/international/mule-util.el @ 52403:be9e6be9d6d7
(char-displayable-p): Moved from
latin1-disp, renamed and autoloaded.
author | Dave Love <fx@gnu.org> |
---|---|
date | Mon, 01 Sep 2003 18:45:35 +0000 |
parents | 695cf19ef79e |
children | 4860d5ef0587 375f2633d815 |
comparison
equal
deleted
inserted
replaced
52402:9c467b1dba23 | 52403:be9e6be9d6d7 |
---|---|
1 ;;; mule-util.el --- utility functions for mulitilingual environment (mule) | 1 ;;; mule-util.el --- utility functions for mulitilingual environment (mule) |
2 | 2 |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | 3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. |
4 ;; Licensed to the Free Software Foundation. | 4 ;; Licensed to the Free Software Foundation. |
5 ;; Copyright (C) 2000, 2002 Free Software Foundation, Inc. | |
5 | 6 |
6 ;; Keywords: mule, multilingual | 7 ;; Keywords: mule, multilingual |
7 | 8 |
8 ;; This file is part of GNU Emacs. | 9 ;; This file is part of GNU Emacs. |
9 | 10 |
356 (mapcar (function (lambda (x) | 357 (mapcar (function (lambda (x) |
357 (cons (coding-system-get x 'coding-category) x))) | 358 (cons (coding-system-get x 'coding-category) x))) |
358 coding-priority)) | 359 coding-priority)) |
359 (detect-coding-region from to)))) | 360 (detect-coding-region from to)))) |
360 | 361 |
362 ;;;###autoload | |
363 (defun char-displayable-p (char) | |
364 "Return non-nil if we should be able to display CHAR. | |
365 On a multi-font display, the test is only whether there is an | |
366 appropriate font from the selected frame's fontset to display CHAR's | |
367 charset in general. Since fonts may be specified on a per-character | |
368 basis, this may not be accurate." | |
369 (cond ((< char 256) | |
370 ;; Single byte characters are always displayable. | |
371 t) | |
372 ((display-multi-font-p) | |
373 ;; On a window system, a character is displayable if we have | |
374 ;; a font for that character in the default face of the | |
375 ;; currently selected frame. | |
376 (let ((fontset (frame-parameter (selected-frame) 'font)) | |
377 font-pattern) | |
378 (if (query-fontset fontset) | |
379 (setq font-pattern (fontset-font fontset char))) | |
380 (or font-pattern | |
381 (setq font-pattern (fontset-font "fontset-default" char))) | |
382 (if font-pattern | |
383 (progn | |
384 ;; Now FONT-PATTERN is a string or a cons of family | |
385 ;; field pattern and registry field pattern. | |
386 (or (stringp font-pattern) | |
387 (setq font-pattern (concat "-" | |
388 (or (car font-pattern) "*") | |
389 "-*-" | |
390 (cdr font-pattern)))) | |
391 (x-list-fonts font-pattern 'default (selected-frame) 1))))) | |
392 (t | |
393 (let ((coding (terminal-coding-system))) | |
394 (if coding | |
395 (let ((safe-chars (coding-system-get coding 'safe-chars)) | |
396 (safe-charsets (coding-system-get coding 'safe-charsets))) | |
397 (or (and safe-chars | |
398 (aref safe-chars char)) | |
399 (and safe-charsets | |
400 (memq (char-charset char) safe-charsets))))))))) | |
361 | 401 |
362 (provide 'mule-util) | 402 (provide 'mule-util) |
363 | 403 |
364 ;; Local Variables: | 404 ;; Local Variables: |
365 ;; coding: iso-2022-7bit | 405 ;; coding: iso-2022-7bit |