Fix 'fontset-name-p'

* lisp/international/fontset.el (fontset-name-p): Make the
function work with full fontset names and fontset alias names.
This commit is contained in:
Eli Zaretskii 2017-12-10 19:45:25 +02:00
parent d23158777d
commit 87baf1242e

View file

@ -1147,10 +1147,14 @@ given from DEFAULT-SPEC."
(defun fontset-name-p (fontset) (defun fontset-name-p (fontset)
"Return non-nil if FONTSET is valid as fontset name. "Return non-nil if FONTSET is valid as fontset name.
A valid fontset name should conform to XLFD (X Logical Font Description) A valid fontset name should conform to XLFD (X Logical Font Description)
with \"fontset\" in `<CHARSET_REGISTRY>' field." with \"fontset-SOMETHING\" in `<CHARSET_REGISTRY>' field.
(and (string-match xlfd-tight-regexp fontset) A fontset alias name recorded in `fontset-alias-alist' is also a valid
(string= (match-string (1+ xlfd-regexp-registry-subnum) fontset) fontset name."
"fontset"))) (or (and (string-match xlfd-tight-regexp fontset)
(let ((registry
(match-string (1+ xlfd-regexp-registry-subnum) fontset)))
(= 0 (string-match "\\`fontset-" registry))))
(consp (rassoc fontset fontset-alias-alist))))
(declare-function fontset-list "fontset.c" ()) (declare-function fontset-list "fontset.c" ())