2 |
|
|
3 |
;; Copyright (C) 2001 Free Software Foundation, Inc. |
;; Copyright (C) 2001 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Maintainer: KAWABATA, Taichi <batta@beige.ocn.ne.jp> |
;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org> |
6 |
;; Keywords: multilingual, Devanagari |
;; Keywords: multilingual, Devanagari |
7 |
|
|
8 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
52 |
"[$,15U(B-$,15y68(B-$,16?(B]") |
"[$,15U(B-$,15y68(B-$,16?(B]") |
53 |
|
|
54 |
(defconst devanagari-composable-pattern |
(defconst devanagari-composable-pattern |
55 |
(concat |
(concat |
56 |
"\\([$,15E(B-$,15T6@6A(B][$,15A5B(B]?\\)\\|$,15C(B" |
"\\([$,15E(B-$,15T6@6A(B][$,15A5B(B]?\\)\\|[$,15C6D(B]" |
57 |
"\\|\\(" |
"\\|\\(" |
58 |
"\\(?:\\(?:[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?\\(?:[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?\\(?:[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?" |
"\\(?:\\(?:[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?\\(?:[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?\\(?:[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?[$,15U(B-$,15y68(B-$,16?(B]$,16-(B\\)?" |
59 |
"[$,15U(B-$,15y68(B-$,16?(B]\\(?:$,16-(B\\|[$,15~(B-$,16-6B6C(B]?[$,15B5A(B]?\\)?" |
"[$,15U(B-$,15y68(B-$,16?(B]\\(?:$,16-(B\\|[$,15~(B-$,16-6B6C(B]?[$,15B5A(B]?\\)?" |
67 |
(narrow-to-region from to) |
(narrow-to-region from to) |
68 |
(goto-char (point-min)) |
(goto-char (point-min)) |
69 |
(while (re-search-forward devanagari-composable-pattern nil t) |
(while (re-search-forward devanagari-composable-pattern nil t) |
70 |
(devanagari-compose-syllable-region (match-beginning 0) |
(devanagari-compose-syllable-region (match-beginning 0) |
71 |
(match-end 0)))))) |
(match-end 0)))))) |
72 |
(defun devanagari-compose-string (string) |
(defun devanagari-compose-string (string) |
73 |
(with-temp-buffer |
(with-temp-buffer |
86 |
|
|
87 |
(defun devanagari-range (from to) |
(defun devanagari-range (from to) |
88 |
"Make the list of the integers of range FROM to TO." |
"Make the list of the integers of range FROM to TO." |
89 |
(let (result) |
(let (result) |
90 |
(while (<= from to) (setq result (cons to result) to (1- to))) result)) |
(while (<= from to) (setq result (cons to result) to (1- to))) result)) |
91 |
|
|
92 |
(defun devanagari-regexp-of-hashtbl-keys (hashtbl) |
(defun devanagari-regexp-of-hashtbl-keys (hashtbl) |
93 |
"Return a regular expression that matches all keys in hashtable HASHTBL." |
"Return a regular expression that matches all keys in hashtable HASHTBL." |
94 |
(let ((max-specpdl-size 1000)) |
(let ((max-specpdl-size 1000)) |
95 |
(regexp-opt |
(regexp-opt |
96 |
(sort |
(sort |
97 |
(let (dummy) |
(let (dummy) |
98 |
(maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl) |
(maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl) |
99 |
dummy) |
dummy) |
111 |
(mapc |
(mapc |
112 |
(function (lambda (ucs) |
(function (lambda (ucs) |
113 |
(aset composition-function-table (decode-char 'ucs ucs) |
(aset composition-function-table (decode-char 'ucs ucs) |
114 |
(list (cons devanagari-composable-pattern |
(list (cons devanagari-composable-pattern |
115 |
'devanagari-composition-function))))) |
'devanagari-composition-function))))) |
116 |
(nconc '(#x0903) (devanagari-range #x0905 #x0939) (devanagari-range #x0958 #x0961))) |
(nconc '(#x0903) (devanagari-range #x0905 #x0939) (devanagari-range #x0958 #x0961))) |
117 |
|
|
118 |
;; Notes on conversion steps. |
;; Notes on conversion steps. |
119 |
|
|
120 |
;; 1. chars to glyphs |
;; 1. chars to glyphs |
121 |
;; |
;; |
122 |
;; Rules will not be applied to the halant appeared at the end of the |
;; Rules will not be applied to the halant appeared at the end of the |
123 |
;; text. Also, the preceding/following "r" will be treated as special case. |
;; text. Also, the preceding/following "r" will be treated as special case. |
130 |
;; Note that `consonant-glyph' mentioned here does not contain the |
;; Note that `consonant-glyph' mentioned here does not contain the |
131 |
;; vertical bar (right modifier) attached at the right of the |
;; vertical bar (right modifier) attached at the right of the |
132 |
;; consonant. |
;; consonant. |
133 |
;; |
;; |
134 |
;; If the glyph-group contains right modifier, |
;; If the glyph-group contains right modifier, |
135 |
;; (1) consonant-glyphs/vowels, with nukta sign |
;; (1) consonant-glyphs/vowels, with nukta sign |
136 |
;; (2) spacing |
;; (2) spacing |
137 |
;; (3) right modifier (may be matra) |
;; (3) right modifier (may be matra) |
140 |
;; (6) anuswar |
;; (6) anuswar |
141 |
;; (7) following "r" |
;; (7) following "r" |
142 |
;; (8) bottom matra or halant. |
;; (8) bottom matra or halant. |
143 |
;; |
;; |
144 |
;; Otherwise, |
;; Otherwise, |
145 |
;; (1) consonant-glyph/vowels, with nukta sign |
;; (1) consonant-glyph/vowels, with nukta sign |
146 |
;; (3) left matra |
;; (3) left matra |
147 |
;; (4) top matra |
;; (4) top matra |
148 |
;; (5) preceding "r" |
;; (5) preceding "r" |
149 |
;; (6) anuswar |
;; (6) anuswar |
150 |
;; (7) following "r" |
;; (7) following "r" |
186 |
("$,15M5A(B" . "$,4 b"$(B") |
("$,15M5A(B" . "$,4 b"$(B") |
187 |
("$,15M5B(B" . "$,4 b"$(B") |
("$,15M5B(B" . "$,4 b"$(B") |
188 |
("$,16%(B" . "\$,4"L(B") |
("$,16%(B" . "\$,4"L(B") |
189 |
("$,15N(B" . "$,4 b"@(B") |
("$,15N(B" . "$,4 b"@(B") |
190 |
("$,15N5A(B" . "$,4 b"@"&(B") |
("$,15N5A(B" . "$,4 b"@"&(B") |
191 |
("$,16&(B" . "\$,4"@(B") |
("$,16&(B" . "\$,4"@(B") |
192 |
("$,16&5A(B" . "\$,4"@(B\$,4"&(B") |
("$,16&5A(B" . "\$,4"@(B\$,4"&(B") |
193 |
("$,15O(B" . "$,4 b(B") |
("$,15O(B" . "$,4 b(B") |
194 |
("$,16'(B" . "\$,4"D(B") |
("$,16'(B" . "\$,4"D(B") |
195 |
("$,16'5A(B" . "\$,4"D(B\$,4"&(B") |
("$,16'5A(B" . "\$,4"D(B\$,4"&(B") |
196 |
("$,15P(B" . "$,4 b"D(B") |
("$,15P(B" . "$,4 b"D(B") |
197 |
("$,15P5A(B" . "$,4 b"D"&(B") |
("$,15P5A(B" . "$,4 b"D"&(B") |
198 |
("$,16((B" . "\$,4"H(B") |
("$,16((B" . "\$,4"H(B") |
199 |
("$,16(5A(B" . "\$,4"H(B\$,4"&(B") |
("$,16(5A(B" . "\$,4"H(B\$,4"&(B") |
200 |
("$,15Q(B" . "$,4 K")"L(B") ;; special rule for reodering. |
("$,15Q(B" . "$,4 K")"L(B") ;; special rule for reodering. |
203 |
("$,16)(B" . "\$,4")"L(B") |
("$,16)(B" . "\$,4")"L(B") |
204 |
("$,16)5A(B" . "\$,4")"$(B") |
("$,16)5A(B" . "\$,4")"$(B") |
205 |
("$,16)5B(B" . "\$,4")"$(B") |
("$,16)5B(B" . "\$,4")"$(B") |
206 |
("$,15R(B" . "$,4 K")"@(B") |
("$,15R(B" . "$,4 K")"@(B") |
207 |
("$,15R5A(B" . "$,4 K")"@"&(B") |
("$,15R5A(B" . "$,4 K")"@"&(B") |
208 |
("$,16*(B" . "\$,4")"@(B") |
("$,16*(B" . "\$,4")"@(B") |
209 |
("$,16*5A(B" . "\$,4")"@"&(B") |
("$,16*5A(B" . "\$,4")"@"&(B") |
210 |
("$,15S(B" . "$,4 K")"D(B") |
("$,15S(B" . "$,4 K")"D(B") |
211 |
("$,15S5A(B" . "$,4 K")"D"&(B") |
("$,15S5A(B" . "$,4 K")"D"&(B") |
212 |
("$,16+(B" . "\$,4")"D(B") |
("$,16+(B" . "\$,4")"D(B") |
213 |
("$,16+5A(B" . "\$,4")"D"&(B") |
("$,16+5A(B" . "\$,4")"D"&(B") |
214 |
("$,15T(B" . "$,4 K")"H(B") |
("$,15T(B" . "$,4 K")"H(B") |
215 |
("$,15T5A(B" . "$,4 K")"H"&(B") |
("$,15T5A(B" . "$,4 K")"H"&(B") |
216 |
("$,16,(B" . "\$,4")"H(B") |
("$,16,(B" . "\$,4")"H(B") |
217 |
("$,16,5A(B" . "\$,4")"H"&(B") |
("$,16,5A(B" . "\$,4")"H"&(B") |
218 |
("$,16@(B" . "$,4 a"Q(B") |
("$,16@(B" . "$,4 a"Q(B") |
219 |
;;("$,16B(B" . nil) |
;;("$,16B(B" . nil) |
220 |
;;("$,16A(B" . nil) |
;;("$,16A(B" . nil) |
221 |
;;("$,16C(B" . nil) |
;;("$,16C(B" . nil) |
222 |
|
|
223 |
;; GRUTTALS |
;; GRUTTALS |
233 |
("$,15V6-5p(B" . "$,4 l")(B") |
("$,15V6-5p(B" . "$,4 l")(B") |
234 |
("$,15V6-5p6-(B" . "$,4 l(B") |
("$,15V6-5p6-(B" . "$,4 l(B") |
235 |
|
|
236 |
("$,15W(B" . "$,4 m")(B") |
("$,15W(B" . "$,4 m")(B") |
237 |
("$,15W6-(B" . "$,4 m(B") |
("$,15W6-(B" . "$,4 m(B") |
238 |
("$,15W6-5p(B" . "$,4 o")(B") |
("$,15W6-5p(B" . "$,4 o")(B") |
239 |
("$,15W6-5p6-(B" . "$,4 o(B") |
("$,15W6-5p6-(B" . "$,4 o(B") |
240 |
|
|
241 |
("$,15X(B" . "$,4 p")(B") |
("$,15X(B" . "$,4 p")(B") |
242 |
("$,15X6-(B" . "$,4 p(B") |
("$,15X6-(B" . "$,4 p(B") |
243 |
("$,15X6-5p(B" . "$,4 q")(B") |
("$,15X6-5p(B" . "$,4 q")(B") |
244 |
("$,15X6-5p6-(B" . "$,4 q(B") |
("$,15X6-5p6-(B" . "$,4 q(B") |
245 |
|
|
246 |
("$,15Y(B" . "$,4 r"S(B") |
("$,15Y(B" . "$,4 r"S(B") |
247 |
;; PALATALS |
;; PALATALS |
248 |
("$,15Z(B" . "$,4 s")(B") |
("$,15Z(B" . "$,4 s")(B") |
249 |
("$,15Z6-(B" . "$,4 s(B") |
("$,15Z6-(B" . "$,4 s(B") |
250 |
("$,15Z6-5p(B" . "$,4 t")(B") |
("$,15Z6-5p(B" . "$,4 t")(B") |
251 |
("$,15Z6-5p6-(B" . "$,4 t(B") |
("$,15Z6-5p6-(B" . "$,4 t(B") |
252 |
|
|
253 |
("$,15[(B" . "$,4 u"T(B") |
("$,15[(B" . "$,4 u"T(B") |
254 |
|
|
255 |
("$,15\(B" . "$,4 v")(B") |
("$,15\(B" . "$,4 v")(B") |
256 |
("$,15\6-(B" . "$,4 v(B") |
("$,15\6-(B" . "$,4 v(B") |
257 |
("$,15\6-5p(B" . "$,4 x")(B") |
("$,15\6-5p(B" . "$,4 x")(B") |
258 |
("$,15\6-5p6-(B" . "$,4 x(B") |
("$,15\6-5p6-(B" . "$,4 x(B") |
259 |
("$,15\6-5^(B" . "$,4 y")(B") |
("$,15\6-5^(B" . "$,4 y")(B") |
260 |
("$,15\6-5^6-(B" . "$,4 y(B") |
("$,15\6-5^6-(B" . "$,4 y(B") |
261 |
|
|
262 |
("$,15](B" . "$,4 z")(B") |
("$,15](B" . "$,4 z")(B") |
263 |
("$,15]6-(B" . "$,4 z(B") |
("$,15]6-(B" . "$,4 z(B") |
264 |
("$,15]6-5p(B" . "$,4 {")(B") |
("$,15]6-5p(B" . "$,4 {")(B") |
265 |
("$,15]6-5p6-(B" . "$,4 {(B") |
("$,15]6-5p6-(B" . "$,4 {(B") |
266 |
|
|
267 |
("$,15^(B" . "$,4 |")(B") |
("$,15^(B" . "$,4 |")(B") |
268 |
("$,15^6-(B" . "$,4 |(B") |
("$,15^6-(B" . "$,4 |(B") |
269 |
;; CEREBRALS |
;; CEREBRALS |
270 |
("$,15_(B" . "$,4 }"U(B") |
("$,15_(B" . "$,4 }"U(B") |
271 |
("$,15_6-5_(B" . "$,4 ~"U(B") |
("$,15_6-5_(B" . "$,4 ~"U(B") |
272 |
("$,15_6-5`(B" . "$,4 "U(B") |
("$,15_6-5`(B" . "$,4 "U(B") |
273 |
|
|
274 |
("$,15`(B" . "$,4! "V(B") |
("$,15`(B" . "$,4! "V(B") |
275 |
("$,15`6-5`(B" . "$,4!!"V(B") |
("$,15`6-5`(B" . "$,4!!"V(B") |
276 |
|
|
277 |
("$,15a(B" . "$,4!""W(B") |
("$,15a(B" . "$,4!""W(B") |
278 |
("$,15a6-5a(B" . "$,4!$"W(B") |
("$,15a6-5a(B" . "$,4!$"W(B") |
279 |
("$,15a6-5b(B" . "$,4!%"W(B") |
("$,15a6-5b(B" . "$,4!%"W(B") |
280 |
|
|
281 |
("$,15b(B" . "$,4!&"X(B") |
("$,15b(B" . "$,4!&"X(B") |
282 |
|
|
283 |
("$,15c(B" . "$,4!(")(B") |
("$,15c(B" . "$,4!(")(B") |
284 |
("$,15c6-(B" . "$,4!((B") |
("$,15c6-(B" . "$,4!((B") |
285 |
;; DENTALS |
;; DENTALS |
286 |
("$,15d(B" . "$,4!)")(B") |
("$,15d(B" . "$,4!)")(B") |
287 |
("$,15d6-(B" . "$,4!)(B") |
("$,15d6-(B" . "$,4!)(B") |
288 |
("$,15d6-5p(B" . "$,4!*")(B") |
("$,15d6-5p(B" . "$,4!*")(B") |
289 |
("$,15d6-5p6-(B" . "$,4!*(B") |
("$,15d6-5p6-(B" . "$,4!*(B") |
290 |
("$,15d6-5d(B" . "$,4!+")(B") |
("$,15d6-5d(B" . "$,4!+")(B") |
291 |
("$,15d6-5d6-(B" . "$,4!+(B") |
("$,15d6-5d6-(B" . "$,4!+(B") |
292 |
|
|
293 |
("$,15e(B" . "$,4!,")(B") |
("$,15e(B" . "$,4!,")(B") |
294 |
("$,15e6-(B" . "$,4!,(B") |
("$,15e6-(B" . "$,4!,(B") |
295 |
("$,15e6-5p(B" . "$,4!-")(B") |
("$,15e6-5p(B" . "$,4!-")(B") |
296 |
("$,15e6-5p6-(B" . "$,4!-(B") |
("$,15e6-5p6-(B" . "$,4!-(B") |
297 |
|
|
298 |
("$,15f(B" . "$,4!."Y(B") |
("$,15f(B" . "$,4!."Y(B") |
299 |
("$,15f6#(B" . "$,4!/"Y(B") |
("$,15f6#(B" . "$,4!/"Y(B") |
300 |
("$,15f6-5p(B" . "$,4!0"Y(B") |
("$,15f6-5p(B" . "$,4!0"Y(B") |
301 |
("$,15f6-5f(B" . "$,4!1"Y(B") |
("$,15f6-5f(B" . "$,4!1"Y(B") |
304 |
("$,15f6-5o(B" . "$,4!4(B") |
("$,15f6-5o(B" . "$,4!4(B") |
305 |
("$,15f6-5u(B" . "$,4!5"Y(B") |
("$,15f6-5u(B" . "$,4!5"Y(B") |
306 |
|
|
307 |
("$,15g(B" . "$,4!6")(B") |
("$,15g(B" . "$,4!6")(B") |
308 |
("$,15g6-(B" . "$,4!6(B") |
("$,15g6-(B" . "$,4!6(B") |
309 |
("$,15g6-5p(B" . "$,4!7")(B") |
("$,15g6-5p(B" . "$,4!7")(B") |
310 |
("$,15g6-5p6-(B" . "$,4!7(B") |
("$,15g6-5p6-(B" . "$,4!7(B") |
311 |
|
|
312 |
("$,15h(B" . "$,4!8")(B") |
("$,15h(B" . "$,4!8")(B") |
313 |
("$,15h6-(B" . "$,4!8(B") |
("$,15h6-(B" . "$,4!8(B") |
314 |
("$,15h6-5p(B" . "$,4!9")(B") |
("$,15h6-5p(B" . "$,4!9")(B") |
315 |
("$,15h6-5p6-(B" . "$,4!9")(B") |
("$,15h6-5p6-(B" . "$,4!9")(B") |
316 |
("$,15h6-5h(B" . "$,4!:")(B") |
("$,15h6-5h(B" . "$,4!:")(B") |
317 |
("$,15h6-5h6-(B" . "$,4!:(B") |
("$,15h6-5h6-(B" . "$,4!:(B") |
318 |
|
|
319 |
("$,15i(B" . "$,4!8"#")(B") |
("$,15i(B" . "$,4!8"#")(B") |
320 |
;; LABIALS |
;; LABIALS |
321 |
("$,15j(B" . "$,4!;")(B") |
("$,15j(B" . "$,4!;")(B") |
322 |
("$,15j6-(B" . "$,4!;(B") |
("$,15j6-(B" . "$,4!;(B") |
323 |
("$,15j6-5p(B" . "$,4!<")(B") |
("$,15j6-5p(B" . "$,4!<")(B") |
324 |
("$,15j6-5p6-(B" . "$,4!<(B") |
("$,15j6-5p6-(B" . "$,4!<(B") |
325 |
|
|
326 |
("$,15k(B" . "$,4!a"[(B") |
("$,15k(B" . "$,4!a"[(B") |
327 |
("$,15k6-(B" . "$,4!=(B") |
("$,15k6-(B" . "$,4!=(B") |
328 |
("$,15k6-5p(B" . "$,4!c"[(B") |
("$,15k6-5p(B" . "$,4!c"[(B") |
329 |
|
|
330 |
("$,15l(B" . "$,4!d")(B") |
("$,15l(B" . "$,4!d")(B") |
331 |
("$,15l6-(B" . "$,4!d(B") |
("$,15l6-(B" . "$,4!d(B") |
332 |
("$,15l6-5p(B" . "$,4!e")(B") |
("$,15l6-5p(B" . "$,4!e")(B") |
333 |
("$,15l6-5p6-(B" . "$,4!e(B") |
("$,15l6-5p6-(B" . "$,4!e(B") |
334 |
|
|
335 |
("$,15m(B" . "$,4!f")(B") |
("$,15m(B" . "$,4!f")(B") |
336 |
("$,15m6-(B" . "$,4!f(B") |
("$,15m6-(B" . "$,4!f(B") |
337 |
("$,15m6-5p(B" . "$,4!g")(B") |
("$,15m6-5p(B" . "$,4!g")(B") |
338 |
("$,15m6-5p6-(B" . "$,4!g(B") |
("$,15m6-5p6-(B" . "$,4!g(B") |
339 |
|
|
340 |
("$,15n(B" . "$,4!h")(B") |
("$,15n(B" . "$,4!h")(B") |
341 |
("$,15n6-(B" . "$,4!h(B") |
("$,15n6-(B" . "$,4!h(B") |
342 |
("$,15n6-5p(B" . "$,4!i")(B") |
("$,15n6-5p(B" . "$,4!i")(B") |
343 |
("$,15n6-5p6-(B" . "$,4!i(B") |
("$,15n6-5p6-(B" . "$,4!i(B") |
344 |
;; SEMIVOWELS |
;; SEMIVOWELS |
345 |
("$,15o(B" . "$,4!j")(B") |
("$,15o(B" . "$,4!j")(B") |
346 |
("$,15o6-(B" . "$,4!j(B") |
("$,15o6-(B" . "$,4!j(B") |
347 |
("$,15o6-5p(B" . "$,4!k")(B") |
("$,15o6-5p(B" . "$,4!k")(B") |
348 |
("$,15o6-5p6-(B" . "$,4!k(B") |
("$,15o6-5p6-(B" . "$,4!k(B") |
349 |
("$,16-5o(B" . "$,4!l(B") ;; when every ohter lig. fails. |
("$,16-5o(B" . "$,4!l(B") ;; when every ohter lig. fails. |
350 |
|
|
351 |
("$,15p(B" . "$,4!n"W(B") |
("$,15p(B" . "$,4!n"W(B") |
352 |
;; ("$,15p6-(B" . "\$,4"'(B") ;; special case. only the topmost pos. |
;; ("$,15p6-(B" . "\$,4"'(B") ;; special case. only the topmost pos. |
353 |
("$,15q(B" . "$,4!n"#"W(B") |
("$,15q(B" . "$,4!n"#"W(B") |
354 |
("$,15q6-(B" . "$,4!m(B") ;; IS 13194 speical rule. |
("$,15q6-(B" . "$,4!m(B") ;; IS 13194 speical rule. |
355 |
("$,15p6!(B" . "$,4!o"[(B") |
("$,15p6!(B" . "$,4!o"[(B") |
356 |
("$,15p6"(B" . "$,4!p"\(B") |
("$,15p6"(B" . "$,4!p"\(B") |
357 |
|
|
358 |
("$,15r(B" . "$,4!q")(B") |
("$,15r(B" . "$,4!q")(B") |
359 |
("$,15r6-(B" . "$,4!q(B") |
("$,15r6-(B" . "$,4!q(B") |
360 |
("$,15s(B" . "$,4!s(B") |
("$,15s(B" . "$,4!s(B") |
361 |
("$,15s6-(B" . "$,4!r(B") |
("$,15s6-(B" . "$,4!r(B") |
362 |
("$,15t(B" . "$,4!s"#(B") |
("$,15t(B" . "$,4!s"#(B") |
363 |
("$,15t6-(B" . "$,4!r"#(B") |
("$,15t6-(B" . "$,4!r"#(B") |
364 |
|
|
366 |
("$,15u6-(B" . "$,4!t(B") |
("$,15u6-(B" . "$,4!t(B") |
367 |
("$,15u6-5p(B" . "$,4!u")(B") |
("$,15u6-5p(B" . "$,4!u")(B") |
368 |
("$,15u6-5p6-(B" . "$,4!u(B") |
("$,15u6-5p6-(B" . "$,4!u(B") |
369 |
;; SIBILANTS |
;; SIBILANTS |
370 |
("$,15v(B" . "$,4!v")(B") |
("$,15v(B" . "$,4!v")(B") |
371 |
("$,15v6-(B" . "$,4!v(B") |
("$,15v6-(B" . "$,4!v(B") |
372 |
("$,15v6-5u(B" . "$,4!w")(B") |
("$,15v6-5u(B" . "$,4!w")(B") |
373 |
("$,15v6-5u6-(B" . "$,4!w(B") |
("$,15v6-5u6-(B" . "$,4!w(B") |
387 |
("$,15y6-5p(B" . "$,4!(B") |
("$,15y6-5p(B" . "$,4!(B") |
388 |
("$,15y6-5n(B" . "$,4" (B") |
("$,15y6-5n(B" . "$,4" (B") |
389 |
("$,15y6-5o(B" . "$,4"!(B") |
("$,15y6-5o(B" . "$,4"!(B") |
390 |
;; NUKTAS |
;; NUKTAS |
391 |
("$,168(B" . "$,4 f"R"S(B") |
("$,168(B" . "$,4 f"R"S(B") |
392 |
("$,1686-(B" . "$,4 d(B") |
("$,1686-(B" . "$,4 d(B") |
393 |
("$,169(B" . "$,4 k")(B") |
("$,169(B" . "$,4 k")(B") |
394 |
("$,1696-(B" . "$,4 k(B") |
("$,1696-(B" . "$,4 k(B") |
395 |
("$,16:(B" . "$,4 n")(B") |
("$,16:(B" . "$,4 n")(B") |
396 |
("$,16:6-(B" . "$,4 n(B") |
("$,16:6-(B" . "$,4 n(B") |
397 |
("$,16;(B" . "$,4 w")(B") |
("$,16;(B" . "$,4 w")(B") |
398 |
("$,16;6-(B" . "$,4 w(B") |
("$,16;6-(B" . "$,4 w(B") |
399 |
("$,16<(B" . "$,4!#"W(B") |
("$,16<(B" . "$,4!#"W(B") |
400 |
("$,16=(B" . "$,4!'"X(B") |
("$,16=(B" . "$,4!'"X(B") |
401 |
("$,16>(B" . "$,4!b"[(B") |
("$,16>(B" . "$,4!b"[(B") |
402 |
("$,16>6-(B" . "$,4!>(B") |
("$,16>6-(B" . "$,4!>(B") |
403 |
("$,16?(B" . "$,4!j"#")(B") |
("$,16?(B" . "$,4!j"#")(B") |
404 |
;; misc modifiers. |
;; misc modifiers. |
405 |
("$,15A(B" . "\$,4"$(B") |
("$,15A(B" . "\$,4"$(B") |
406 |
("$,15B(B" . "\$,4"&(B") |
("$,15B(B" . "\$,4"&(B") |
407 |
("$,15C(B" . "$,4 F(B") |
("$,15C(B" . "$,4 F(B") |
408 |
("$,15|(B" . "$,4"#(B") |
("$,15|(B" . "$,4"#(B") |
409 |
("$,15}(B" . "$,4 E(B") |
("$,15}(B" . "$,4 E(B") |
410 |
("$,16-(B" . "$,4""(B") |
("$,16-(B" . "$,4""(B") |
411 |
("$,16-5p(B" . "$,4"%(B") ;; following "r" |
("$,16-5p(B" . "$,4"%(B") ;; following "r" |
412 |
;; ("$,160(B" . "$,4 D(B") |
;; ("$,160(B" . "$,4 D(B") |
413 |
;; ("$,16D(B" . "$,4 J(B") |
("$,16D(B" . "$,4 J(B") |
414 |
;; ("$,16F(B" . "") |
;; ("$,16F(B" . "") |
415 |
;; ("$,16G(B" . "") |
;; ("$,16G(B" . "") |
416 |
;; ("$,16H(B" . "") |
;; ("$,16H(B" . "") |
417 |
;; ("$,16I(B" . "") |
;; ("$,16I(B" . "") |
418 |
;; ("$,16J(B" . "") |
;; ("$,16J(B" . "") |
419 |
;; ("$,16K(B" . "") |
;; ("$,16K(B" . "") |
420 |
;; ("$,16L(B" . "") |
;; ("$,16L(B" . "") |
421 |
;; ("$,16M(B" . "") |
;; ("$,16M(B" . "") |
422 |
;; ("$,16N(B" . "") |
;; ("$,16N(B" . "") |
423 |
;; ("$,16O(B" . "") |
;; ("$,16O(B" . "") |
424 |
) |
) |
425 |
"Devanagari characters to glyphs conversion table. |
"Devanagari characters to glyphs conversion table. |
426 |
Default value contains only the basic rules. You may add your own |
Default value contains only the basic rules. You may add your own |
427 |
preferred rule from the sanskrit fonts." ) |
preferred rule from the sanskrit fonts." ) |
428 |
|
|
429 |
(defvar dev-char-glyph-hash |
(defvar dev-char-glyph-hash |
430 |
(let* ((hash (makehash 'equal))) |
(let* ((hash (make-hash-table :test 'equal))) |
431 |
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) |
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) |
432 |
dev-char-glyph) |
dev-char-glyph) |
433 |
hash)) |
hash)) |
436 |
(devanagari-regexp-of-hashtbl-keys dev-char-glyph-hash)) |
(devanagari-regexp-of-hashtbl-keys dev-char-glyph-hash)) |
437 |
|
|
438 |
;; glyph-to-glyph conversion table. |
;; glyph-to-glyph conversion table. |
439 |
;; it is supposed that glyphs are ordered in |
;; it is supposed that glyphs are ordered in |
440 |
;; [consonant/nukta] - [matra/halant] - [preceding-r] - [anuswar]. |
;; [consonant/nukta] - [matra/halant] - [preceding-r] - [anuswar]. |
441 |
|
|
442 |
(defvar dev-glyph-glyph |
(defvar dev-glyph-glyph |
468 |
("\$,4"L(B\$,4"'(B\$,4"&(B" . "\$,4"O(B") |
("\$,4"L(B\$,4"'(B\$,4"&(B" . "\$,4"O(B") |
469 |
)) |
)) |
470 |
(defvar dev-glyph-glyph-hash |
(defvar dev-glyph-glyph-hash |
471 |
(let* ((hash (makehash 'equal))) |
(let* ((hash (make-hash-table :test 'equal))) |
472 |
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) |
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) |
473 |
dev-glyph-glyph) |
dev-glyph-glyph) |
474 |
hash)) |
hash)) |
483 |
("$,4",(B" . "$,4"0(B") |
("$,4",(B" . "$,4"0(B") |
484 |
("$,4"-(B" . "$,4"1(B"))) |
("$,4"-(B" . "$,4"1(B"))) |
485 |
(defvar dev-glyph-glyph-2-hash |
(defvar dev-glyph-glyph-2-hash |
486 |
(let* ((hash (makehash 'equal))) |
(let* ((hash (make-hash-table :test 'equal))) |
487 |
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) |
(mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) |
488 |
dev-glyph-glyph-2) |
dev-glyph-glyph-2) |
489 |
hash)) |
hash)) |
497 |
(devanagari-range from to))) |
(devanagari-range from to))) |
498 |
|
|
499 |
(defvar dev-glyph-cvn |
(defvar dev-glyph-cvn |
500 |
(append |
(append |
501 |
(dev-charseq #x2b) |
(dev-charseq #x2b) |
502 |
(dev-charseq #x3c #xc1) |
(dev-charseq #x3c #xc1) |
503 |
(dev-charseq #xc3)) |
(dev-charseq #xc3)) |
508 |
"Devanagari Spacing Glyphs") |
"Devanagari Spacing Glyphs") |
509 |
|
|
510 |
(defvar dev-glyph-right-modifier |
(defvar dev-glyph-right-modifier |
511 |
(append |
(append |
512 |
(dev-charseq #xc9) |
(dev-charseq #xc9) |
513 |
(dev-charseq #xd2 #xd5)) |
(dev-charseq #xd2 #xd5)) |
514 |
"Devanagari Modifiers attached at the right side.") |
"Devanagari Modifiers attached at the right side.") |
525 |
"Devanagari Matras attached at the top side.") |
"Devanagari Matras attached at the top side.") |
526 |
|
|
527 |
(defvar dev-glyph-bottom-modifier |
(defvar dev-glyph-bottom-modifier |
528 |
(append |
(append |
529 |
(dev-charseq #xd6 #xdf) |
(dev-charseq #xd6 #xdf) |
530 |
(dev-charseq #xc2)) |
(dev-charseq #xc2)) |
531 |
"Devanagari Modifiers attached at the bottom.") |
"Devanagari Modifiers attached at the bottom.") |
541 |
(,(dev-charseq #xc5) . 7) |
(,(dev-charseq #xc5) . 7) |
542 |
(,dev-glyph-bottom-modifier . 8))) |
(,dev-glyph-bottom-modifier . 8))) |
543 |
|
|
544 |
(mapc |
(mapc |
545 |
(function (lambda (x) |
(function (lambda (x) |
546 |
(mapc |
(mapc |
547 |
(function (lambda (y) |
(function (lambda (y) |
548 |
(put-char-code-property y 'composition-order (cdr x)))) |
(put-char-code-property y 'composition-order (cdr x)))) |
549 |
(car x)))) |
(car x)))) |
563 |
(defun devanagari-compose-syllable-region (from to) |
(defun devanagari-compose-syllable-region (from to) |
564 |
"Compose devanagari syllable in region FROM to TO." |
"Compose devanagari syllable in region FROM to TO." |
565 |
(let ((glyph-str nil) (cons-num 0) glyph-str-list |
(let ((glyph-str nil) (cons-num 0) glyph-str-list |
566 |
(last-halant nil) (preceding-r nil) (last-modifier nil) |
(last-halant nil) (preceding-r nil) (last-modifier nil) |
567 |
(last-char (char-before to)) match-str |
(last-char (char-before to)) match-str |
568 |
glyph-block split-pos) |
glyph-block split-pos) |
569 |
(save-excursion |
(save-excursion |
586 |
;; translate the rest characters into glyphs |
;; translate the rest characters into glyphs |
587 |
(while (re-search-forward dev-char-glyph-regexp nil t) |
(while (re-search-forward dev-char-glyph-regexp nil t) |
588 |
(setq match-str (match-string 0)) |
(setq match-str (match-string 0)) |
589 |
(setq glyph-str |
(setq glyph-str |
590 |
(concat glyph-str |
(concat glyph-str |
591 |
(gethash match-str dev-char-glyph-hash))) |
(gethash match-str dev-char-glyph-hash))) |
592 |
;; count the number of consonant-glyhs. |
;; count the number of consonant-glyhs. |
593 |
(if (string-match devanagari-consonant match-str) |
(if (string-match devanagari-consonant match-str) |
594 |
(setq cons-num (1+ cons-num)))) |
(setq cons-num (1+ cons-num)))) |
595 |
;; preceding-r must be attached before the anuswar if exists. |
;; preceding-r must be attached before the anuswar if exists. |
596 |
(if preceding-r |
(if preceding-r |
597 |
(if last-modifier |
(if last-modifier |
598 |
(setq glyph-str (concat (substring glyph-str 0 -1) |
(setq glyph-str (concat (substring glyph-str 0 -1) |
599 |
"$,4"'(B" (substring glyph-str -1))) |
"$,4"'(B" (substring glyph-str -1))) |
600 |
(setq glyph-str (concat glyph-str "$,4"'(B")))) |
(setq glyph-str (concat glyph-str "$,4"'(B")))) |
601 |
(if last-halant (setq glyph-str (concat glyph-str "$,4""(B"))) |
(if last-halant (setq glyph-str (concat glyph-str "$,4""(B"))) |
602 |
;;; *** glyph-to-glyph conversion *** |
;;; *** glyph-to-glyph conversion *** |
603 |
(when (string-match dev-glyph-glyph-regexp glyph-str) |
(when (string-match dev-glyph-glyph-regexp glyph-str) |
604 |
(setq glyph-str |
(setq glyph-str |
605 |
(replace-match (gethash (match-string 0 glyph-str) |
(replace-match (gethash (match-string 0 glyph-str) |
606 |
dev-glyph-glyph-hash) |
dev-glyph-glyph-hash) |
607 |
nil t glyph-str)) |
nil t glyph-str)) |
608 |
(if (and (> cons-num 1) |
(if (and (> cons-num 1) |
615 |
(while (setq split-pos (string-match "$,4""(B\\|.$" glyph-str)) |
(while (setq split-pos (string-match "$,4""(B\\|.$" glyph-str)) |
616 |
(setq glyph-block (substring glyph-str 0 (1+ split-pos))) |
(setq glyph-block (substring glyph-str 0 (1+ split-pos))) |
617 |
(setq glyph-str (substring glyph-str (1+ split-pos))) |
(setq glyph-str (substring glyph-str (1+ split-pos))) |
618 |
(setq |
(setq |
619 |
glyph-block |
glyph-block |
620 |
(if (string-match dev-glyph-right-modifier-regexp glyph-block) |
(if (string-match dev-glyph-right-modifier-regexp glyph-block) |
621 |
(sort (string-to-list glyph-block) |
(sort (string-to-list glyph-block) |
622 |
(function (lambda (x y) |
(function (lambda (x y) |
630 |
(setq glyph-str-list (nconc glyph-str-list glyph-block))) |
(setq glyph-str-list (nconc glyph-str-list glyph-block))) |
631 |
;; concatenate and attach reference-points. |
;; concatenate and attach reference-points. |
632 |
(setq glyph-str |
(setq glyph-str |
633 |
(cdr |
(cdr |
634 |
(apply |
(apply |
635 |
'nconc |
'nconc |
636 |
(mapcar |
(mapcar |
637 |
(function (lambda (x) |
(function (lambda (x) |
638 |
(list |
(list |
639 |
(or (get-char-code-property x 'reference-point) |
(or (get-char-code-property x 'reference-point) |
640 |
'(5 . 3) ;; default reference point. |
'(5 . 3) ;; default reference point. |