diff options
| author | Kenichi Handa | 2007-12-03 13:42:35 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-12-03 13:42:35 +0000 |
| commit | 9841dbc9acd4e858d9871adcf98a34a2c4db2ba3 (patch) | |
| tree | c1668e7eb61364056a0d682d04354214adc243b7 | |
| parent | 794eba0f36ef1a413989c6b6d69965e9deebbae8 (diff) | |
| download | emacs-9841dbc9acd4e858d9871adcf98a34a2c4db2ba3.tar.gz emacs-9841dbc9acd4e858d9871adcf98a34a2c4db2ba3.zip | |
(x-complement-fontset-spec): Use
font-spec.
| -rw-r--r-- | lisp/international/fontset.el | 77 |
1 files changed, 52 insertions, 25 deletions
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 5712ed46fb7..dd1d0eddae7 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el | |||
| @@ -229,17 +229,17 @@ | |||
| 229 | ;; fontset to find an appropriate font for each script/charset. The | 229 | ;; fontset to find an appropriate font for each script/charset. The |
| 230 | ;; specification has the form ((SCRIPT FONT-SPEC ...) ...), where | 230 | ;; specification has the form ((SCRIPT FONT-SPEC ...) ...), where |
| 231 | ;; FONT-SPEC is: | 231 | ;; FONT-SPEC is: |
| 232 | ;; a vector [ FAMILY WEIGHT SLANT ADSTYLE REGISTRY ], | 232 | ;; a cons (FAMILY . REGISTRY), |
| 233 | ;; or a cons (FAMILY . REGISTRY), | 233 | ;; or a string FONT-NAME, |
| 234 | ;; or a string FONT-NAME. | 234 | ;; or an object created by `font-spec'. |
| 235 | ;; | 235 | ;; |
| 236 | ;; FAMILY, WEIGHT, SLANT, and ADSTYLE may be nil, in which case, the | 236 | ;; FAMILY may be nil, in which case, the the corresponding name of |
| 237 | ;; the corresponding name of default face is used. If REGISTRY | 237 | ;; default face is used. If REGISTRY contains a character `-', the |
| 238 | ;; contains a character `-', the string before that is embedded in | 238 | ;; string before that is embedded in `CHARSET_REGISTRY' field, and the |
| 239 | ;; `CHARSET_REGISTRY' field, and the string after that is embedded in | 239 | ;; string after that is embedded in `CHARSET_ENCODING' field. If it |
| 240 | ;; `CHARSET_ENCODING' field. If it does not contain `-', the whole | 240 | ;; does not contain `-', the whole string is embedded in |
| 241 | ;; string is embedded in `CHARSET_REGISTRY' field, and a wild card | 241 | ;; `CHARSET_REGISTRY' field, and a wild card character `*' is embedded |
| 242 | ;; character `*' is embedded in `CHARSET_ENCODING' field. | 242 | ;; in `CHARSET_ENCODING' field. |
| 243 | ;; | 243 | ;; |
| 244 | ;; SCRIPT is a symbol that appears as an element of the char table | 244 | ;; SCRIPT is a symbol that appears as an element of the char table |
| 245 | ;; `char-script-table'. SCRIPT may be a charset specifying the range | 245 | ;; `char-script-table'. SCRIPT may be a charset specifying the range |
| @@ -638,26 +638,53 @@ The font names are complemented as below. | |||
| 638 | 638 | ||
| 639 | If a font name matches `xlfd-style-regexp', each field of wild card is | 639 | If a font name matches `xlfd-style-regexp', each field of wild card is |
| 640 | replaced by the corresponding fields in XLFD-FIELDS." | 640 | replaced by the corresponding fields in XLFD-FIELDS." |
| 641 | (let ((default-spec (vector (aref xlfd-fields xlfd-regexp-family-subnum) | 641 | (let ((family (aref xlfd-fields xlfd-regexp-family-subnum)) |
| 642 | (aref xlfd-fields xlfd-regexp-weight-subnum) | 642 | (weight (aref xlfd-fields xlfd-regexp-weight-subnum)) |
| 643 | (aref xlfd-fields xlfd-regexp-slant-subnum) | 643 | (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) |
| 644 | (aref xlfd-fields xlfd-regexp-swidth-subnum) | 644 | (width (aref xlfd-fields xlfd-regexp-swidth-subnum)) |
| 645 | (aref xlfd-fields xlfd-regexp-adstyle-subnum) | 645 | (adstyle (aref xlfd-fields xlfd-regexp-adstyle-subnum)) |
| 646 | (aref xlfd-fields xlfd-regexp-registry-subnum)))) | 646 | (registry (aref xlfd-fields xlfd-regexp-registry-subnum))) |
| 647 | (if weight (setq weight (intern weight))) | ||
| 648 | (if slant (setq slant (intern slant))) | ||
| 649 | (if width (setq width (intern width))) | ||
| 650 | (if adstyle (setq adstyle (intern adstyle))) | ||
| 647 | (dolist (elt fontlist) | 651 | (dolist (elt fontlist) |
| 648 | (let ((name (cadr elt)) | 652 | (let ((name (cadr elt)) |
| 649 | font-spec) | 653 | args) |
| 650 | (when (or (string-match xlfd-style-regexp name) | 654 | (when (or (string-match xlfd-style-regexp name) |
| 651 | (and (setq name (car (x-list-fonts name nil nil 1))) | 655 | (and (setq name (car (x-list-fonts name nil nil 1))) |
| 652 | (string-match xlfd-style-regexp name))) | 656 | (string-match xlfd-style-regexp name))) |
| 653 | (setq font-spec (make-vector 6 nil)) | 657 | (let ((fam (match-string (1+ xlfd-regexp-family-subnum) name)) |
| 654 | (dotimes (i 6) | 658 | (wei (match-string (1+ xlfd-regexp-weight-subnum) name)) |
| 655 | (aset font-spec i (match-string (1+ i) name))) | 659 | (sla (match-string (1+ xlfd-regexp-slant-subnum) name)) |
| 656 | (dotimes (i 5) | 660 | (wid (match-string (1+ xlfd-regexp-swidth-subnum) name)) |
| 657 | (if (string-match "^[*-]+$" (aref font-spec i)) | 661 | (ads (match-string (1+ xlfd-regexp-adstyle-subnum) name)) |
| 658 | (aset font-spec i (aref default-spec i)))) | 662 | (reg (match-string (1+ xlfd-regexp-registry-subnum) name))) |
| 659 | (setcar (cdr elt) font-spec)))) | 663 | (if (or (and fam (setq fam (if (not (string-match "^[*?]*$" fam)) |
| 660 | 664 | fam))) | |
| 665 | family) | ||
| 666 | (setq args (list :family (or fam family)))) | ||
| 667 | (if (or (and wei (setq wei (if (not (string-match "^[*?]*$" wei)) | ||
| 668 | (intern wei)))) | ||
| 669 | weight) | ||
| 670 | (setq args (cons :weight (cons (or wei weight) args)))) | ||
| 671 | (if (or (and sla (setq sla (if (not (string-match "^[*?]*$" sla)) | ||
| 672 | (intern sla)))) | ||
| 673 | slant) | ||
| 674 | (setq args (cons :slant (cons (or sla slant) args)))) | ||
| 675 | (if (or (and wid (setq wid (if (not (string-match "^[*?]*$" wid)) | ||
| 676 | (intern wid)))) | ||
| 677 | width) | ||
| 678 | (setq args (cons :width (cons (or wid width) args)))) | ||
| 679 | (if (or (and ads (setq ads (if (not (string-match "^[*?]*$" ads)) | ||
| 680 | (intern ads)))) | ||
| 681 | adstyle) | ||
| 682 | (setq args (cons :adstyle (cons (or ads adstyle) args)))) | ||
| 683 | (if (or (and reg (setq reg (if (not (string-match "^[*?]*$" reg)) | ||
| 684 | reg))) | ||
| 685 | registry) | ||
| 686 | (setq args (cons :registry (cons (or reg registry) args)))) | ||
| 687 | (setcar (cdr elt) (apply 'font-spec args)))))) | ||
| 661 | fontlist)) | 688 | fontlist)) |
| 662 | 689 | ||
| 663 | (defun fontset-name-p (fontset) | 690 | (defun fontset-name-p (fontset) |