aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1997-07-10 06:46:42 +0000
committerKenichi Handa1997-07-10 06:46:42 +0000
commitb65976cb0fd8da2e0a08ec07fd8c37c6bbf920d3 (patch)
treeb04c395d349efb7cfe1041eeff8e6dad71cbf492
parente81ed9edb2c364912561aa386283e2458898d17a (diff)
downloademacs-b65976cb0fd8da2e0a08ec07fd8c37c6bbf920d3.tar.gz
emacs-b65976cb0fd8da2e0a08ec07fd8c37c6bbf920d3.zip
(create-fontset-from-fontset-spec): Add
optional arg NOERROR. (create-fontset-from-x-resource): Give t as arg NOERROR to create-fontset-from-fontset-spec.
-rw-r--r--lisp/international/fontset.el30
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index a6cab0f959f..5b5bdc32075 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -324,14 +324,16 @@ automatically."
324 name)) 324 name))
325 fontset))) 325 fontset)))
326 326
327(defun create-fontset-from-fontset-spec (fontset-spec &optional style) 327(defun create-fontset-from-fontset-spec (fontset-spec &optional style noerror)
328 "Create a fontset from fontset specification string FONTSET-SPEC. 328 "Create a fontset from fontset specification string FONTSET-SPEC.
329FONTSET-SPEC is a string of the format: 329FONTSET-SPEC is a string of the format:
330 FONTSET-NAME,CHARSET-NAME0:FONT-NAME0,CHARSET-NAME1:FONT-NAME1, ... 330 FONTSET-NAME,CHARSET-NAME0:FONT-NAME0,CHARSET-NAME1:FONT-NAME1, ...
331Any number of SPACE, TAB, and NEWLINE can be put before and after commas. 331Any number of SPACE, TAB, and NEWLINE can be put before and after commas.
332If optional argument STYLE is specified, create a fontset of STYLE 332If optional argument STYLE is specified, create a fontset of STYLE
333by modifying FONTSET-SPEC appropriately. STYLE can be one of `bold', 333by modifying FONTSET-SPEC appropriately. STYLE can be one of `bold',
334`italic', and `bold-italic'." 334`italic', and `bold-italic'.
335If this function attemps to create already existing fontset, error is
336signaled unlress the optional 3rd argument NOERROR is non-nil."
335 (if (not (string-match "^[^,]+" fontset-spec)) 337 (if (not (string-match "^[^,]+" fontset-spec))
336 (error "Invalid fontset spec: %s" fontset-spec)) 338 (error "Invalid fontset spec: %s" fontset-spec))
337 (let ((idx (match-end 0)) 339 (let ((idx (match-end 0))
@@ -367,16 +369,18 @@ by modifying FONTSET-SPEC appropriately. STYLE can be one of `bold',
367 (setq fontlist 369 (setq fontlist
368 (x-complement-fontset-spec xlfd-fields fontlist)))) 370 (x-complement-fontset-spec xlfd-fields fontlist))))
369 371
370 ;; Create the fontset, and define the alias if appropriate. 372 (if (and noerror (query-fontset name))
371 (new-fontset name fontlist) 373 ;; Don't try to create an already existing fontset.
372 (if (and (not style) 374 nil
373 (not (assoc name fontset-alias-alist)) 375 ;; Create the fontset, and define the alias if appropriate.
374 (string-match "fontset-.*$" name)) 376 (new-fontset name fontlist)
375 (let ((alias (match-string 0 name))) 377 (if (and (not style)
376 (or (rassoc alias fontset-alias-alist) 378 (not (assoc name fontset-alias-alist))
377 (setq fontset-alias-alist 379 (string-match "fontset-.*$" name))
378 (cons (cons name alias) fontset-alias-alist))))) 380 (let ((alias (match-string 0 name)))
379 )) 381 (or (rassoc alias fontset-alias-alist)
382 (setq fontset-alias-alist
383 (cons (cons name alias) fontset-alias-alist))))))))
380 384
381 385
382;; Create standard fontset from 16 dots fonts which are the most widely 386;; Create standard fontset from 16 dots fonts which are the most widely
@@ -409,7 +413,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
409 fontset-spec) 413 fontset-spec)
410 (while (setq fontset-spec (x-get-resource (concat "fontset-" idx) 414 (while (setq fontset-spec (x-get-resource (concat "fontset-" idx)
411 (concat "Fontset-" idx))) 415 (concat "Fontset-" idx)))
412 (create-fontset-from-fontset-spec fontset-spec) 416 (create-fontset-from-fontset-spec fontset-spec nil 'noerror)
413 (setq idx (1+ idx))))) 417 (setq idx (1+ idx)))))
414 418
415(defsubst fontset-list () 419(defsubst fontset-list ()