comparison lisp/language/devan-util.el @ 49598:0d8b17d428b5

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