2001-07-15 19:53:53 +00:00
|
|
|
|
;;; fontset.el --- commands for handling fontset
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
2011-01-25 04:08:28 +00:00
|
|
|
|
;; Copyright (C) 1997-2011 Free Software Foundation, Inc.
|
2006-12-13 01:13:58 +00:00
|
|
|
|
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
2011-01-02 23:50:46 +00:00
|
|
|
|
;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
2005-05-13 06:03:46 +00:00
|
|
|
|
;; National Institute of Advanced Industrial Science and Technology (AIST)
|
|
|
|
|
;; Registration Number H14PRO021
|
2006-06-06 03:54:18 +00:00
|
|
|
|
;; Copyright (C) 2003, 2006
|
2003-09-08 12:53:41 +00:00
|
|
|
|
;; National Institute of Advanced Industrial Science and Technology (AIST)
|
|
|
|
|
;; Registration Number H13PRO009
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
2002-10-31 22:01:58 +00:00
|
|
|
|
;; Keywords: mule, i18n, fontset
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 04:29:13 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1997-02-20 07:02:49 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 04:29:13 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 04:29:13 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
2001-07-15 19:53:53 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
2002-07-26 04:03:01 +00:00
|
|
|
|
;; Setup font-encoding-alist for all known encodings.
|
|
|
|
|
|
|
|
|
|
(setq font-encoding-alist
|
2011-02-01 21:37:12 +00:00
|
|
|
|
(mapcar (lambda (arg)
|
|
|
|
|
(cons (purecopy (car arg)) (cdr arg)))
|
2002-07-26 04:03:01 +00:00
|
|
|
|
'(("iso8859-1$" . iso-8859-1)
|
|
|
|
|
("iso8859-2$" . iso-8859-2)
|
|
|
|
|
("iso8859-3$" . iso-8859-3)
|
|
|
|
|
("iso8859-4$" . iso-8859-4)
|
|
|
|
|
("iso8859-5$" . iso-8859-5)
|
|
|
|
|
("iso8859-6$" . iso-8859-6)
|
|
|
|
|
("iso8859-7$" . iso-8859-7)
|
|
|
|
|
("iso8859-8$" . iso-8859-8)
|
|
|
|
|
("iso8859-9$" . iso-8859-9)
|
|
|
|
|
("iso8859-10$" . iso-8859-10)
|
|
|
|
|
("iso8859-11$" . iso-8859-11)
|
|
|
|
|
("iso8859-13$" . iso-8859-13)
|
|
|
|
|
("iso8859-14$" . iso-8859-14)
|
|
|
|
|
("iso8859-15$" . iso-8859-15)
|
2008-01-09 02:44:31 +00:00
|
|
|
|
("iso8859-16$" . iso-8859-16)
|
2008-06-09 07:05:35 +00:00
|
|
|
|
("ascii-0$" . ascii)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
("gb2312.1980" . chinese-gb2312)
|
2004-10-05 00:27:52 +00:00
|
|
|
|
("gbk" . chinese-gbk)
|
2008-01-08 05:34:10 +00:00
|
|
|
|
("gb18030" . (unicode . nil))
|
2002-07-26 04:03:01 +00:00
|
|
|
|
("jisx0208.1978" . japanese-jisx0208-1978)
|
|
|
|
|
("jisx0208" . japanese-jisx0208)
|
|
|
|
|
("jisx0201" . jisx0201)
|
|
|
|
|
("jisx0212" . japanese-jisx0212)
|
|
|
|
|
("ksc5601.1987" . korean-ksc5601)
|
|
|
|
|
("cns11643.1992.*1" . chinese-cns11643-1)
|
|
|
|
|
("cns11643.1992.*2" . chinese-cns11643-2)
|
|
|
|
|
("cns11643.1992.*3" . chinese-cns11643-3)
|
|
|
|
|
("cns11643.1992.*4" . chinese-cns11643-4)
|
|
|
|
|
("cns11643.1992.*5" . chinese-cns11643-5)
|
|
|
|
|
("cns11643.1992.*6" . chinese-cns11643-6)
|
|
|
|
|
("cns11643.1992.*7" . chinese-cns11643-7)
|
2004-02-10 11:28:38 +00:00
|
|
|
|
("cns11643.92p1-0" . chinese-cns11643-1)
|
|
|
|
|
("cns11643.92p2-0" . chinese-cns11643-2)
|
|
|
|
|
("cns11643.92p3-0" . chinese-cns11643-3)
|
|
|
|
|
("cns11643.92p4-0" . chinese-cns11643-4)
|
|
|
|
|
("cns11643.92p5-0" . chinese-cns11643-5)
|
|
|
|
|
("cns11643.92p6-0" . chinese-cns11643-6)
|
|
|
|
|
("cns11643.92p7-0" . chinese-cns11643-7)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
("big5" . big5)
|
|
|
|
|
("viscii" . viscii)
|
|
|
|
|
("tis620" . tis620-2533)
|
2005-01-30 11:32:56 +00:00
|
|
|
|
("microsoft-cp1251" . windows-1251)
|
2006-06-06 03:54:18 +00:00
|
|
|
|
("koi8-r" . koi8-r)
|
2007-12-13 04:07:50 +00:00
|
|
|
|
("jisx0213.2000-1" . japanese-jisx0213-1)
|
|
|
|
|
("jisx0213.2000-2" . japanese-jisx0213-2)
|
|
|
|
|
("jisx0213.2004-1" . japanese-jisx0213.2004-1)
|
|
|
|
|
("iso10646-1$" . (unicode-bmp . nil))
|
|
|
|
|
("iso10646.indian-1" . (unicode-bmp . nil))
|
|
|
|
|
("unicode-bmp" . (unicode-bmp . nil))
|
|
|
|
|
("abobe-symbol" . symbol)
|
|
|
|
|
("sisheng_cwnn" . chinese-sisheng)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
("mulearabic-0" . arabic-digit)
|
|
|
|
|
("mulearabic-1" . arabic-1-column)
|
|
|
|
|
("mulearabic-2" . arabic-2-column)
|
|
|
|
|
("muleipa" . ipa)
|
2006-06-28 05:58:24 +00:00
|
|
|
|
("ethiopic-unicode" . (unicode-bmp . ethiopic))
|
2002-07-26 04:03:01 +00:00
|
|
|
|
("is13194-devanagari" . indian-is13194)
|
2003-09-08 12:53:41 +00:00
|
|
|
|
("Devanagari-CDAC" . devanagari-cdac)
|
|
|
|
|
("Sanskrit-CDAC" . sanskrit-cdac)
|
|
|
|
|
("Bengali-CDAC" . bengali-cdac)
|
|
|
|
|
("Assamese-CDAC" . assamese-cdac)
|
|
|
|
|
("Punjabi-CDAC" . punjabi-cdac)
|
|
|
|
|
("Gujarati-CDAC" . gujarati-cdac)
|
|
|
|
|
("Oriya-CDAC" . oriya-cdac)
|
|
|
|
|
("Tamil-CDAC" . tamil-cdac)
|
|
|
|
|
("Telugu-CDAC" . telugu-cdac)
|
|
|
|
|
("Kannada-CDAC" . kannada-cdac)
|
|
|
|
|
("Malayalam-CDAC" . malayalam-cdac)
|
|
|
|
|
("Devanagari-Akruti" . devanagari-akruti)
|
|
|
|
|
("Bengali-Akruti" . bengali-akruti)
|
|
|
|
|
("Punjabi-Akruti" . punjabi-akruti)
|
|
|
|
|
("Gujarati-Akruti" . gujarati-akruti)
|
|
|
|
|
("Oriya-Akruti" . oriya-akruti)
|
|
|
|
|
("Tamil-Akruti" . tamil-akruti)
|
|
|
|
|
("Telugu-Akruti" . telugu-akruti)
|
|
|
|
|
("Kannada-Akruti" . kannada-akruti)
|
|
|
|
|
("Malayalam-Akruti" . malayalam-akruti)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
("muleindian-2" . indian-2-column)
|
|
|
|
|
("muleindian-1" . indian-1-column)
|
|
|
|
|
("mulelao-1" . mule-lao)
|
|
|
|
|
("muletibetan-2" . tibetan)
|
2009-03-24 00:55:36 +00:00
|
|
|
|
("muletibetan-0" . tibetan)
|
2009-10-30 02:00:11 +00:00
|
|
|
|
("muletibetan-1" . tibetan-1-column))))
|
2002-07-26 04:03:01 +00:00
|
|
|
|
|
2008-06-12 03:56:20 +00:00
|
|
|
|
(defvar font-encoding-charset-alist)
|
|
|
|
|
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(setq font-encoding-charset-alist
|
|
|
|
|
'((latin-iso8859-1 . iso-8859-1)
|
|
|
|
|
(latin-iso8859-2 . iso-8859-2)
|
|
|
|
|
(latin-iso8859-3 . iso-8859-3)
|
|
|
|
|
(latin-iso8859-4 . iso-8859-4)
|
|
|
|
|
(latin-iso8859-9 . iso-8859-9)
|
|
|
|
|
(latin-iso8859-10 . iso-8859-10)
|
|
|
|
|
(latin-iso8859-13 . iso-8859-13)
|
|
|
|
|
(latin-iso8859-14 . iso-8859-14)
|
|
|
|
|
(latin-iso8859-15 . iso-8859-15)
|
|
|
|
|
(latin-iso8859-16 . iso-8859-16)
|
|
|
|
|
(cyrillic-iso8859-5 . iso-8859-5)
|
|
|
|
|
(greek-iso8859-7 . iso-8859-7)
|
|
|
|
|
(arabic-iso8859-6 . iso-8859-6)
|
|
|
|
|
(thai-tis620 . tis620-2533)
|
|
|
|
|
(latin-jisx0201 . jisx0201)
|
|
|
|
|
(katakana-jisx0201 . jisx0201)
|
|
|
|
|
(chinese-big5-1 . big5)
|
|
|
|
|
(chinese-big5-2 . big5)
|
|
|
|
|
(vietnamese-viscii-lower . viscii)
|
|
|
|
|
(vietnamese-viscii-upper . viscii)
|
|
|
|
|
(tibetan . unicode-bmp)))
|
|
|
|
|
|
2006-06-06 03:54:18 +00:00
|
|
|
|
(setq script-representative-chars
|
2008-05-22 02:04:33 +00:00
|
|
|
|
'((latin ?A ?Z ?a ?z #x00C0 #x0100 #x0180 #x1e00)
|
|
|
|
|
(phonetic #x250 #x283)
|
2006-06-23 05:08:46 +00:00
|
|
|
|
(greek #x3A9)
|
2006-06-06 03:54:18 +00:00
|
|
|
|
(coptic #x3E2)
|
|
|
|
|
(cyrillic #x42F)
|
|
|
|
|
(armenian #x531)
|
|
|
|
|
(hebrew #x5D0)
|
|
|
|
|
(arabic #x628)
|
|
|
|
|
(syriac #x710)
|
|
|
|
|
(thaana #x78C)
|
|
|
|
|
(devanagari #x915)
|
|
|
|
|
(bengali #x995)
|
|
|
|
|
(gurmukhi #xA15)
|
|
|
|
|
(gujarati #xA95)
|
|
|
|
|
(oriya #xB15)
|
|
|
|
|
(tamil #xB95)
|
|
|
|
|
(telugu #xC15)
|
|
|
|
|
(kannada #xC95)
|
|
|
|
|
(malayalam #xD15)
|
|
|
|
|
(sinhala #xD95)
|
|
|
|
|
(thai #xE17)
|
|
|
|
|
(lao #xEA5)
|
|
|
|
|
(tibetan #xF40)
|
2010-03-01 11:34:11 +00:00
|
|
|
|
(burmese #x1000)
|
2006-06-06 03:54:18 +00:00
|
|
|
|
(georgian #x10D3)
|
|
|
|
|
(ethiopic #x1208)
|
|
|
|
|
(cherokee #x13B6)
|
|
|
|
|
(canadian-aboriginal #x14C0)
|
|
|
|
|
(ogham #x168F)
|
|
|
|
|
(runic #x16A0)
|
|
|
|
|
(khmer #x1780)
|
|
|
|
|
(mongolian #x1826)
|
2008-09-01 02:44:19 +00:00
|
|
|
|
(symbol . [#x201C #x2200 #x2500])
|
2006-06-06 03:54:18 +00:00
|
|
|
|
(braille #x2800)
|
|
|
|
|
(ideographic-description #x2FF0)
|
|
|
|
|
(cjk-misc #x300E)
|
|
|
|
|
(kana #x304B)
|
|
|
|
|
(bopomofo #x3105)
|
|
|
|
|
(kanbun #x319D)
|
|
|
|
|
(han #x5B57)
|
|
|
|
|
(yi #xA288)
|
2008-01-28 07:11:18 +00:00
|
|
|
|
(cham #xAA00)
|
|
|
|
|
(tai-viet #xAA80)
|
2008-12-18 12:55:21 +00:00
|
|
|
|
(hangul #xAC00)
|
|
|
|
|
(linear-b #x10000)
|
|
|
|
|
(aegean-number #x10100)
|
|
|
|
|
(ancient-greek-number #x10140)
|
|
|
|
|
(ancient-symbol #x10190)
|
|
|
|
|
(phaistos-disc #x101D0)
|
|
|
|
|
(lycian #x10280)
|
|
|
|
|
(carian #x102A0)
|
|
|
|
|
(olt-italic #x10300)
|
|
|
|
|
(ugaritic #x10380)
|
|
|
|
|
(old-persian #x103A0)
|
|
|
|
|
(deseret #x10400)
|
|
|
|
|
(shavian #x10450)
|
|
|
|
|
(osmanya #x10480)
|
|
|
|
|
(cypriot-syllabary #x10800)
|
|
|
|
|
(phoenician #x10900)
|
|
|
|
|
(lydian #x10920)
|
|
|
|
|
(kharoshthi #x10A00)
|
|
|
|
|
(cuneiform #x12000)
|
|
|
|
|
(cuneiform-numbers-and-punctuation #x12400)
|
|
|
|
|
(byzantine-musical-symbol #x1D000)
|
|
|
|
|
(musical-symbol #x1D100)
|
|
|
|
|
(ancient-greek-musical-notation #x1D200)
|
|
|
|
|
(tai-xuan-jing-symbol #x1D300)
|
|
|
|
|
(counting-rod-numeral #x1D360)
|
|
|
|
|
(mahjong-tile #x1F000)
|
|
|
|
|
(domino-tile #x1F030)))
|
2002-07-26 04:03:01 +00:00
|
|
|
|
|
2008-06-12 03:56:20 +00:00
|
|
|
|
(defvar otf-script-alist)
|
|
|
|
|
|
2006-07-03 00:52:58 +00:00
|
|
|
|
(setq otf-script-alist
|
|
|
|
|
'((arab . arabic)
|
|
|
|
|
(armn . armenian)
|
|
|
|
|
(bali . balinese)
|
|
|
|
|
(beng . bengali)
|
|
|
|
|
(bopo . bopomofo)
|
|
|
|
|
(brai . braille)
|
|
|
|
|
(bugi . buginese)
|
|
|
|
|
(buhd . buhid)
|
2006-08-28 02:36:40 +00:00
|
|
|
|
(byzm . byzantine-musical-symbol)
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(cans . canadian-aboriginal)
|
2006-07-03 00:52:58 +00:00
|
|
|
|
(cher . cherokee)
|
|
|
|
|
(copt . coptic)
|
|
|
|
|
(xsux . cuneiform)
|
|
|
|
|
(cyrl . cyrillic)
|
|
|
|
|
(cprt . cypriot)
|
|
|
|
|
(dsrt . deseret)
|
|
|
|
|
(deva . devanagari)
|
|
|
|
|
(ethi . ethiopic)
|
|
|
|
|
(geor . georgian)
|
|
|
|
|
(glag . glagolitic)
|
|
|
|
|
(goth . gothic)
|
|
|
|
|
(grek . greek)
|
|
|
|
|
(gujr . gujarati)
|
|
|
|
|
(guru . gurmukhi)
|
|
|
|
|
(hani . han)
|
|
|
|
|
(hang . hangul)
|
|
|
|
|
(hano . hanunoo)
|
|
|
|
|
(hebr . hebrew)
|
|
|
|
|
(kana . kana)
|
|
|
|
|
(knda . kannada)
|
|
|
|
|
(khar . kharoshthi)
|
|
|
|
|
(khmr . khmer)
|
2007-12-01 04:22:41 +00:00
|
|
|
|
(lao\ . lao)
|
2006-07-03 00:52:58 +00:00
|
|
|
|
(latn . latin)
|
|
|
|
|
(limb . limbu)
|
|
|
|
|
(linb . linear_b)
|
|
|
|
|
(mlym . malayalam)
|
2006-08-28 02:36:40 +00:00
|
|
|
|
(math . mathematical)
|
2006-07-03 00:52:58 +00:00
|
|
|
|
(mong . mongolian)
|
2006-08-28 02:36:40 +00:00
|
|
|
|
(musc . musical-symbol)
|
2010-03-01 11:34:11 +00:00
|
|
|
|
(mymr . burmese)
|
2007-12-01 04:22:41 +00:00
|
|
|
|
(nko\ . nko)
|
2006-07-03 00:52:58 +00:00
|
|
|
|
(ogam . ogham)
|
|
|
|
|
(ital . old_italic)
|
|
|
|
|
(xpeo . old_persian)
|
|
|
|
|
(orya . oriya)
|
|
|
|
|
(osma . osmanya)
|
|
|
|
|
(phag . phags-pa)
|
|
|
|
|
(phnx . phoenician)
|
|
|
|
|
(runr . runic)
|
|
|
|
|
(shaw . shavian)
|
|
|
|
|
(sinh . sinhala)
|
|
|
|
|
(sylo . syloti_nagri)
|
|
|
|
|
(syrc . syriac)
|
|
|
|
|
(tglg . tagalog)
|
|
|
|
|
(tagb . tagbanwa)
|
|
|
|
|
(taml . tamil)
|
|
|
|
|
(tale . tai_le)
|
|
|
|
|
(telu . telugu)
|
|
|
|
|
(thaa . thaana)
|
|
|
|
|
(thai . thai)
|
|
|
|
|
(tibt . tibetan)
|
|
|
|
|
(tfng . tifinagh)
|
|
|
|
|
(ugar . ugaritic)
|
2007-12-01 04:22:41 +00:00
|
|
|
|
(yi\ \ . yi)))
|
2006-07-03 00:52:58 +00:00
|
|
|
|
|
2000-05-26 07:33:01 +00:00
|
|
|
|
;; Set standard fontname specification of characters in the default
|
2002-07-26 04:03:01 +00:00
|
|
|
|
;; fontset to find an appropriate font for each script/charset. The
|
|
|
|
|
;; specification has the form ((SCRIPT FONT-SPEC ...) ...), where
|
|
|
|
|
;; FONT-SPEC is:
|
2007-12-03 13:42:35 +00:00
|
|
|
|
;; a cons (FAMILY . REGISTRY),
|
|
|
|
|
;; or a string FONT-NAME,
|
|
|
|
|
;; or an object created by `font-spec'.
|
2003-09-08 12:53:41 +00:00
|
|
|
|
;;
|
2009-10-04 02:11:57 +00:00
|
|
|
|
;; FAMILY may be nil, in which case, the corresponding name of
|
2007-12-03 13:42:35 +00:00
|
|
|
|
;; default face is used. If REGISTRY contains a character `-', the
|
|
|
|
|
;; string before that is embedded in `CHARSET_REGISTRY' field, and the
|
|
|
|
|
;; string after that is embedded in `CHARSET_ENCODING' field. If it
|
|
|
|
|
;; does not contain `-', the whole string is embedded in
|
|
|
|
|
;; `CHARSET_REGISTRY' field, and a wild card character `*' is embedded
|
|
|
|
|
;; in `CHARSET_ENCODING' field.
|
2002-07-26 04:03:01 +00:00
|
|
|
|
;;
|
|
|
|
|
;; SCRIPT is a symbol that appears as an element of the char table
|
|
|
|
|
;; `char-script-table'. SCRIPT may be a charset specifying the range
|
|
|
|
|
;; of characters.
|
2000-05-26 07:33:01 +00:00
|
|
|
|
|
2008-06-12 03:56:20 +00:00
|
|
|
|
(declare-function new-fontset "fontset.c" (name fontlist))
|
|
|
|
|
(declare-function set-fontset-font "fontset.c"
|
|
|
|
|
(name target font-spec &optional frame add))
|
|
|
|
|
|
2009-08-27 06:26:43 +00:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
|
|
|
|
|
;; Build a data to initialize the default fontset at compile time to
|
|
|
|
|
;; avoid loading charsets that won't be necessary at runtime.
|
|
|
|
|
|
|
|
|
|
;; The value is (CJK-REGISTRY-VECTOR TARGET-SPEC ...), where
|
|
|
|
|
;; CJK-REGISTRY-VECTOR is ["JISX0208.1983-0" "GB2312.1980-0" ...],
|
|
|
|
|
;; TARGET-SPEC is (TARGET . BITMASK) or (TARGET SPEC ...),
|
|
|
|
|
;; TARGET is CHAR or (FROM-CHAR . TO-CHAR),
|
|
|
|
|
;; BITMASK is a bitmask of indices to CJK-REGISTRY-VECTOR,
|
|
|
|
|
;; SPEC is a list of arguments to font-spec.
|
|
|
|
|
|
|
|
|
|
(defmacro build-default-fontset-data ()
|
|
|
|
|
(let* (;; CHARSET-REGISTRY CHARSET FROM-CODE TO-CODE
|
|
|
|
|
(cjk '(("JISX0208.1983-0" japanese-jisx0208 #x2121 #x287E)
|
|
|
|
|
("GB2312.1980-0" chinese-gb2312 #x2121 #x297E)
|
|
|
|
|
("BIG5-0" big5 #xA140 #xA3FE)
|
|
|
|
|
("CNS11643.1992-1" chinese-cns11643-1 #x2121 #x427E)
|
|
|
|
|
("KSC5601.1987-0" korean-ksc5601 #x2121 #x2C7E)))
|
|
|
|
|
(scripts '((tibetan
|
|
|
|
|
(:registry "iso10646-1" :otf (tibt nil (ccmp blws abvs)))
|
|
|
|
|
(:family "mtib" :registry "iso10646-1")
|
|
|
|
|
(:registry "muletibetan-2"))
|
|
|
|
|
(ethiopic
|
|
|
|
|
(:registry "iso10646-1" :script ethiopic)
|
|
|
|
|
(:registry "ethiopic-unicode"))
|
|
|
|
|
(phonetic
|
|
|
|
|
(:registry "iso10646-1" :script phonetic)
|
|
|
|
|
(:registry "MuleIPA-1")
|
|
|
|
|
(:registry "iso10646-1"))))
|
|
|
|
|
(cjk-table (make-char-table nil))
|
|
|
|
|
(script-coverage
|
|
|
|
|
#'(lambda (script)
|
|
|
|
|
(let ((coverage))
|
|
|
|
|
(map-char-table
|
|
|
|
|
#'(lambda (range val)
|
|
|
|
|
(when (eq val script)
|
|
|
|
|
(if (consp range)
|
|
|
|
|
(setq range (cons (car range) (cdr range))))
|
|
|
|
|
(push range coverage)))
|
|
|
|
|
char-script-table)
|
|
|
|
|
coverage)))
|
|
|
|
|
(data (list (vconcat (mapcar 'car cjk))))
|
|
|
|
|
(i 0))
|
|
|
|
|
(dolist (elt cjk)
|
|
|
|
|
(let ((mask (lsh 1 i)))
|
|
|
|
|
(map-charset-chars
|
|
|
|
|
#'(lambda (range arg)
|
|
|
|
|
(let ((from (car range)) (to (cdr range)))
|
|
|
|
|
(if (< to #x110000)
|
|
|
|
|
(while (<= from to)
|
2010-01-08 01:46:22 +00:00
|
|
|
|
(or (memq (aref char-script-table from)
|
|
|
|
|
'(kana hangul han cjk-misc))
|
|
|
|
|
(aset cjk-table from
|
|
|
|
|
(logior (or (aref cjk-table from) 0) mask)))
|
2009-08-27 06:26:43 +00:00
|
|
|
|
(setq from (1+ from))))))
|
|
|
|
|
(nth 1 elt) nil (nth 2 elt) (nth 3 elt)))
|
|
|
|
|
(setq i (1+ i)))
|
|
|
|
|
(map-char-table
|
|
|
|
|
#'(lambda (range val)
|
|
|
|
|
(if (consp range)
|
|
|
|
|
(setq range (cons (car range) (cdr range))))
|
|
|
|
|
(push (cons range val) data))
|
|
|
|
|
cjk-table)
|
|
|
|
|
(dolist (script scripts)
|
|
|
|
|
(dolist (range (funcall script-coverage (car script)))
|
|
|
|
|
(push (cons range (cdr script)) data)))
|
|
|
|
|
`(quote ,(nreverse data))))
|
|
|
|
|
)
|
|
|
|
|
|
2003-01-17 08:13:39 +00:00
|
|
|
|
(defun setup-default-fontset ()
|
|
|
|
|
"Setup the default fontset."
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(new-fontset
|
|
|
|
|
"fontset-default"
|
2007-12-01 04:22:41 +00:00
|
|
|
|
`(;; for each script
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(latin (nil . "ISO8859-1")
|
|
|
|
|
(nil . "ISO8859-2")
|
|
|
|
|
(nil . "ISO8859-3")
|
|
|
|
|
(nil . "ISO8859-4")
|
|
|
|
|
(nil . "ISO8859-9")
|
|
|
|
|
(nil . "ISO8859-10")
|
|
|
|
|
(nil . "ISO8859-13")
|
|
|
|
|
(nil . "ISO8859-14")
|
|
|
|
|
(nil . "ISO8859-15")
|
2008-01-09 02:44:31 +00:00
|
|
|
|
(nil . "ISO8859-16")
|
2008-01-28 07:11:18 +00:00
|
|
|
|
(nil . "VISCII1.1-1")
|
2008-06-20 08:00:56 +00:00
|
|
|
|
,(font-spec :registry "iso10646-1" :script 'latin))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2009-06-19 01:51:07 +00:00
|
|
|
|
(thai ,(font-spec :registry "iso10646-1" :otf '(thai nil nil (mark)))
|
|
|
|
|
,(font-spec :registry "iso10646-1" :script 'thai)
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(nil . "TIS620*")
|
|
|
|
|
(nil . "ISO8859-11"))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2007-12-01 04:22:41 +00:00
|
|
|
|
(devanagari ,(font-spec :registry "iso10646-1" :otf '(deva nil (rphf)))
|
|
|
|
|
(nil . "iso10646.indian-1"))
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(bengali ,(font-spec :registry "iso10646-1" :otf '(beng nil (rphf))))
|
|
|
|
|
(gurmukhi ,(font-spec :registry "iso10646-1" :otf '(guru nil (blwf))))
|
|
|
|
|
(gujarati ,(font-spec :registry "iso10646-1" :otf '(gujr nil (rphf))))
|
|
|
|
|
(oriya ,(font-spec :registry "iso10646-1" :otf '(orya nil (rphf))))
|
2007-12-01 04:22:41 +00:00
|
|
|
|
(tamil ,(font-spec :registry "iso10646-1" :otf '(taml nil (akhn))))
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(telugu ,(font-spec :registry "iso10646-1" :otf '(telu nil (blwf))))
|
|
|
|
|
(kannada ,(font-spec :registry "iso10646-1" :otf '(knda nil (rphf))))
|
|
|
|
|
(sinhala ,(font-spec :registry "iso10646-1" :otf '(sinh nil (akhn))))
|
|
|
|
|
(malayalam ,(font-spec :registry "iso10646-1" :otf '(mlym nil (akhn))))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2010-03-01 11:50:57 +00:00
|
|
|
|
(burmese ,(font-spec :registry "iso10646-1" :otf '(mymr nil nil))
|
2010-03-01 11:34:11 +00:00
|
|
|
|
,(font-spec :registry "iso10646-1" :script 'burmese))
|
2010-02-26 12:40:46 +00:00
|
|
|
|
|
2007-12-28 02:06:38 +00:00
|
|
|
|
(lao ,(font-spec :registry "iso10646-1" :otf '(lao\ nil nil (mark)))
|
2008-02-25 01:40:09 +00:00
|
|
|
|
,(font-spec :registry "iso10646-1" :script 'lao)
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(nil . "MuleLao-1"))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2007-06-16 02:15:01 +00:00
|
|
|
|
(tai-viet ("TaiViet" . "iso10646-1"))
|
|
|
|
|
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(greek ,(font-spec :registry "iso10646-1" :script 'greek)
|
|
|
|
|
(nil . "ISO8859-7"))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(cyrillic ,(font-spec :registry "iso10646-1" :script 'cyrillic)
|
|
|
|
|
(nil . "ISO8859-5")
|
2005-01-30 11:32:56 +00:00
|
|
|
|
(nil . "microsoft-cp1251")
|
|
|
|
|
(nil . "koi8-r"))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(arabic ,(font-spec :registry "iso10646-1"
|
2010-08-25 05:13:27 +00:00
|
|
|
|
:otf '(arab nil (init medi fina liga)))
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(nil . "MuleArabic-0")
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(nil . "MuleArabic-1")
|
|
|
|
|
(nil . "MuleArabic-2")
|
|
|
|
|
(nil . "ISO8859-6"))
|
|
|
|
|
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(hebrew ,(font-spec :registry "iso10646-1" :script 'hebrew)
|
|
|
|
|
(nil . "ISO8859-8"))
|
|
|
|
|
|
|
|
|
|
(khmer ,(font-spec :registry "iso10646-1" :otf '(khmr nil (pres))))
|
|
|
|
|
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(kana (nil . "JISX0208*")
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(nil . "GB2312.1980-0")
|
|
|
|
|
(nil . "KSC5601.1987*")
|
2004-02-06 11:12:09 +00:00
|
|
|
|
(nil . "JISX0201*")
|
|
|
|
|
(nil . "JISX0213.2000-1")
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(nil . "JISX0213.2004-1")
|
|
|
|
|
,(font-spec :registry "iso10646-1" :script 'kana))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2008-04-01 14:09:58 +00:00
|
|
|
|
(bopomofo ,(font-spec :registry "iso10646-1" :script 'bopomofo)
|
|
|
|
|
(nil . "sisheng_cwnn-0"))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(han (nil . "GB2312.1980-0")
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(nil . "JISX0208*")
|
|
|
|
|
(nil . "JISX0212*")
|
|
|
|
|
(nil . "big5*")
|
|
|
|
|
(nil . "KSC5601.1987*")
|
|
|
|
|
(nil . "CNS11643.1992-1")
|
|
|
|
|
(nil . "CNS11643.1992-2")
|
|
|
|
|
(nil . "CNS11643.1992-3")
|
|
|
|
|
(nil . "CNS11643.1992-4")
|
|
|
|
|
(nil . "CNS11643.1992-5")
|
|
|
|
|
(nil . "CNS11643.1992-6")
|
|
|
|
|
(nil . "CNS11643.1992-7")
|
|
|
|
|
(nil . "gbk-0")
|
2006-11-27 04:43:04 +00:00
|
|
|
|
(nil . "gb18030")
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(nil . "JISX0213.2000-1")
|
2004-02-05 04:35:19 +00:00
|
|
|
|
(nil . "JISX0213.2000-2")
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(nil . "JISX0213.2004-1")
|
|
|
|
|
,(font-spec :registry "iso10646-1" :lang 'ja)
|
|
|
|
|
,(font-spec :registry "iso10646-1" :lang 'zh))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(cjk-misc (nil . "GB2312.1980-0")
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(nil . "JISX0208*")
|
|
|
|
|
(nil . "JISX0212*")
|
|
|
|
|
(nil . "big5*")
|
|
|
|
|
(nil . "KSC5601.1987*")
|
|
|
|
|
(nil . "CNS11643.1992-1")
|
|
|
|
|
(nil . "CNS11643.1992-2")
|
|
|
|
|
(nil . "CNS11643.1992-3")
|
|
|
|
|
(nil . "CNS11643.1992-4")
|
|
|
|
|
(nil . "CNS11643.1992-5")
|
|
|
|
|
(nil . "CNS11643.1992-6")
|
|
|
|
|
(nil . "CNS11643.1992-7")
|
|
|
|
|
(nil . "gbk-0")
|
2006-11-27 04:43:04 +00:00
|
|
|
|
(nil . "gb18030")
|
2003-09-08 12:53:41 +00:00
|
|
|
|
(nil . "JISX0213.2000-1")
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(nil . "JISX0213.2000-2")
|
2008-06-20 08:00:56 +00:00
|
|
|
|
,(font-spec :registry "iso10646-1" :lang 'ja)
|
|
|
|
|
,(font-spec :registry "iso10646-1" :lang 'zh))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(hangul (nil . "KSC5601.1987-0")
|
2008-06-20 08:00:56 +00:00
|
|
|
|
,(font-spec :registry "iso10646-1" :lang 'ko))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
|
|
|
|
|
;; for each charset
|
|
|
|
|
(ascii (nil . "ISO8859-1"))
|
|
|
|
|
(arabic-digit ("*" . "MuleArabic-0"))
|
|
|
|
|
(arabic-1-column ("*" . "MuleArabic-1"))
|
|
|
|
|
(arabic-2-column ("*" . "MuleArabic-2"))
|
|
|
|
|
(indian-is13194 (nil . "is13194-devanagari"))
|
|
|
|
|
(indian-1-column ("*" . "muleindian-2"))
|
|
|
|
|
;; Indian CDAC
|
|
|
|
|
(devanagari-cdac (nil . "Devanagari-CDAC"))
|
|
|
|
|
(sanskrit-cdac (nil . "Sanskrit-CDAC"))
|
|
|
|
|
(bengali-cdac (nil . "Bengali-CDAC"))
|
|
|
|
|
(assamese-cdac (nil . "Assamese-CDAC"))
|
|
|
|
|
(punjabi-cdac (nil . "Punjabi-CDAC"))
|
|
|
|
|
(gujarati-cdac (nil . "Gujarati-CDAC"))
|
|
|
|
|
(oriya-cdac (nil . "Oriya-CDAC"))
|
|
|
|
|
(tamil-cdac (nil . "Tamil-CDAC"))
|
|
|
|
|
(telugu-cdac (nil . "Telugu-CDAC"))
|
|
|
|
|
(kannada-cdac (nil . "Kannada-CDAC"))
|
|
|
|
|
(malayalam-cdac (nil . "Malayalam-CDAC"))
|
|
|
|
|
;; Indian AKRUTI
|
|
|
|
|
(devanagari-akruti (nil . "Devanagari-Akruti"))
|
|
|
|
|
(bengali-akruti (nil . "Bengali-Akruti"))
|
|
|
|
|
(punjabi-akruti (nil . "Punjabi-Akruti"))
|
|
|
|
|
(gujarati-akruti (nil . "Gujarati-Akruti"))
|
|
|
|
|
(oriya-akruti (nil . "Oriya-Akruti"))
|
|
|
|
|
(tamil-akruti (nil . "Tamil-Akruti"))
|
|
|
|
|
(telugu-akruti (nil . "Telugu-Akruti"))
|
|
|
|
|
(kannada-akruti (nil . "Kannada-Akruti"))
|
|
|
|
|
(malayalam-akruti (nil . "Malayalam-Akruti"))
|
2004-02-06 11:12:09 +00:00
|
|
|
|
|
|
|
|
|
;; Fallback fonts
|
|
|
|
|
(nil (nil . "gb2312.1980")
|
2006-11-27 04:43:04 +00:00
|
|
|
|
(nil . "gbk-0")
|
|
|
|
|
(nil . "gb18030")
|
2004-02-06 11:12:09 +00:00
|
|
|
|
(nil . "jisx0208")
|
|
|
|
|
(nil . "ksc5601.1987")
|
2004-02-10 11:28:38 +00:00
|
|
|
|
(nil . "CNS11643.1992-1")
|
|
|
|
|
(nil . "CNS11643.1992-2")
|
|
|
|
|
(nil . "CNS11643.1992-3")
|
|
|
|
|
(nil . "CNS11643.1992-4")
|
|
|
|
|
(nil . "CNS11643.1992-5")
|
|
|
|
|
(nil . "CNS11643.1992-6")
|
|
|
|
|
(nil . "CNS11643.1992-7")
|
2004-02-06 11:12:09 +00:00
|
|
|
|
(nil . "big5")
|
|
|
|
|
(nil . "jisx0213.2000-1")
|
|
|
|
|
(nil . "jisx0213.2004-1")
|
|
|
|
|
(nil . "jisx0212"))
|
2003-09-08 12:53:41 +00:00
|
|
|
|
))
|
|
|
|
|
|
2008-12-18 12:55:21 +00:00
|
|
|
|
;; For simple scripts
|
|
|
|
|
(dolist (script '(phonetic
|
|
|
|
|
armenian
|
|
|
|
|
syriac
|
|
|
|
|
thaana
|
|
|
|
|
georgian
|
|
|
|
|
cherokee
|
|
|
|
|
canadian-aboriginal
|
|
|
|
|
ogham
|
|
|
|
|
runic
|
|
|
|
|
symbol
|
|
|
|
|
braille
|
|
|
|
|
yi
|
2009-01-11 04:05:32 +00:00
|
|
|
|
aegean-number
|
2008-12-18 12:55:21 +00:00
|
|
|
|
ancient-greek-number
|
|
|
|
|
ancient-symbol
|
|
|
|
|
phaistos-disc
|
|
|
|
|
lycian
|
|
|
|
|
carian
|
|
|
|
|
olt-italic
|
|
|
|
|
ugaritic
|
|
|
|
|
old-persian
|
|
|
|
|
deseret
|
|
|
|
|
shavian
|
|
|
|
|
osmanya
|
|
|
|
|
cypriot-syllabary
|
|
|
|
|
phoenician
|
|
|
|
|
lydian
|
|
|
|
|
kharoshthi
|
|
|
|
|
cuneiform
|
|
|
|
|
cuneiform-numbers-and-punctuation
|
|
|
|
|
byzantine-musical-symbol
|
|
|
|
|
musical-symbol
|
|
|
|
|
ancient-greek-musical-notation
|
|
|
|
|
tai-xuan-jing-symbol
|
|
|
|
|
counting-rod-numeral
|
|
|
|
|
mahjong-tile
|
|
|
|
|
domino-tile))
|
|
|
|
|
(set-fontset-font "fontset-default"
|
2009-07-08 07:23:55 +00:00
|
|
|
|
script (font-spec :registry "iso10646-1" :script script)
|
|
|
|
|
nil 'append))
|
2008-12-18 12:55:21 +00:00
|
|
|
|
|
2009-02-05 06:23:19 +00:00
|
|
|
|
;; Special settings for `MATHEMATICAL (U+1D400..U+1D7FF)'.
|
|
|
|
|
(dolist (math-subgroup '((#x1D400 #x1D433 mathematical-bold)
|
|
|
|
|
(#x1D434 #x1D467 mathematical-italic)
|
|
|
|
|
(#x1D468 #x1D49B mathematical-bold-italic)
|
|
|
|
|
(#x1D49C #x1D4CF mathematical-script)
|
|
|
|
|
(#x1D4D0 #x1D503 mathematical-bold-script)
|
|
|
|
|
(#x1D504 #x1D537 mathematical-fraktur)
|
|
|
|
|
(#x1D538 #x1D56B mathematical-double-struck)
|
|
|
|
|
(#x1D56C #x1D59F mathematical-bold-fraktur)
|
|
|
|
|
(#x1D5A0 #x1D5D3 mathematical-sans-serif)
|
|
|
|
|
(#x1D5D4 #x1D607 mathematical-sans-serif-bold)
|
|
|
|
|
(#x1D608 #x1D63B mathematical-sans-serif-italic)
|
|
|
|
|
(#x1D63C #x1D66F mathematical-sans-serif-bold-italic)
|
|
|
|
|
(#x1D670 #x1D6A3 mathematical-monospace)
|
|
|
|
|
(#x1D6A4 #x1D6A5 mathematical-italic)
|
|
|
|
|
(#x1D6A8 #x1D6E1 mathematical-bold)
|
|
|
|
|
(#x1D6E2 #x1D71B mathematical-italic)
|
|
|
|
|
(#x1D71C #x1D755 mathematical-bold-italic)
|
|
|
|
|
(#x1D756 #x1D78F mathematical-sans-serif-bold)
|
|
|
|
|
(#x1D790 #x1D7C9 mathematical-sans-serif-bold-italic)
|
|
|
|
|
(#x1D7CA #x1D7D7 mathematical-bold)
|
|
|
|
|
(#x1D7D8 #x1D7E1 mathematical-double-struck)
|
|
|
|
|
(#x1D7E2 #x1D7EB mathematical-sans-serif)
|
|
|
|
|
(#x1D7EC #x1D7F5 mathematical-sans-serif-bold)
|
|
|
|
|
(#x1D7F6 #x1D7FF mathematical-monospace)))
|
|
|
|
|
(let ((slot (assq (nth 2 math-subgroup) script-representative-chars)))
|
|
|
|
|
(if slot
|
|
|
|
|
(if (vectorp (cdr slot))
|
|
|
|
|
(setcdr slot (vconcat (cdr slot) (vector (car math-subgroup))))
|
|
|
|
|
(setcdr slot (vector (cadr slot) (car math-subgroup))))
|
|
|
|
|
(setq slot (list (nth 2 math-subgroup) (car math-subgroup)))
|
2009-02-05 07:09:47 +00:00
|
|
|
|
(nconc script-representative-chars (list slot))))
|
2009-02-05 06:23:19 +00:00
|
|
|
|
(set-fontset-font
|
|
|
|
|
"fontset-default"
|
|
|
|
|
(cons (car math-subgroup) (nth 1 math-subgroup))
|
|
|
|
|
(font-spec :registry "iso10646-1" :script (nth 2 math-subgroup))))
|
|
|
|
|
|
2009-06-30 02:16:32 +00:00
|
|
|
|
;; Append CJK fonts for characters other than han, kana, cjk-misc.
|
2009-08-27 06:26:43 +00:00
|
|
|
|
;; Append fonts for scripts whose name is also a charset name.
|
|
|
|
|
(let* ((data (build-default-fontset-data))
|
|
|
|
|
(registries (car data)))
|
|
|
|
|
(dolist (target-spec (cdr data))
|
|
|
|
|
(let ((target (car target-spec))
|
|
|
|
|
(spec (cdr target-spec)))
|
|
|
|
|
(if (integerp spec)
|
|
|
|
|
(dotimes (i (length registries))
|
|
|
|
|
(if (> (logand spec (lsh 1 i)) 0)
|
|
|
|
|
(set-fontset-font "fontset-default" target
|
|
|
|
|
(cons nil (aref registries i))
|
|
|
|
|
nil 'append)))
|
|
|
|
|
(dolist (args spec)
|
|
|
|
|
(set-fontset-font "fontset-default" target
|
|
|
|
|
(apply 'font-spec args) nil 'append))))))
|
2009-06-30 02:16:32 +00:00
|
|
|
|
|
2003-09-08 12:53:41 +00:00
|
|
|
|
;; Append Unicode fonts.
|
|
|
|
|
;; This may find fonts with more variants (bold, italic) but which
|
|
|
|
|
;; don't cover many characters.
|
2004-02-06 11:12:09 +00:00
|
|
|
|
(set-fontset-font "fontset-default" nil
|
2008-08-29 08:02:01 +00:00
|
|
|
|
'(nil . "iso10646-1") nil 'prepend)
|
2003-09-08 12:53:41 +00:00
|
|
|
|
;; These may find fonts that cover many characters but with fewer
|
|
|
|
|
;; variants.
|
2004-02-06 11:12:09 +00:00
|
|
|
|
(set-fontset-font "fontset-default" nil
|
2008-08-29 08:02:01 +00:00
|
|
|
|
'("gnu-unifont" . "iso10646-1") nil 'prepend)
|
2004-02-06 11:12:09 +00:00
|
|
|
|
(set-fontset-font "fontset-default" nil
|
2008-08-29 08:02:01 +00:00
|
|
|
|
'("mutt-clearlyu" . "iso10646-1") nil 'prepend)
|
2008-12-10 06:05:52 +00:00
|
|
|
|
(set-fontset-font "fontset-default" '(#x20000 . #x2FFFF)
|
|
|
|
|
'(nil . "unicode-sip"))
|
2008-01-28 07:11:18 +00:00
|
|
|
|
|
2009-04-02 02:50:06 +00:00
|
|
|
|
(set-fontset-font "fontset-default" '(#xE000 . #xF8FF)
|
|
|
|
|
'(nil . "iso10646-1"))
|
|
|
|
|
;; Don't try the fallback fonts even if no suitable font was found
|
|
|
|
|
;; by the above font-spec.
|
|
|
|
|
(set-fontset-font "fontset-default" '(#xE000 . #xF8FF) nil nil 'append))
|
2002-03-01 02:07:40 +00:00
|
|
|
|
|
2009-03-19 00:55:36 +00:00
|
|
|
|
(defun create-default-fontset ()
|
|
|
|
|
"Create the default fontset.
|
|
|
|
|
Internal use only. Should be called at startup time."
|
|
|
|
|
(condition-case err
|
|
|
|
|
(setup-default-fontset)
|
|
|
|
|
(error (display-warning
|
|
|
|
|
'initialization
|
|
|
|
|
(format "Creation of the default fontsets failed: %s" err)
|
|
|
|
|
:error))))
|
|
|
|
|
|
2002-10-31 22:01:58 +00:00
|
|
|
|
;; These are the registered registries/encodings from
|
|
|
|
|
;; ftp://ftp.x.org/pub/DOCS/registry 2001/06/01
|
|
|
|
|
|
|
|
|
|
;; Name Reference
|
|
|
|
|
;; ---- ---------
|
|
|
|
|
;; "DEC" [27]
|
|
|
|
|
;; registry prefix
|
|
|
|
|
;; "DEC.CNS11643.1986-2" [53]
|
|
|
|
|
;; CNS11643 2-plane using the encoding
|
|
|
|
|
;; suggested in that standard
|
|
|
|
|
;; "DEC.DTSCS.1990-2" [54]
|
|
|
|
|
;; DEC Taiwan Supplemental Character Set
|
|
|
|
|
;; "fujitsu.u90x01.1991-0" [87]
|
|
|
|
|
;; "fujitsu.u90x03.1991-0" [87]
|
|
|
|
|
;; "GB2312.1980-0" [39],[12]
|
|
|
|
|
;; China (PRC) Hanzi, GL encoding
|
|
|
|
|
;; "GB2312.1980-1" [39]
|
|
|
|
|
;; (deprecated)
|
|
|
|
|
;; China (PRC) Hanzi, GR encoding
|
|
|
|
|
;; "HP-Arabic8" [36]
|
|
|
|
|
;; HPARABIC8 8-bit character set
|
|
|
|
|
;; "HP-East8" [36]
|
|
|
|
|
;; HPEAST8 8-bit character set
|
|
|
|
|
;; "HP-Greek8" [36]
|
|
|
|
|
;; HPGREEK8 8-bit character set
|
|
|
|
|
;; "HP-Hebrew8" [36]
|
|
|
|
|
;; HPHEBREW8 8-bit character set
|
|
|
|
|
;; "HP-Japanese15" [36]
|
2010-10-12 15:16:57 +00:00
|
|
|
|
;; HPJAPAN15 15-bit character set,
|
2002-10-31 22:01:58 +00:00
|
|
|
|
;; modified from industry defacto
|
|
|
|
|
;; standard Shift-JIS
|
|
|
|
|
;; "HP-Kana8" [36]
|
|
|
|
|
;; HPKANA8 8-bit character set
|
|
|
|
|
;; "HP-Korean15" [36]
|
|
|
|
|
;; HPKOREAN15 15-bit character set
|
|
|
|
|
;; "HP-Roman8" [36]
|
|
|
|
|
;; HPROMAN8 8-bit character set
|
|
|
|
|
;; "HP-SChinese15" [36]
|
|
|
|
|
;; HPSCHINA15 15-bit character set for
|
|
|
|
|
;; support of Simplified Chinese
|
|
|
|
|
;; "HP-TChinese15" [36]
|
|
|
|
|
;; HPTCHINA15 15-bit character set for
|
|
|
|
|
;; support of Traditional Chinese
|
|
|
|
|
;; "HP-Turkish8" [36]
|
|
|
|
|
;; HPTURKISH8 8-bit character set
|
|
|
|
|
;; "IPSYS" [59]
|
|
|
|
|
;; registry prefix
|
|
|
|
|
;; "IPSYS.IE-1" [59]
|
|
|
|
|
;; "ISO2022"<REG>"-"<ENC> [44]
|
|
|
|
|
;; "ISO646.1991-IRV" [107]
|
|
|
|
|
;; ISO 646 International Reference Version
|
|
|
|
|
;; "ISO8859-1" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 1
|
|
|
|
|
;; "ISO8859-2" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 2
|
|
|
|
|
;; "ISO8859-3" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 3
|
|
|
|
|
;; "ISO8859-4" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 4
|
|
|
|
|
;; "ISO8859-5" [15],[12]
|
|
|
|
|
;; ISO Latin/Cyrillic alphabet
|
|
|
|
|
;; "ISO8859-6" [15],[12]
|
|
|
|
|
;; ISO Latin/Arabic alphabet
|
|
|
|
|
;; "ISO8859-7" [15],[12]
|
|
|
|
|
;; ISO Latin/Greek alphabet
|
|
|
|
|
;; "ISO8859-8" [15],[12]
|
|
|
|
|
;; ISO Latin/Hebrew alphabet
|
|
|
|
|
;; "ISO8859-9" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 5
|
|
|
|
|
;; "ISO8859-10" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 6
|
|
|
|
|
;; "ISO8859-13" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 7
|
|
|
|
|
;; "ISO8859-14" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 8
|
|
|
|
|
;; "ISO8859-15" [15],[12]
|
|
|
|
|
;; ISO Latin alphabet No. 9
|
|
|
|
|
;; "FCD8859-15" [7]
|
|
|
|
|
;; (deprecated)
|
|
|
|
|
;; ISO Latin alphabet No. 9, Final Committee Draft
|
|
|
|
|
;; "ISO10646-1" [133]
|
|
|
|
|
;; Unicode Universal Multiple-Octet Coded Character Set
|
|
|
|
|
;; "ISO10646-MES" [133]
|
|
|
|
|
;; (deprecated)
|
|
|
|
|
;; Unicode Minimum European Subset
|
|
|
|
|
;; "JISX0201.1976-0" [38],[12]
|
|
|
|
|
;; 8-Bit Alphanumeric-Katakana Code
|
|
|
|
|
;; "JISX0208.1983-0" [40],[12]
|
|
|
|
|
;; Japanese Graphic Character Set,
|
|
|
|
|
;; GL encoding
|
|
|
|
|
;; "JISX0208.1990-0" [71]
|
|
|
|
|
;; Japanese Graphic Character Set,
|
|
|
|
|
;; GL encoding
|
|
|
|
|
;; "JISX0208.1983-1" [40]
|
|
|
|
|
;; (deprecated)
|
|
|
|
|
;; Japanese Graphic Character Set,
|
|
|
|
|
;; GR encoding
|
|
|
|
|
;; "JISX0212.1990-0" [72]
|
|
|
|
|
;; Supplementary Japanese Graphic Character Set,
|
|
|
|
|
;; GL encoding
|
|
|
|
|
;; "KOI8-R" [119]
|
|
|
|
|
;; Cyrillic alphabet
|
|
|
|
|
;; "KSC5601.1987-0" [41],[12]
|
|
|
|
|
;; Korean Graphic Character Set,
|
|
|
|
|
;; GL encoding
|
|
|
|
|
;; "KSC5601.1987-1" [41]
|
|
|
|
|
;; (deprecated)
|
|
|
|
|
;; Korean Graphic Character Set,
|
|
|
|
|
;; GR encoding
|
|
|
|
|
;; "omron_CNS11643-0" [45]
|
|
|
|
|
;; "omron_CNS11643-1" [45]
|
|
|
|
|
;; "omron_BIG5-0" [45]
|
|
|
|
|
;; "omron_BIG5-1" [45]
|
|
|
|
|
;; "wn.tamil.1993" [103]
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(defun set-font-encoding (pattern charset)
|
2002-10-31 22:01:58 +00:00
|
|
|
|
"Set arguments in `font-encoding-alist' (which see)."
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(let ((slot (assoc pattern font-encoding-alist)))
|
|
|
|
|
(if slot
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(setcdr slot charset)
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(setq font-encoding-alist
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(cons (cons pattern charset) font-encoding-alist)))))
|
2000-10-19 07:09:20 +00:00
|
|
|
|
|
2008-06-12 03:56:20 +00:00
|
|
|
|
(defvar x-pixel-size-width-font-regexp)
|
|
|
|
|
(defvar vertical-centering-font-regexp)
|
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
;; Setting for suppressing XLoadQueryFont on big fonts.
|
|
|
|
|
(setq x-pixel-size-width-font-regexp
|
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
(tex-dvi-print-command, tex-bibtex-command, tex-start-commands)
(tex-start-options, slitex-run-command, latex-run-command)
(tex-run-command, tex-directory):
* textmodes/ispell.el (ispell-html-skip-alists)
(ispell-tex-skip-alists, ispell-tex-skip-alists):
* textmodes/fill.el (adaptive-fill-first-line-regexp):
(adaptive-fill-regexp):
* textmodes/dns-mode.el (auto-mode-alist):
* progmodes/python.el (interpreter-mode-alist):
* progmodes/etags.el (tags-compression-info-list):
* progmodes/etags.el (tags-file-name):
* net/browse-url.el (browse-url-galeon-program)
(browse-url-firefox-program):
* mail/sendmail.el (mail-signature-file)
(mail-citation-prefix-regexp):
* international/mule-conf.el (eight-bit):
* international/latexenc.el (latex-inputenc-coding-alist):
* international/fontset.el (x-pixel-size-width-font-regexp):
* emacs-lisp/warnings.el (warning-type-format):
* emacs-lisp/trace.el (trace-buffer):
* emacs-lisp/lisp-mode.el (lisp-interaction-mode-map)
(emacs-lisp-mode-map):
* calendar/holidays.el (holiday-solar-holidays)
(holiday-bahai-holidays, holiday-islamic-holidays)
(holiday-christian-holidays, holiday-hebrew-holidays)
(hebrew-holidays-4, hebrew-holidays-3, hebrew-holidays-2)
(hebrew-holidays-1, holiday-oriental-holidays)
(holiday-general-holidays):
* x-dnd.el (x-dnd-known-types):
* tool-bar.el (tool-bar):
* startup.el (site-run-file):
* shell.el (shell-dumb-shell-regexp):
* rfn-eshadow.el (file-name-shadow-tty-properties)
(file-name-shadow-properties):
* paths.el (remote-shell-program, news-directory):
* mouse.el ([C-down-mouse-3]):
* menu-bar.el (menu-bar-tools-menu):
* jka-cmpr-hook.el (jka-compr-load-suffixes)
(jka-compr-mode-alist-additions, jka-compr-compression-info-list)
(jka-compr-compression-info-list):
* isearch.el (search-whitespace-regexp):
* image-file.el (image-file-name-extensions):
* find-dired.el (find-ls-option):
* files.el (directory-listing-before-filename-regexp)
(directory-free-space-args, insert-directory-program)
(list-directory-brief-switches, magic-fallback-mode-alist)
(magic-fallback-mode-alist, auto-mode-interpreter-regexp)
(automount-dir-prefix):
* faces.el (face-x-resources, x-font-regexp, x-font-regexp-head)
(x-font-regexp-slant, x-font-regexp-weight, face-x-resources)
(face-font-registry-alternatives, face-font-registry-alternatives)
(face-font-family-alternatives):
* facemenu.el (facemenu-add-new-face, facemenu-background-menu)
(facemenu-foreground-menu, facemenu-face-menu):
* epa-hook.el (epa-file-name-regexp):
* dnd.el (dnd-protocol-alist):
* textmodes/rst.el (auto-mode-alist):
* button.el (default-button): Purecopy strings.
2009-11-06 05:16:23 +00:00
|
|
|
|
(purecopy "gb2312\\|gbk\\|gb18030\\|jisx0208\\|ksc5601\\|cns11643\\|big5"))
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
2000-03-21 00:32:06 +00:00
|
|
|
|
;; These fonts require vertical centering.
|
1999-12-15 00:40:24 +00:00
|
|
|
|
(setq vertical-centering-font-regexp
|
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
(tex-dvi-print-command, tex-bibtex-command, tex-start-commands)
(tex-start-options, slitex-run-command, latex-run-command)
(tex-run-command, tex-directory):
* textmodes/ispell.el (ispell-html-skip-alists)
(ispell-tex-skip-alists, ispell-tex-skip-alists):
* textmodes/fill.el (adaptive-fill-first-line-regexp):
(adaptive-fill-regexp):
* textmodes/dns-mode.el (auto-mode-alist):
* progmodes/python.el (interpreter-mode-alist):
* progmodes/etags.el (tags-compression-info-list):
* progmodes/etags.el (tags-file-name):
* net/browse-url.el (browse-url-galeon-program)
(browse-url-firefox-program):
* mail/sendmail.el (mail-signature-file)
(mail-citation-prefix-regexp):
* international/mule-conf.el (eight-bit):
* international/latexenc.el (latex-inputenc-coding-alist):
* international/fontset.el (x-pixel-size-width-font-regexp):
* emacs-lisp/warnings.el (warning-type-format):
* emacs-lisp/trace.el (trace-buffer):
* emacs-lisp/lisp-mode.el (lisp-interaction-mode-map)
(emacs-lisp-mode-map):
* calendar/holidays.el (holiday-solar-holidays)
(holiday-bahai-holidays, holiday-islamic-holidays)
(holiday-christian-holidays, holiday-hebrew-holidays)
(hebrew-holidays-4, hebrew-holidays-3, hebrew-holidays-2)
(hebrew-holidays-1, holiday-oriental-holidays)
(holiday-general-holidays):
* x-dnd.el (x-dnd-known-types):
* tool-bar.el (tool-bar):
* startup.el (site-run-file):
* shell.el (shell-dumb-shell-regexp):
* rfn-eshadow.el (file-name-shadow-tty-properties)
(file-name-shadow-properties):
* paths.el (remote-shell-program, news-directory):
* mouse.el ([C-down-mouse-3]):
* menu-bar.el (menu-bar-tools-menu):
* jka-cmpr-hook.el (jka-compr-load-suffixes)
(jka-compr-mode-alist-additions, jka-compr-compression-info-list)
(jka-compr-compression-info-list):
* isearch.el (search-whitespace-regexp):
* image-file.el (image-file-name-extensions):
* find-dired.el (find-ls-option):
* files.el (directory-listing-before-filename-regexp)
(directory-free-space-args, insert-directory-program)
(list-directory-brief-switches, magic-fallback-mode-alist)
(magic-fallback-mode-alist, auto-mode-interpreter-regexp)
(automount-dir-prefix):
* faces.el (face-x-resources, x-font-regexp, x-font-regexp-head)
(x-font-regexp-slant, x-font-regexp-weight, face-x-resources)
(face-font-registry-alternatives, face-font-registry-alternatives)
(face-font-family-alternatives):
* facemenu.el (facemenu-add-new-face, facemenu-background-menu)
(facemenu-foreground-menu, facemenu-face-menu):
* epa-hook.el (epa-file-name-regexp):
* dnd.el (dnd-protocol-alist):
* textmodes/rst.el (auto-mode-alist):
* button.el (default-button): Purecopy strings.
2009-11-06 05:16:23 +00:00
|
|
|
|
(purecopy "gb2312\\|gbk\\|gb18030\\|jisx0208\\|jisx0212\\|ksc5601\\|cns11643\\|big5"))
|
1999-12-15 00:40:24 +00:00
|
|
|
|
|
2003-04-09 07:30:23 +00:00
|
|
|
|
;; CDAC fonts are actually smaller than their design sizes.
|
|
|
|
|
(setq face-font-rescale-alist
|
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
(tex-dvi-print-command, tex-bibtex-command, tex-start-commands)
(tex-start-options, slitex-run-command, latex-run-command)
(tex-run-command, tex-directory):
* textmodes/ispell.el (ispell-html-skip-alists)
(ispell-tex-skip-alists, ispell-tex-skip-alists):
* textmodes/fill.el (adaptive-fill-first-line-regexp):
(adaptive-fill-regexp):
* textmodes/dns-mode.el (auto-mode-alist):
* progmodes/python.el (interpreter-mode-alist):
* progmodes/etags.el (tags-compression-info-list):
* progmodes/etags.el (tags-file-name):
* net/browse-url.el (browse-url-galeon-program)
(browse-url-firefox-program):
* mail/sendmail.el (mail-signature-file)
(mail-citation-prefix-regexp):
* international/mule-conf.el (eight-bit):
* international/latexenc.el (latex-inputenc-coding-alist):
* international/fontset.el (x-pixel-size-width-font-regexp):
* emacs-lisp/warnings.el (warning-type-format):
* emacs-lisp/trace.el (trace-buffer):
* emacs-lisp/lisp-mode.el (lisp-interaction-mode-map)
(emacs-lisp-mode-map):
* calendar/holidays.el (holiday-solar-holidays)
(holiday-bahai-holidays, holiday-islamic-holidays)
(holiday-christian-holidays, holiday-hebrew-holidays)
(hebrew-holidays-4, hebrew-holidays-3, hebrew-holidays-2)
(hebrew-holidays-1, holiday-oriental-holidays)
(holiday-general-holidays):
* x-dnd.el (x-dnd-known-types):
* tool-bar.el (tool-bar):
* startup.el (site-run-file):
* shell.el (shell-dumb-shell-regexp):
* rfn-eshadow.el (file-name-shadow-tty-properties)
(file-name-shadow-properties):
* paths.el (remote-shell-program, news-directory):
* mouse.el ([C-down-mouse-3]):
* menu-bar.el (menu-bar-tools-menu):
* jka-cmpr-hook.el (jka-compr-load-suffixes)
(jka-compr-mode-alist-additions, jka-compr-compression-info-list)
(jka-compr-compression-info-list):
* isearch.el (search-whitespace-regexp):
* image-file.el (image-file-name-extensions):
* find-dired.el (find-ls-option):
* files.el (directory-listing-before-filename-regexp)
(directory-free-space-args, insert-directory-program)
(list-directory-brief-switches, magic-fallback-mode-alist)
(magic-fallback-mode-alist, auto-mode-interpreter-regexp)
(automount-dir-prefix):
* faces.el (face-x-resources, x-font-regexp, x-font-regexp-head)
(x-font-regexp-slant, x-font-regexp-weight, face-x-resources)
(face-font-registry-alternatives, face-font-registry-alternatives)
(face-font-family-alternatives):
* facemenu.el (facemenu-add-new-face, facemenu-background-menu)
(facemenu-foreground-menu, facemenu-face-menu):
* epa-hook.el (epa-file-name-regexp):
* dnd.el (dnd-protocol-alist):
* textmodes/rst.el (auto-mode-alist):
* button.el (default-button): Purecopy strings.
2009-11-06 05:16:23 +00:00
|
|
|
|
(list (cons (purecopy "-cdac$") 1.3)))
|
2003-04-09 07:30:23 +00:00
|
|
|
|
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(defvar x-font-name-charset-alist nil
|
|
|
|
|
"This variable has no meaning now. Just kept for backward compatibility.")
|
1998-05-21 01:46:39 +00:00
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
;;; XLFD (X Logical Font Description) format handler.
|
|
|
|
|
|
|
|
|
|
;; Define XLFD's field index numbers. ; field name
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(defconst xlfd-regexp-family-subnum 0) ; FOUNDRY and FAMILY
|
|
|
|
|
(defconst xlfd-regexp-weight-subnum 1) ; WEIGHT_NAME
|
|
|
|
|
(defconst xlfd-regexp-slant-subnum 2) ; SLANT
|
|
|
|
|
(defconst xlfd-regexp-swidth-subnum 3) ; SETWIDTH_NAME
|
|
|
|
|
(defconst xlfd-regexp-adstyle-subnum 4) ; ADD_STYLE_NAME
|
|
|
|
|
(defconst xlfd-regexp-pixelsize-subnum 5) ; PIXEL_SIZE
|
|
|
|
|
(defconst xlfd-regexp-pointsize-subnum 6) ; POINT_SIZE
|
|
|
|
|
(defconst xlfd-regexp-resx-subnum 7) ; RESOLUTION_X
|
|
|
|
|
(defconst xlfd-regexp-resy-subnum 8) ; RESOLUTION_Y
|
|
|
|
|
(defconst xlfd-regexp-spacing-subnum 8) ; SPACING
|
|
|
|
|
(defconst xlfd-regexp-avgwidth-subnum 10) ; AVERAGE_WIDTH
|
|
|
|
|
(defconst xlfd-regexp-registry-subnum 11) ; REGISTRY and ENCODING
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
|
|
|
|
;; Regular expression matching against a fontname which conforms to
|
|
|
|
|
;; XLFD (X Logical Font Description). All fields in XLFD should be
|
|
|
|
|
;; not be omitted (but can be a wild card) to be matched.
|
|
|
|
|
(defconst xlfd-tight-regexp
|
|
|
|
|
"^\
|
2002-03-01 02:07:40 +00:00
|
|
|
|
-\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\
|
1997-02-20 07:02:49 +00:00
|
|
|
|
-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)\
|
2002-03-01 02:07:40 +00:00
|
|
|
|
-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*-[^-]*\\)$")
|
|
|
|
|
|
|
|
|
|
;; Regular expression matching against a fontname which conforms to
|
|
|
|
|
;; XLFD (X Logical Font Description). All fields in XLFD from FOUNDRY
|
2002-10-31 22:01:58 +00:00
|
|
|
|
;; to ADSTYLE, REGISTRY, and ENCODING should be not be omitted (but
|
2002-03-01 02:07:40 +00:00
|
|
|
|
;; can be a wild card) to be matched.
|
|
|
|
|
(defconst xlfd-style-regexp
|
|
|
|
|
"^\
|
|
|
|
|
-\\([^-]*-[^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-\\([^-]*\\)-.*\
|
|
|
|
|
-\\([^-]*-[^-]*\\)$")
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
|
|
|
|
;; List of field numbers of XLFD whose values are numeric.
|
|
|
|
|
(defconst xlfd-regexp-numeric-subnums
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(list xlfd-regexp-pixelsize-subnum ;5
|
|
|
|
|
xlfd-regexp-pointsize-subnum ;6
|
|
|
|
|
xlfd-regexp-resx-subnum ;7
|
|
|
|
|
xlfd-regexp-resy-subnum ;8
|
|
|
|
|
xlfd-regexp-avgwidth-subnum ;10
|
1997-02-20 07:02:49 +00:00
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(defun x-decompose-font-name (pattern)
|
2003-01-10 07:35:06 +00:00
|
|
|
|
"Decompose PATTERN into XLFD fields and return a vector of the fields.
|
2002-03-01 02:07:40 +00:00
|
|
|
|
The length of the vector is 12.
|
2003-01-10 07:35:06 +00:00
|
|
|
|
The FOUNDRY and FAMILY fields are concatinated and stored in the first
|
|
|
|
|
element of the vector.
|
|
|
|
|
The REGISTRY and ENCODING fields are concatinated and stored in the last
|
|
|
|
|
element of the vector.
|
|
|
|
|
|
|
|
|
|
Return nil if PATTERN doesn't conform to XLFD."
|
|
|
|
|
(if (string-match xlfd-tight-regexp pattern)
|
|
|
|
|
(let ((xlfd-fields (make-vector 12 nil)))
|
|
|
|
|
(dotimes (i 12)
|
|
|
|
|
(aset xlfd-fields i (match-string (1+ i) pattern)))
|
|
|
|
|
(dotimes (i 12)
|
|
|
|
|
(if (string-match "^[*-]+$" (aref xlfd-fields i))
|
|
|
|
|
(aset xlfd-fields i nil)))
|
|
|
|
|
xlfd-fields)))
|
1997-03-18 23:16:27 +00:00
|
|
|
|
|
1998-06-12 07:10:59 +00:00
|
|
|
|
(defun x-compose-font-name (fields &optional reduce)
|
2002-10-31 22:01:58 +00:00
|
|
|
|
"Compose X fontname from FIELDS.
|
2006-12-07 04:14:14 +00:00
|
|
|
|
FIELDS is a vector of XLFD fields, of length 12.
|
1997-03-18 23:16:27 +00:00
|
|
|
|
If a field is nil, wild-card letter `*' is embedded.
|
2006-11-30 15:50:08 +00:00
|
|
|
|
Optional argument REDUCE exists just for backward compatibility,
|
|
|
|
|
and is always ignored."
|
2000-03-21 00:32:06 +00:00
|
|
|
|
(concat "-" (mapconcat (lambda (x) (or x "*")) fields "-")))
|
1998-09-07 13:39:15 +00:00
|
|
|
|
|
2001-10-24 11:06:30 +00:00
|
|
|
|
|
|
|
|
|
(defun x-must-resolve-font-name (xlfd-fields)
|
|
|
|
|
"Like `x-resolve-font-name', but always return a font name.
|
|
|
|
|
XLFD-FIELDS is a vector of XLFD (X Logical Font Description) fields.
|
|
|
|
|
If no font matching XLFD-FIELDS is available, successively replace
|
|
|
|
|
parts of the font name pattern with \"*\" until some font is found.
|
|
|
|
|
Value is name of that font."
|
|
|
|
|
(let ((ascii-font nil) (index 0))
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(while (and (null ascii-font) (<= index xlfd-regexp-registry-subnum))
|
2001-10-24 11:06:30 +00:00
|
|
|
|
(let ((pattern (x-compose-font-name xlfd-fields)))
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(setq ascii-font (x-resolve-font-name pattern))
|
|
|
|
|
(error
|
|
|
|
|
(message "Warning: no fonts matching `%s' available" pattern)
|
|
|
|
|
(aset xlfd-fields index "*")
|
|
|
|
|
(setq index (1+ index))))))
|
|
|
|
|
(unless ascii-font
|
2003-04-14 07:54:15 +00:00
|
|
|
|
(error "No fonts found"))
|
2001-10-24 11:06:30 +00:00
|
|
|
|
ascii-font))
|
|
|
|
|
|
|
|
|
|
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(defun x-complement-fontset-spec (default-spec fontlist)
|
|
|
|
|
"Complement elements of FONTLIST based on DEFAULT-SPEC.
|
|
|
|
|
DEFAULT-SPEC is a font-spec object providing default font properties.
|
2003-01-10 07:35:06 +00:00
|
|
|
|
FONTLIST is an alist of script names vs the corresponding font names.
|
|
|
|
|
|
2007-12-20 12:38:58 +00:00
|
|
|
|
The font names are parsed and unspecified font properties are
|
|
|
|
|
given from DEFAULT-SPEC."
|
2007-12-26 01:53:14 +00:00
|
|
|
|
(let ((prop-list '(:foundry :family :weight :slant :width :adstyle :size)))
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(dolist (elt fontlist)
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(let ((spec (font-spec :name (cadr elt))))
|
|
|
|
|
(dolist (prop prop-list)
|
|
|
|
|
(let ((val (font-get spec prop)))
|
|
|
|
|
(or val
|
|
|
|
|
(font-put spec prop (font-get default-spec prop)))))
|
|
|
|
|
(setcar (cdr elt) spec)))
|
2000-03-21 00:32:06 +00:00
|
|
|
|
fontlist))
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
1997-07-31 05:53:31 +00:00
|
|
|
|
(defun fontset-name-p (fontset)
|
|
|
|
|
"Return non-nil if FONTSET is valid as fontset name.
|
|
|
|
|
A valid fontset name should conform to XLFD (X Logical Font Description)
|
2006-11-30 15:50:08 +00:00
|
|
|
|
with \"fontset\" in `<CHARSET_REGISTRY>' field."
|
1997-07-31 05:53:31 +00:00
|
|
|
|
(and (string-match xlfd-tight-regexp fontset)
|
|
|
|
|
(string= (match-string (1+ xlfd-regexp-registry-subnum) fontset)
|
|
|
|
|
"fontset")))
|
|
|
|
|
|
2008-06-12 03:56:20 +00:00
|
|
|
|
(declare-function fontset-list "fontset.c" ())
|
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(defun generate-fontset-menu ()
|
2002-10-31 22:01:58 +00:00
|
|
|
|
"Return list to be appended to `x-fixed-font-alist'.
|
|
|
|
|
Done when `mouse-set-font' is called."
|
2002-09-27 04:54:02 +00:00
|
|
|
|
(let (l)
|
|
|
|
|
(dolist (fontset (fontset-list))
|
|
|
|
|
(or (string-match "fontset-default$" fontset)
|
2008-05-14 01:55:46 +00:00
|
|
|
|
(string-match "fontset-auto[0-9]+$" fontset)
|
2002-09-27 04:54:02 +00:00
|
|
|
|
(push (list (fontset-plain-name fontset) fontset) l)))
|
1999-01-24 04:42:30 +00:00
|
|
|
|
(cons "Fontset"
|
2002-09-27 04:54:02 +00:00
|
|
|
|
(sort l #'(lambda (x y) (string< (car x) (car y)))))))
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
2008-06-12 03:56:20 +00:00
|
|
|
|
(declare-function query-fontset "fontset.c" (pattern &optional regexpp))
|
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(defun fontset-plain-name (fontset)
|
|
|
|
|
"Return a plain and descriptive name of FONTSET."
|
1997-05-12 06:56:20 +00:00
|
|
|
|
(if (not (setq fontset (query-fontset fontset)))
|
|
|
|
|
(error "Invalid fontset: %s" fontset))
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(let ((xlfd-fields (x-decompose-font-name fontset)))
|
|
|
|
|
(if xlfd-fields
|
2002-08-19 06:12:31 +00:00
|
|
|
|
(let ((family (aref xlfd-fields xlfd-regexp-family-subnum))
|
|
|
|
|
(weight (aref xlfd-fields xlfd-regexp-weight-subnum))
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(slant (aref xlfd-fields xlfd-regexp-slant-subnum))
|
|
|
|
|
(swidth (aref xlfd-fields xlfd-regexp-swidth-subnum))
|
|
|
|
|
(size (aref xlfd-fields xlfd-regexp-pixelsize-subnum))
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(nickname (aref xlfd-fields xlfd-regexp-registry-subnum))
|
1997-02-20 07:02:49 +00:00
|
|
|
|
name)
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(if (not (string-match "^fontset-\\(.*\\)$" nickname))
|
2002-08-19 06:12:31 +00:00
|
|
|
|
(setq nickname family)
|
|
|
|
|
(setq nickname (match-string 1 nickname)))
|
2006-03-03 11:47:04 +00:00
|
|
|
|
(if (and size (> (string-to-number size) 0))
|
2002-08-19 06:12:31 +00:00
|
|
|
|
(setq name (format "%s: %s-dot" nickname size))
|
|
|
|
|
(setq name nickname))
|
|
|
|
|
(and weight
|
|
|
|
|
(cond ((string-match "^medium$" weight)
|
|
|
|
|
(setq name (concat name " " "medium")))
|
|
|
|
|
((string-match "^bold$\\|^demibold$" weight)
|
|
|
|
|
(setq name (concat name " " weight)))))
|
|
|
|
|
(and slant
|
|
|
|
|
(cond ((string-match "^i$" slant)
|
|
|
|
|
(setq name (concat name " " "italic")))
|
|
|
|
|
((string-match "^o$" slant)
|
|
|
|
|
(setq name (concat name " " "slant")))
|
|
|
|
|
((string-match "^ri$" slant)
|
|
|
|
|
(setq name (concat name " " "reverse italic")))
|
|
|
|
|
((string-match "^ro$" slant)
|
|
|
|
|
(setq name (concat name " " "reverse slant")))))
|
|
|
|
|
name)
|
1997-02-20 07:02:49 +00:00
|
|
|
|
fontset)))
|
|
|
|
|
|
2002-07-26 04:03:01 +00:00
|
|
|
|
(defvar charset-script-alist
|
2002-10-05 01:54:48 +00:00
|
|
|
|
'((ascii . latin)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
(latin-iso8859-1 . latin)
|
|
|
|
|
(latin-iso8859-2 . latin)
|
|
|
|
|
(latin-iso8859-3 . latin)
|
|
|
|
|
(latin-iso8859-4 . latin)
|
|
|
|
|
(latin-iso8859-9 . latin)
|
|
|
|
|
(latin-iso8859-10 . latin)
|
|
|
|
|
(latin-iso8859-13 . latin)
|
|
|
|
|
(latin-iso8859-14 . latin)
|
|
|
|
|
(latin-iso8859-15 . latin)
|
|
|
|
|
(latin-iso8859-16 . latin)
|
|
|
|
|
(latin-jisx0201 . latin)
|
|
|
|
|
(thai-tis620 . thai)
|
|
|
|
|
(cyrillic-iso8859-5 . cyrillic)
|
|
|
|
|
(arabic-iso8859-6 . arabic)
|
|
|
|
|
(greek-iso8859-7 . latin)
|
|
|
|
|
(hebrew-iso8859-8 . latin)
|
2002-10-05 01:54:48 +00:00
|
|
|
|
(katakana-jisx0201 . kana)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
(chinese-gb2312 . han)
|
2004-10-05 00:27:52 +00:00
|
|
|
|
(chinese-gbk . han)
|
2006-11-27 04:43:04 +00:00
|
|
|
|
(gb18030-2-byte . han)
|
|
|
|
|
(gb18030-4-byte-bmp . han)
|
|
|
|
|
(gb18030-4-byte-ext-1 . han)
|
|
|
|
|
(gb18030-4-byte-ext-2 . han)
|
|
|
|
|
(gb18030-4-byte-smp . han)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
(chinese-big5-1 . han)
|
|
|
|
|
(chinese-big5-2 . han)
|
|
|
|
|
(chinese-cns11643-1 . han)
|
|
|
|
|
(chinese-cns11643-2 . han)
|
|
|
|
|
(chinese-cns11643-3 . han)
|
|
|
|
|
(chinese-cns11643-4 . han)
|
|
|
|
|
(chinese-cns11643-5 . han)
|
|
|
|
|
(chinese-cns11643-6 . han)
|
|
|
|
|
(chinese-cns11643-7 . han)
|
|
|
|
|
(japanese-jisx0208 . han)
|
|
|
|
|
(japanese-jisx0208-1978 . han)
|
|
|
|
|
(japanese-jisx0212 . han)
|
|
|
|
|
(japanese-jisx0213-1 . han)
|
|
|
|
|
(japanese-jisx0213-2 . han)
|
2002-10-05 01:54:48 +00:00
|
|
|
|
(korean-ksc5601 . hangul)
|
2002-07-26 04:03:01 +00:00
|
|
|
|
(chinese-sisheng . bopomofo)
|
|
|
|
|
(vietnamese-viscii-lower . latin)
|
|
|
|
|
(vietnamese-viscii-upper . latin)
|
|
|
|
|
(arabic-digit . arabic)
|
|
|
|
|
(arabic-1-column . arabic)
|
|
|
|
|
(arabic-2-column . arabic)
|
|
|
|
|
(indian-is13194 . devanagari)
|
|
|
|
|
(indian-glyph . devanagari)
|
|
|
|
|
(indian-1-column . devanagari)
|
|
|
|
|
(indian-2-column . devanagari)
|
|
|
|
|
(tibetan-1-column . tibetan))
|
|
|
|
|
"Alist of charsets vs the corresponding most appropriate scripts.
|
|
|
|
|
|
|
|
|
|
This alist is used by the function `create-fontset-from-fontset-spec'
|
|
|
|
|
to map charsets to scripts.")
|
2003-01-17 08:13:39 +00:00
|
|
|
|
|
1998-05-21 01:46:39 +00:00
|
|
|
|
(defun create-fontset-from-fontset-spec (fontset-spec
|
1998-06-12 07:10:59 +00:00
|
|
|
|
&optional style-variant noerror)
|
1997-02-20 07:02:49 +00:00
|
|
|
|
"Create a fontset from fontset specification string FONTSET-SPEC.
|
|
|
|
|
FONTSET-SPEC is a string of the format:
|
2009-01-11 04:05:32 +00:00
|
|
|
|
FONTSET-NAME,SCRIPT-NAME0:FONT-NAME0,SCRIPT-NAME1:FONT-NAME1, ...
|
1997-05-12 06:56:20 +00:00
|
|
|
|
Any number of SPACE, TAB, and NEWLINE can be put before and after commas.
|
1998-06-12 07:10:59 +00:00
|
|
|
|
|
2003-01-10 07:35:06 +00:00
|
|
|
|
When a frame uses the fontset as the `font' parameter, the frame's
|
|
|
|
|
default font name is derived from FONTSET-NAME by substituting
|
|
|
|
|
\"iso8859-1\" for the tail part \"fontset-XXX\". But, if SCRIPT-NAMEn
|
|
|
|
|
is \"ascii\", use the corresponding FONT-NAMEn as the default font
|
|
|
|
|
name.
|
1998-06-12 07:10:59 +00:00
|
|
|
|
|
2006-12-07 04:14:14 +00:00
|
|
|
|
Optional 2nd and 3rd arguments exist just for backward compatibility,
|
|
|
|
|
and are ignored.
|
1998-07-03 04:39:22 +00:00
|
|
|
|
|
2002-07-26 04:03:01 +00:00
|
|
|
|
It returns a name of the created fontset.
|
|
|
|
|
|
|
|
|
|
For backward compatibility, SCRIPT-NAME may be a charset name, in
|
|
|
|
|
which case, the corresponding script is decided by the variable
|
|
|
|
|
`charset-script-alist' (which see)."
|
2003-01-10 07:35:06 +00:00
|
|
|
|
(or (string-match "^[^,]+" fontset-spec)
|
1997-05-12 06:56:20 +00:00
|
|
|
|
(error "Invalid fontset spec: %s" fontset-spec))
|
|
|
|
|
(let ((idx (match-end 0))
|
|
|
|
|
(name (match-string 0 fontset-spec))
|
2007-12-20 12:38:58 +00:00
|
|
|
|
default-spec target script fontlist)
|
|
|
|
|
(or (string-match xlfd-tight-regexp name)
|
2003-01-10 07:35:06 +00:00
|
|
|
|
(error "Fontset name \"%s\" not conforming to XLFD" name))
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(setq default-spec (font-spec :name name))
|
2003-01-10 07:35:06 +00:00
|
|
|
|
;; At first, extract pairs of charset and fontname from FONTSET-SPEC.
|
2009-01-11 04:05:32 +00:00
|
|
|
|
(while (string-match "[, \t\n]*\\([^:]+\\):[ \t]*\\([^,]+\\)"
|
2006-03-06 02:16:23 +00:00
|
|
|
|
fontset-spec idx)
|
2003-01-10 07:35:06 +00:00
|
|
|
|
(setq idx (match-end 0))
|
2006-03-03 11:47:04 +00:00
|
|
|
|
(setq target (intern (match-string 1 fontset-spec)))
|
|
|
|
|
(cond ((or (eq target 'ascii)
|
2006-10-30 06:52:47 +00:00
|
|
|
|
(memq target (char-table-extra-slot char-script-table 0)))
|
|
|
|
|
(push (list target (match-string 2 fontset-spec)) fontlist))
|
|
|
|
|
((setq script (cdr (assq target charset-script-alist)))
|
2006-03-03 11:47:04 +00:00
|
|
|
|
(push (list script (match-string 2 fontset-spec)) fontlist))
|
|
|
|
|
((charsetp target)
|
|
|
|
|
(push (list target (match-string 2 fontset-spec)) fontlist))))
|
2003-01-10 07:35:06 +00:00
|
|
|
|
|
|
|
|
|
;; Complement FONTLIST.
|
2007-12-20 12:38:58 +00:00
|
|
|
|
(setq fontlist (x-complement-fontset-spec default-spec fontlist))
|
2003-01-10 07:35:06 +00:00
|
|
|
|
|
|
|
|
|
;; Create a fontset.
|
2006-03-03 11:47:04 +00:00
|
|
|
|
(new-fontset name (nreverse fontlist))))
|
1998-07-03 04:39:22 +00:00
|
|
|
|
|
|
|
|
|
(defun create-fontset-from-ascii-font (font &optional resolved-font
|
|
|
|
|
fontset-name)
|
|
|
|
|
"Create a fontset from an ASCII font FONT.
|
|
|
|
|
|
2006-11-30 15:50:08 +00:00
|
|
|
|
Optional 2nd arg RESOLVED-FONT is a resolved name of FONT.
|
|
|
|
|
If omitted, `x-resolve-font-name' is called to get the resolved name.
|
|
|
|
|
At this time, if FONT is not available, an error is signaled.
|
1998-07-03 04:39:22 +00:00
|
|
|
|
|
2006-11-30 15:50:08 +00:00
|
|
|
|
Optional 3rd arg FONTSET-NAME is a string to be used in
|
1998-07-03 04:39:22 +00:00
|
|
|
|
`<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted,
|
|
|
|
|
an appropriate name is generated automatically.
|
|
|
|
|
|
|
|
|
|
It returns a name of the created fontset."
|
2000-03-21 00:32:06 +00:00
|
|
|
|
(setq font (downcase font))
|
2002-07-26 04:03:01 +00:00
|
|
|
|
(setq resolved-font
|
|
|
|
|
(downcase (or resolved-font (x-resolve-font-name font))))
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(let ((xlfd (x-decompose-font-name resolved-font))
|
|
|
|
|
fontset)
|
2000-03-21 00:32:06 +00:00
|
|
|
|
(if fontset-name
|
|
|
|
|
(setq fontset-name (downcase fontset-name))
|
2002-08-19 06:12:31 +00:00
|
|
|
|
(if (query-fontset "fontset-startup")
|
|
|
|
|
(setq fontset-name
|
|
|
|
|
(subst-char-in-string
|
|
|
|
|
?- ?_ (aref xlfd xlfd-regexp-registry-subnum) t))
|
|
|
|
|
(setq fontset-name "startup")))
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(aset xlfd xlfd-regexp-registry-subnum
|
|
|
|
|
(format "fontset-%s" fontset-name))
|
1998-07-03 04:39:22 +00:00
|
|
|
|
(setq fontset (x-compose-font-name xlfd))
|
|
|
|
|
(or (query-fontset fontset)
|
2000-03-21 00:32:06 +00:00
|
|
|
|
(create-fontset-from-fontset-spec (concat fontset ", ascii:" font)))))
|
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
1997-05-16 00:59:15 +00:00
|
|
|
|
;; Create standard fontset from 16 dots fonts which are the most widely
|
1997-05-28 03:35:47 +00:00
|
|
|
|
;; installed fonts. Fonts for Chinese-GB, Korean, and Chinese-CNS are
|
|
|
|
|
;; specified here because FAMILY of those fonts are not "fixed" in
|
|
|
|
|
;; many cases.
|
1997-05-16 00:59:15 +00:00
|
|
|
|
(defvar standard-fontset-spec
|
2002-03-01 02:07:40 +00:00
|
|
|
|
(purecopy "-*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard")
|
1997-05-16 00:59:15 +00:00
|
|
|
|
"String of fontset spec of the standard fontset.
|
|
|
|
|
You have the biggest chance to display international characters
|
|
|
|
|
with correct glyphs by using the standard fontset.
|
1997-02-20 07:02:49 +00:00
|
|
|
|
See the documentation of `create-fontset-from-fontset-spec' for the format.")
|
|
|
|
|
|
2002-07-26 04:03:01 +00:00
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
;; Create fontsets from X resources of the name `fontset-N (class
|
|
|
|
|
;; Fontset-N)' where N is integer 0, 1, ...
|
|
|
|
|
;; The values of the resources the string of the same format as
|
1997-05-16 00:59:15 +00:00
|
|
|
|
;; `standard-fontset-spec'.
|
1997-02-20 07:02:49 +00:00
|
|
|
|
|
2008-06-12 03:56:20 +00:00
|
|
|
|
(declare-function x-get-resource "frame.c"
|
|
|
|
|
(attribute class &optional component subclass))
|
|
|
|
|
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(defun create-fontset-from-x-resource ()
|
|
|
|
|
(let ((idx 0)
|
|
|
|
|
fontset-spec)
|
2000-01-31 17:17:49 +00:00
|
|
|
|
(while (setq fontset-spec (x-get-resource (format "fontset-%d" idx)
|
|
|
|
|
(format "Fontset-%d" idx)))
|
2008-04-03 04:06:55 +00:00
|
|
|
|
(condition-case nil
|
2009-03-19 00:55:36 +00:00
|
|
|
|
(create-fontset-from-fontset-spec fontset-spec t)
|
|
|
|
|
(error (display-warning
|
|
|
|
|
'initialization
|
|
|
|
|
(format "Fontset-%d: invalid specification in X resource" idx)
|
|
|
|
|
:warning)))
|
1997-02-20 07:02:49 +00:00
|
|
|
|
(setq idx (1+ idx)))))
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
(provide 'fontset)
|
|
|
|
|
|
|
|
|
|
;;; fontset.el ends here
|