aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/international/fontset.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index c23ae218933..7baa89ae66c 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -2,6 +2,7 @@
2 2
3;; Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. 3;; Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
4;; Licensed to the Free Software Foundation. 4;; Licensed to the Free Software Foundation.
5;; Copyright (C) 2001 Free Software Foundation, Inc.
5 6
6;; Keywords: mule, multilingual, fontset 7;; Keywords: mule, multilingual, fontset
7 8
@@ -303,6 +304,27 @@ Optional argument REDUCE is always ignored. It exists just for
303backward compatibility." 304backward compatibility."
304 (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-"))) 305 (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-")))
305 306
307
308(defun x-must-resolve-font-name (xlfd-fields)
309 "Like `x-resolve-font-name', but always return a font name.
310XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields.
311If no font matching XLFD-FIELDS is available, successively replace
312parts of the font name pattern with \"*\" until some font is found.
313Value is name of that font."
314 (let ((ascii-font nil) (index 0))
315 (while (and (null ascii-font) (<= index xlfd-regexp-encoding-subnum))
316 (let ((pattern (x-compose-font-name xlfd-fields)))
317 (condition-case nil
318 (setq ascii-font (x-resolve-font-name pattern))
319 (error
320 (message "Warning: no fonts matching `%s' available" pattern)
321 (aset xlfd-fields index "*")
322 (setq index (1+ index))))))
323 (unless ascii-font
324 (error "No fonts founds"))
325 ascii-font))
326
327
306(defun x-complement-fontset-spec (xlfd-fields fontlist) 328(defun x-complement-fontset-spec (xlfd-fields fontlist)
307 "Complement FONTLIST for charsets based on XLFD-FIELDS and return it. 329 "Complement FONTLIST for charsets based on XLFD-FIELDS and return it.
308XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields. 330XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields.
@@ -324,7 +346,7 @@ variable `x-font-name-charset-alist'), add that information to FONTLIST."
324 ;; If font for ASCII is not specified, add it. 346 ;; If font for ASCII is not specified, add it.
325 (aset xlfd-fields xlfd-regexp-registry-subnum "iso8859") 347 (aset xlfd-fields xlfd-regexp-registry-subnum "iso8859")
326 (aset xlfd-fields xlfd-regexp-encoding-subnum "1") 348 (aset xlfd-fields xlfd-regexp-encoding-subnum "1")
327 (setq ascii-font (x-resolve-font-name (x-compose-font-name xlfd-fields))) 349 (setq ascii-font (x-must-resolve-font-name xlfd-fields))
328 (setq fontlist (cons (cons 'ascii ascii-font) fontlist))) 350 (setq fontlist (cons (cons 'ascii ascii-font) fontlist)))
329 351
330 ;; If the font for ASCII also supports the other charsets, and 352 ;; If the font for ASCII also supports the other charsets, and