diff options
| author | Dave Love | 2000-10-23 17:47:06 +0000 |
|---|---|---|
| committer | Dave Love | 2000-10-23 17:47:06 +0000 |
| commit | fa2c768f76b45b207e38d3fde7fb424f23293e1f (patch) | |
| tree | 1f2c1f9b32118e3cbca2ab795420a30417fb2819 | |
| parent | 446c097e30de5509ef33a5432febcc28a4e680cf (diff) | |
| download | emacs-fa2c768f76b45b207e38d3fde7fb424f23293e1f.tar.gz emacs-fa2c768f76b45b207e38d3fde7fb424f23293e1f.zip | |
(latin1-char-displayable-p): New
function (from Handa).
(latin1-display-check-font): Use it.
| -rw-r--r-- | lisp/international/latin1-disp.el | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/lisp/international/latin1-disp.el b/lisp/international/latin1-disp.el index 94d8e08f1a9..ee011d21fa5 100644 --- a/lisp/international/latin1-disp.el +++ b/lisp/international/latin1-disp.el | |||
| @@ -143,18 +143,49 @@ character set." | |||
| 143 | (make-char charset 127))) | 143 | (make-char charset 127))) |
| 144 | (sit-for 0)) | 144 | (sit-for 0)) |
| 145 | 145 | ||
| 146 | ;; Is there a better way than this? | ||
| 147 | (defun latin1-display-check-font (language) | 146 | (defun latin1-display-check-font (language) |
| 148 | "Return non-nil if we have a font with an encoding for LANGUAGE. | 147 | "Return non-nil if we have a font with an encoding for LANGUAGE. |
| 149 | LANGUAGE is a symbol naming a language environment using an ISO8859 | 148 | LANGUAGE is a symbol naming a language environment using an ISO8859 |
| 150 | character set: `latin-2', `hebrew' etc." | 149 | character set: `latin-2', `hebrew' etc." |
| 151 | (if (eq language 'cyrillic) | 150 | (if (eq language 'cyrillic) |
| 152 | (setq language 'cyrillic-iso)) | 151 | (setq language 'cyrillic-iso)) |
| 153 | (if window-system | 152 | (let* ((info (get-language-info language 'charset)) |
| 154 | (let* ((info (get-language-info language 'charset)) | 153 | (char (make-char (car (remq 'ascii info)) ?\ ))) |
| 155 | (str (symbol-name (car (remq 'ascii info))))) | 154 | (latin1-char-displayable-p char))) |
| 156 | (string-match "-iso8859-[0-9]+\\'" str) | 155 | |
| 157 | (x-list-fonts (concat "*" (match-string 0 str)))))) | 156 | ;; This should be moved into mule-utils or somewhere after 21.1. |
| 157 | (defun latin1-char-displayable-p (char) | ||
| 158 | (cond ((< char 256) | ||
| 159 | ;; Single byte characters are always displayable. | ||
| 160 | t) | ||
| 161 | (window-system | ||
| 162 | ;; On a window system, a character is displayable if we have | ||
| 163 | ;; a font for that character in the default face of the | ||
| 164 | ;; currently selected frame. | ||
| 165 | (let ((fontset (frame-parameter (selected-frame) 'font)) | ||
| 166 | font-pattern) | ||
| 167 | (if (query-fontset fontset) | ||
| 168 | (setq font-pattern (fontset-font fontset char))) | ||
| 169 | (or font-pattern | ||
| 170 | (setq font-pattern (fontset-font "fontset-default" char))) | ||
| 171 | (if font-pattern | ||
| 172 | (progn | ||
| 173 | ;; Now FONT-PATTERN is a string or a cons of family | ||
| 174 | ;; field pattern and registry filed pattern. | ||
| 175 | (or (stringp font-pattern) | ||
| 176 | (setq font-pattern (concat (or (car font-pattern) "*") | ||
| 177 | "-*-" | ||
| 178 | (cdr font-pattern)))) | ||
| 179 | (x-list-fonts font-pattern 'default (selected-frame) 1))))) | ||
| 180 | (t | ||
| 181 | (let ((coding (terminal-coding-system))) | ||
| 182 | (if coding | ||
| 183 | (let ((safe-chars (coding-system-get coding 'safe-chars)) | ||
| 184 | (safe-charsets (coding-system-get coding 'safe-charsets))) | ||
| 185 | (or (and safe-chars | ||
| 186 | (aref safe-chars char)) | ||
| 187 | (and safe-charsets | ||
| 188 | (memq (char-charset char) safe-charsets))))))))) | ||
| 158 | 189 | ||
| 159 | (defun latin1-display-setup (set &optional force) | 190 | (defun latin1-display-setup (set &optional force) |
| 160 | "Set up Latin-1 display for characters in the given SET. | 191 | "Set up Latin-1 display for characters in the given SET. |