comparison lisp/language/indian.el @ 50256:104cf4fa2a8e

(indian-font-foundry): New variable. (indian-script-language-alist): New variable. (indian-font-char-index-table): New variable. (indian-font-char): New function. (indian-font-char-range): New function. (font-ccl-encoder-alist): Add entry for AKRUTI font.
author Kenichi Handa <handa@m17n.org>
date Sat, 22 Mar 2003 01:07:17 +0000
parents 003055ca7e13
children 40bda6ae386e
comparison
equal deleted inserted replaced
50255:a716a67fdf9d 50256:104cf4fa2a8e
43 (post-read-conversion . in-is13194-post-read-conversion) 43 (post-read-conversion . in-is13194-post-read-conversion)
44 (pre-write-conversion . in-is13194-pre-write-conversion))) 44 (pre-write-conversion . in-is13194-pre-write-conversion)))
45 45
46 (define-coding-system-alias 'devanagari 'in-is13194) 46 (define-coding-system-alias 'devanagari 'in-is13194)
47 47
48 (defvar indian-font-foundry 'cdac
49 "Font foundry for Indian characters.
50 Currently supported foundries are `cdac' and `akruti'.")
51
52 (defvar indian-script-language-alist
53 "Alist of Indian scripts vs the corresponding language list and font foundry.
54 Each element has this form:
55
56 (SCRIPT LANGUAGE-LIST FONT-FOUNDRY)
57
58 SCRIPT is one of Indian script names.
59
60 LANGUAGE-LIST is a list of Indian langauge names SCRIPT is used for.
61 The list is in the priority order.
62
63 FONT-FOUNDRY is a font foundry representing a group of Indian
64 fonts. If the value is nil, the value of `indian-font-foundry'
65 is used."
66 '((devanagari (hindi sanskrit) nil)
67 (bengali (bengali assamese) nil)
68 (gurmukhi (punjabi) nil)
69 (gujarati (gujarati) nil)
70 (oriya (oriya) nil)
71 (tamil (tamil) nil)
72 (telugu (telugu) nil)
73 (kannada (kannada) nil)
74 (malayalam (malayalam) nil)))
75
76 (defconst indian-font-char-index-table
77 '( ; for which language(s)
78 ;; CDAC fonts
79 (#x0000 . cdac:dv-ttsurekh) ; hindi, etc
80 (#x0100 . cdac:sd-ttsurekh) ; sanskrit
81 (#x0200 . cdac:bn-ttdurga) ; bengali
82 (#x0300 . cdac:as-ttdurga) ; assamese
83 (#x0400 . cdac:pn-ttamar) ; punjabi
84 (#x0500 . cdac:gj-ttavantika) ; gujarati
85 (#x0600 . cdac:or-ttsarala) ; oriya
86 (#x0700 . cdac:tm-ttvalluvar) ; tamil
87 (#x0800 . cdac:tl-tthemalatha) ; telugu
88 (#x0900 . cdac:kn-ttuma) ; kannada
89 (#x0A00 . cdac:ml-ttkarthika) ; malayalam
90
91 ;; AKRUTI fonts
92 (#x0B00 . akruti:dev) ; hindi, etc
93 (#x0C00 . akruti:bng) ; bengali
94 (#x0D00 . akruti:pnj) ; punjabi
95 (#x0E00 . akruti:guj) ; gujarati
96 (#x0F00 . akruti:ori) ; oriya
97 (#x1000 . akruti:tml) ; tamil
98 (#x1100 . akruti:tlg) ; telugu
99 (#x1200 . akruti:knd) ; kannada
100 (#x1300 . akruti:mal) ; malayalam
101 )
102 "Aliat of indices of `indian-glyph' character vs Indian font identifiers.
103 Each element has this form: (INDEX . FONT-IDENTIFIER)
104
105 INDEX is an index number of the first character in the charset
106 `indian-glyph' assigned for glyphs in the font specified by
107 FONT-IDENTIFIER. Currently FONT-IDENTIFIERs are defined for CDAC
108 and AKRUTI font groups.")
109
110 (defun indian-font-char (index font-identifier)
111 "Return character of charset `indian-glyph' made from glyph index INDEX.
112 FONT-IDENTIFIER is an identifier of an Indian font listed in the
113 variable `indian-font-char-index-table'. It specifies which
114 font INDEX is for."
115 (if (or (< index 0) (> index 255))
116 (error "Invalid glyph index: %d" index))
117 (let ((start (car (rassq font-identifier indian-font-char-index-table))))
118 (if (not start)
119 (error "Unknown font identifier: %s" font-identifier))
120 (setq index (+ start index))
121 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32))))
122
123 ;; Return a range of characters (cons of min and max character) of the
124 ;; charset `indian-glyph' for displaying SCRIPT in LANGUAGE by a font
125 ;; of FOUNDRY.
126
127 (defun indian-font-char-range (font-identifier)
128 (cons (indian-font-char 0 font-identifier)
129 (indian-font-char 255 font-identifier)))
130
48 (defvar indian-script-table 131 (defvar indian-script-table
49 '[ 132 '[
50 devanagari 133 devanagari
51 sanskrit 134 sanskrit
52 bengali 135 bengali
80 163
81 (setq font-ccl-encoder-alist 164 (setq font-ccl-encoder-alist
82 (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font) 165 (cons (cons "-CDAC" 'ccl-encode-indian-glyph-font)
83 font-ccl-encoder-alist)) 166 font-ccl-encoder-alist))
84 167
168 (setq font-ccl-encoder-alist
169 (cons (cons "-AKRUTI" 'ccl-encode-indian-glyph-font)
170 font-ccl-encoder-alist))
171
85 (provide 'indian) 172 (provide 'indian)
86 173
87 ;;; indian.el ends here 174 ;;; indian.el ends here