diff options
| author | Kenichi Handa | 2007-12-20 12:38:58 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-12-20 12:38:58 +0000 |
| commit | 6ce70459b15aa015aa5bc80adec72e8dd8d83c63 (patch) | |
| tree | b48c0687ffd57f8df87b0f83733dbf6f0962acf1 | |
| parent | 47f44396344a212ff7269d226399e881ee2d24fe (diff) | |
| download | emacs-6ce70459b15aa015aa5bc80adec72e8dd8d83c63.tar.gz emacs-6ce70459b15aa015aa5bc80adec72e8dd8d83c63.zip | |
(font-encoding-charset-alist):
Initialize it.
(otf-script-alist): Fix typo of canadian-aboriginal.
(setup-default-fontset): Specify font-specs for many more scripts.
(x-complement-fontset-spec): The 1st argument changed to a
font-spec object.
(create-fontset-from-fontset-spec): Adjusted for the above change.
| -rw-r--r-- | lisp/international/fontset.el | 163 |
1 files changed, 92 insertions, 71 deletions
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index e500c37f80b..fe269f07e4f 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el | |||
| @@ -117,6 +117,29 @@ | |||
| 117 | ("muletibetan-2" . tibetan) | 117 | ("muletibetan-2" . tibetan) |
| 118 | ("muletibetan-1" . tibetan-1-column))) | 118 | ("muletibetan-1" . tibetan-1-column))) |
| 119 | 119 | ||
| 120 | (setq font-encoding-charset-alist | ||
| 121 | '((latin-iso8859-1 . iso-8859-1) | ||
| 122 | (latin-iso8859-2 . iso-8859-2) | ||
| 123 | (latin-iso8859-3 . iso-8859-3) | ||
| 124 | (latin-iso8859-4 . iso-8859-4) | ||
| 125 | (latin-iso8859-9 . iso-8859-9) | ||
| 126 | (latin-iso8859-10 . iso-8859-10) | ||
| 127 | (latin-iso8859-13 . iso-8859-13) | ||
| 128 | (latin-iso8859-14 . iso-8859-14) | ||
| 129 | (latin-iso8859-15 . iso-8859-15) | ||
| 130 | (latin-iso8859-16 . iso-8859-16) | ||
| 131 | (cyrillic-iso8859-5 . iso-8859-5) | ||
| 132 | (greek-iso8859-7 . iso-8859-7) | ||
| 133 | (arabic-iso8859-6 . iso-8859-6) | ||
| 134 | (thai-tis620 . tis620-2533) | ||
| 135 | (latin-jisx0201 . jisx0201) | ||
| 136 | (katakana-jisx0201 . jisx0201) | ||
| 137 | (chinese-big5-1 . big5) | ||
| 138 | (chinese-big5-2 . big5) | ||
| 139 | (vietnamese-viscii-lower . viscii) | ||
| 140 | (vietnamese-viscii-upper . viscii) | ||
| 141 | (tibetan . unicode-bmp))) | ||
| 142 | |||
| 120 | (setq script-representative-chars | 143 | (setq script-representative-chars |
| 121 | '((latin ?A ?Z ?a ?z) | 144 | '((latin ?A ?Z ?a ?z) |
| 122 | (greek #x3A9) | 145 | (greek #x3A9) |
| @@ -169,7 +192,7 @@ | |||
| 169 | (bugi . buginese) | 192 | (bugi . buginese) |
| 170 | (buhd . buhid) | 193 | (buhd . buhid) |
| 171 | (byzm . byzantine-musical-symbol) | 194 | (byzm . byzantine-musical-symbol) |
| 172 | (cans . canadian_aboliginal) | 195 | (cans . canadian-aboriginal) |
| 173 | (cher . cherokee) | 196 | (cher . cherokee) |
| 174 | (copt . coptic) | 197 | (copt . coptic) |
| 175 | (xsux . cuneiform) | 198 | (xsux . cuneiform) |
| @@ -262,15 +285,24 @@ | |||
| 262 | (nil . "ISO8859-15") | 285 | (nil . "ISO8859-15") |
| 263 | (nil . "VISCII1.1-1")) | 286 | (nil . "VISCII1.1-1")) |
| 264 | 287 | ||
| 265 | (thai (nil . "TIS620*") | 288 | (thai ,(font-spec :registry "iso10646-1" :otf '(thai nil nil (mark))) |
| 266 | (nil . "ISO8859-11")) | 289 | (nil . "TIS620*") |
| 290 | (nil . "ISO8859-11")) | ||
| 267 | 291 | ||
| 268 | (devanagari ,(font-spec :registry "iso10646-1" :otf '(deva nil (rphf))) | 292 | (devanagari ,(font-spec :registry "iso10646-1" :otf '(deva nil (rphf))) |
| 269 | (nil . "iso10646.indian-1")) | 293 | (nil . "iso10646.indian-1")) |
| 270 | (malayalam ,(font-spec :registry "iso10646-1" :otf '(mlym nil (akhn)))) | 294 | (bengali ,(font-spec :registry "iso10646-1" :otf '(beng nil (rphf)))) |
| 295 | (gurmukhi ,(font-spec :registry "iso10646-1" :otf '(guru nil (blwf)))) | ||
| 296 | (gujarati ,(font-spec :registry "iso10646-1" :otf '(gujr nil (rphf)))) | ||
| 297 | (oriya ,(font-spec :registry "iso10646-1" :otf '(orya nil (rphf)))) | ||
| 271 | (tamil ,(font-spec :registry "iso10646-1" :otf '(taml nil (akhn)))) | 298 | (tamil ,(font-spec :registry "iso10646-1" :otf '(taml nil (akhn)))) |
| 299 | (telugu ,(font-spec :registry "iso10646-1" :otf '(telu nil (blwf)))) | ||
| 300 | (kannada ,(font-spec :registry "iso10646-1" :otf '(knda nil (rphf)))) | ||
| 301 | (sinhala ,(font-spec :registry "iso10646-1" :otf '(sinh nil (akhn)))) | ||
| 302 | (malayalam ,(font-spec :registry "iso10646-1" :otf '(mlym nil (akhn)))) | ||
| 272 | 303 | ||
| 273 | (lao (nil . "MuleLao-1")) | 304 | (lao ,(font-spec :registry "iso10646-1" :otf '(mlym nil nil (mark))) |
| 305 | (nil . "MuleLao-1")) | ||
| 274 | 306 | ||
| 275 | (tai-viet ("TaiViet" . "iso10646-1")) | 307 | (tai-viet ("TaiViet" . "iso10646-1")) |
| 276 | 308 | ||
| @@ -281,22 +313,50 @@ | |||
| 281 | (nil . "muletibetan-2")) | 313 | (nil . "muletibetan-2")) |
| 282 | 314 | ||
| 283 | ;; both for script and charset. | 315 | ;; both for script and charset. |
| 284 | (ethiopic (nil . "ethiopic-unicode")) | 316 | (ethiopic ,(font-spec :registry "iso10646-1" :script 'ethiopic) |
| 317 | (nil . "ethiopic-unicode")) | ||
| 285 | 318 | ||
| 286 | (greek (nil . "ISO8859-7")) | 319 | (greek ,(font-spec :registry "iso10646-1" :script 'greek) |
| 320 | (nil . "ISO8859-7")) | ||
| 287 | 321 | ||
| 288 | (cyrillic (nil . "ISO8859-5") | 322 | (cyrillic ,(font-spec :registry "iso10646-1" :script 'cyrillic) |
| 323 | (nil . "ISO8859-5") | ||
| 289 | (nil . "microsoft-cp1251") | 324 | (nil . "microsoft-cp1251") |
| 290 | (nil . "koi8-r")) | 325 | (nil . "koi8-r")) |
| 291 | 326 | ||
| 292 | (arabic (nil . "MuleArabic-0") | 327 | (arabic ,(font-spec :registry "iso10646-1" |
| 328 | :otf '(arab (init medi fini liga))) | ||
| 329 | (nil . "MuleArabic-0") | ||
| 293 | (nil . "MuleArabic-1") | 330 | (nil . "MuleArabic-1") |
| 294 | (nil . "MuleArabic-2") | 331 | (nil . "MuleArabic-2") |
| 295 | (nil . "ISO8859-6")) | 332 | (nil . "ISO8859-6")) |
| 296 | 333 | ||
| 297 | (hebrew (nil . "ISO8859-8")) | 334 | (hebrew ,(font-spec :registry "iso10646-1" :script 'hebrew) |
| 335 | (nil . "ISO8859-8")) | ||
| 336 | |||
| 337 | (syriac ,(font-spec :registry "iso10646-1" :script 'syriac)) | ||
| 338 | |||
| 339 | (thaana ,(font-spec :registry "iso10646-1" :otf '(thaa nil nil))) | ||
| 340 | |||
| 341 | (myanmar ,(font-spec :registry "iso10646-1" :script 'myanmar)) | ||
| 342 | |||
| 343 | (georgian ,(font-spec :registry "iso10646-1" :script 'georgian)) | ||
| 344 | |||
| 345 | (cherokee ,(font-spec :registry "iso10646-1" :script 'cherokee)) | ||
| 298 | 346 | ||
| 299 | (kana (nil . "JISX0208*") | 347 | (canadian-aboriginal ,(font-spec :registry "iso10646-1" |
| 348 | :script 'canadian-aboriginal)) | ||
| 349 | |||
| 350 | (ogham ,(font-spec :registry "iso10646-1" :script 'ogham)) | ||
| 351 | |||
| 352 | (runic ,(font-spec :registry "iso10646-1" :script 'runic)) | ||
| 353 | |||
| 354 | (khmer ,(font-spec :registry "iso10646-1" :otf '(khmr nil (pres)))) | ||
| 355 | |||
| 356 | (yi ,(font-spec :registry "iso10646-1" :script 'yi)) | ||
| 357 | |||
| 358 | (kana ,(font-spec :registry "iso10646-1" :script 'kana) | ||
| 359 | (nil . "JISX0208*") | ||
| 300 | (nil . "GB2312.1980-0") | 360 | (nil . "GB2312.1980-0") |
| 301 | (nil . "KSC5601.1987*") | 361 | (nil . "KSC5601.1987*") |
| 302 | (nil . "JISX0201*") | 362 | (nil . "JISX0201*") |
| @@ -305,7 +365,9 @@ | |||
| 305 | 365 | ||
| 306 | (bopomofo (nil . "sisheng_cwnn-0")) | 366 | (bopomofo (nil . "sisheng_cwnn-0")) |
| 307 | 367 | ||
| 308 | (han (nil . "GB2312.1980-0") | 368 | (han ,(font-spec :registry "iso10646-1" :language 'ja) |
| 369 | ,(font-spec :registry "iso10646-1" :language 'zh) | ||
| 370 | (nil . "GB2312.1980-0") | ||
| 309 | (nil . "JISX0208*") | 371 | (nil . "JISX0208*") |
| 310 | (nil . "JISX0212*") | 372 | (nil . "JISX0212*") |
| 311 | (nil . "big5*") | 373 | (nil . "big5*") |
| @@ -340,7 +402,8 @@ | |||
| 340 | (nil . "JISX0213.2000-1") | 402 | (nil . "JISX0213.2000-1") |
| 341 | (nil . "JISX0213.2000-2")) | 403 | (nil . "JISX0213.2000-2")) |
| 342 | 404 | ||
| 343 | (hangul (nil . "KSC5601.1987-0")) | 405 | (hangul ,(font-spec :registry "iso10646-1" :language 'ko) |
| 406 | (nil . "KSC5601.1987-0")) | ||
| 344 | 407 | ||
| 345 | ;; for each charset | 408 | ;; for each charset |
| 346 | (ascii (nil . "ISO8859-1")) | 409 | (ascii (nil . "ISO8859-1")) |
| @@ -634,62 +697,21 @@ Value is name of that font." | |||
| 634 | ascii-font)) | 697 | ascii-font)) |
| 635 | 698 | ||
| 636 | 699 | ||
| 637 | (defun x-complement-fontset-spec (xlfd-fields fontlist) | 700 | (defun x-complement-fontset-spec (default-spec fontlist) |
| 638 | "Complement elements of FONTLIST based on XLFD-FIELDS. | 701 | "Complement elements of FONTLIST based on DEFAULT-SPEC. |
| 639 | XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields. | 702 | DEFAULT-SPEC is a font-spec object providing default font properties. |
| 640 | FONTLIST is an alist of script names vs the corresponding font names. | 703 | FONTLIST is an alist of script names vs the corresponding font names. |
| 641 | 704 | ||
| 642 | The font names are complemented as below. | 705 | The font names are parsed and unspecified font properties are |
| 643 | 706 | given from DEFAULT-SPEC." | |
| 644 | If a font name matches `xlfd-style-regexp', each field of wild card is | 707 | (let ((prop-list '(:foundry :family :weight :slant :width :adstyle))) |
| 645 | replaced by the corresponding fields in XLFD-FIELDS." | ||
| 646 | (let ((family (aref xlfd-fields xlfd-regexp-family-subnum)) | ||
| 647 | (weight (aref xlfd-fields xlfd-regexp-weight-subnum)) | ||
| 648 | (slant (aref xlfd-fields xlfd-regexp-slant-subnum)) | ||
| 649 | (width (aref xlfd-fields xlfd-regexp-swidth-subnum)) | ||
| 650 | (adstyle (aref xlfd-fields xlfd-regexp-adstyle-subnum)) | ||
| 651 | (registry (aref xlfd-fields xlfd-regexp-registry-subnum))) | ||
| 652 | (if weight (setq weight (intern weight))) | ||
| 653 | (if slant (setq slant (intern slant))) | ||
| 654 | (if width (setq width (intern width))) | ||
| 655 | (if adstyle (setq adstyle (intern adstyle))) | ||
| 656 | (dolist (elt fontlist) | 708 | (dolist (elt fontlist) |
| 657 | (let ((name (cadr elt)) | 709 | (let ((spec (font-spec :name (cadr elt)))) |
| 658 | args) | 710 | (dolist (prop prop-list) |
| 659 | (when (or (string-match xlfd-style-regexp name) | 711 | (let ((val (font-get spec prop))) |
| 660 | (and (setq name (car (x-list-fonts name nil nil 1))) | 712 | (or val |
| 661 | (string-match xlfd-style-regexp name))) | 713 | (font-put spec prop (font-get default-spec prop))))) |
| 662 | (let ((fam (match-string (1+ xlfd-regexp-family-subnum) name)) | 714 | (setcar (cdr elt) spec))) |
| 663 | (wei (match-string (1+ xlfd-regexp-weight-subnum) name)) | ||
| 664 | (sla (match-string (1+ xlfd-regexp-slant-subnum) name)) | ||
| 665 | (wid (match-string (1+ xlfd-regexp-swidth-subnum) name)) | ||
| 666 | (ads (match-string (1+ xlfd-regexp-adstyle-subnum) name)) | ||
| 667 | (reg (match-string (1+ xlfd-regexp-registry-subnum) name))) | ||
| 668 | (if (or (and fam (setq fam (if (not (string-match "^[*?]*$" fam)) | ||
| 669 | fam))) | ||
| 670 | family) | ||
| 671 | (setq args (list :family (or fam family)))) | ||
| 672 | (if (or (and wei (setq wei (if (not (string-match "^[*?]*$" wei)) | ||
| 673 | (intern wei)))) | ||
| 674 | weight) | ||
| 675 | (setq args (cons :weight (cons (or wei weight) args)))) | ||
| 676 | (if (or (and sla (setq sla (if (not (string-match "^[*?]*$" sla)) | ||
| 677 | (intern sla)))) | ||
| 678 | slant) | ||
| 679 | (setq args (cons :slant (cons (or sla slant) args)))) | ||
| 680 | (if (or (and wid (setq wid (if (not (string-match "^[*?]*$" wid)) | ||
| 681 | (intern wid)))) | ||
| 682 | width) | ||
| 683 | (setq args (cons :width (cons (or wid width) args)))) | ||
| 684 | (if (or (and ads (setq ads (if (not (string-match "^[*?]*$" ads)) | ||
| 685 | (intern ads)))) | ||
| 686 | adstyle) | ||
| 687 | (setq args (cons :adstyle (cons (or ads adstyle) args)))) | ||
| 688 | (if (or (and reg (setq reg (if (not (string-match "^[*?]*$" reg)) | ||
| 689 | reg))) | ||
| 690 | registry) | ||
| 691 | (setq args (cons :registry (cons (or reg registry) args)))) | ||
| 692 | (setcar (cdr elt) (apply 'font-spec args)))))) | ||
| 693 | fontlist)) | 715 | fontlist)) |
| 694 | 716 | ||
| 695 | (defun fontset-name-p (fontset) | 717 | (defun fontset-name-p (fontset) |
| @@ -828,11 +850,10 @@ which case, the corresponding script is decided by the variable | |||
| 828 | (error "Invalid fontset spec: %s" fontset-spec)) | 850 | (error "Invalid fontset spec: %s" fontset-spec)) |
| 829 | (let ((idx (match-end 0)) | 851 | (let ((idx (match-end 0)) |
| 830 | (name (match-string 0 fontset-spec)) | 852 | (name (match-string 0 fontset-spec)) |
| 831 | xlfd-fields target script fontlist) | 853 | default-spec target script fontlist) |
| 832 | (setq xlfd-fields (x-decompose-font-name name)) | 854 | (or (string-match xlfd-tight-regexp name) |
| 833 | (or xlfd-fields | ||
| 834 | (error "Fontset name \"%s\" not conforming to XLFD" name)) | 855 | (error "Fontset name \"%s\" not conforming to XLFD" name)) |
| 835 | 856 | (setq default-spec (font-spec :name name)) | |
| 836 | ;; At first, extract pairs of charset and fontname from FONTSET-SPEC. | 857 | ;; At first, extract pairs of charset and fontname from FONTSET-SPEC. |
| 837 | (while (string-match "[, \t\n]*\\([^:]+\\):[ \t]*\\([^,]+\\)" | 858 | (while (string-match "[, \t\n]*\\([^:]+\\):[ \t]*\\([^,]+\\)" |
| 838 | fontset-spec idx) | 859 | fontset-spec idx) |
| @@ -847,7 +868,7 @@ which case, the corresponding script is decided by the variable | |||
| 847 | (push (list target (match-string 2 fontset-spec)) fontlist)))) | 868 | (push (list target (match-string 2 fontset-spec)) fontlist)))) |
| 848 | 869 | ||
| 849 | ;; Complement FONTLIST. | 870 | ;; Complement FONTLIST. |
| 850 | (setq fontlist (x-complement-fontset-spec xlfd-fields fontlist)) | 871 | (setq fontlist (x-complement-fontset-spec default-spec fontlist)) |
| 851 | 872 | ||
| 852 | ;; Create a fontset. | 873 | ;; Create a fontset. |
| 853 | (new-fontset name (nreverse fontlist)))) | 874 | (new-fontset name (nreverse fontlist)))) |