Mercurial > emacs
comparison lisp/international/latin1-disp.el @ 32785:fc837c2f746a
(latin1-char-displayable-p): New
function (from Handa).
(latin1-display-check-font): Use it.
author | Dave Love <fx@gnu.org> |
---|---|
date | Mon, 23 Oct 2000 17:47:06 +0000 |
parents | 6d39ec089c7b |
children | 00c403ac9e5e |
comparison
equal
deleted
inserted
replaced
32784:0b93e0c39122 | 32785:fc837c2f746a |
---|---|
141 'charset))))) | 141 'charset))))) |
142 (standard-display-default (make-char charset 32) | 142 (standard-display-default (make-char charset 32) |
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. |
161 SET must be a member of `latin1-display-sets'. Normally, check | 192 SET must be a member of `latin1-display-sets'. Normally, check |
162 whether a font for SET is available and don't set the display if it | 193 whether a font for SET is available and don't set the display if it |