aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1997-02-26 12:39:10 +0000
committerKenichi Handa1997-02-26 12:39:10 +0000
commitbd09f27bd130e8396549a20989b19f93b422f180 (patch)
tree3f4505721307e7ecb8261121ce74d81f22366a78
parentad04ee4e045859b5efd9b39782fc6c1f129617cb (diff)
downloademacs-bd09f27bd130e8396549a20989b19f93b422f180.tar.gz
emacs-bd09f27bd130e8396549a20989b19f93b422f180.zip
Fix handling of several characters.
-rw-r--r--lisp/language/devan-util.el217
1 files changed, 128 insertions, 89 deletions
diff --git a/lisp/language/devan-util.el b/lisp/language/devan-util.el
index 907fe75e3be..c490bf612fd 100644
--- a/lisp/language/devan-util.el
+++ b/lisp/language/devan-util.el
@@ -27,6 +27,7 @@
27 27
28;; History: 28;; History:
29;; 1996.10.18 written by KAWABATA, Taichi <kawabata@is.s.u-tokyo.ac.jp> 29;; 1996.10.18 written by KAWABATA, Taichi <kawabata@is.s.u-tokyo.ac.jp>
30;; 1997.1.20 fixed some bugs.
30 31
31;; Devanagari script composition rules and related programs. 32;; Devanagari script composition rules and related programs.
32 33
@@ -104,7 +105,7 @@
104;; Syllable ::= Cons-Vowel-Syllable | Vowel-Syllable 105;; Syllable ::= Cons-Vowel-Syllable | Vowel-Syllable
105;; Vowel-Syllable ::= V[D] 106;; Vowel-Syllable ::= V[D]
106;; Cons-Vowel-Syllable ::= [Cons-Syllable] Full-Cons [M] [D] 107;; Cons-Vowel-Syllable ::= [Cons-Syllable] Full-Cons [M] [D]
107;; Cons-Syllable ::= [Pure-Cons] [Pure-Cons] Pure-Cons 108;; Cons-Syllable ::= [Pure-Cons] [Pure-Cons] [Pure-Cons] Pure-Cons
108;; Pure-Cons ::= Full-Cons H 109;; Pure-Cons ::= Full-Cons H
109;; Full-Cons ::= C [N] 110;; Full-Cons ::= C [N]
110;; 111;;
@@ -113,25 +114,30 @@
113;; C - Consonant ($(5!3!4!5!6!7!8!9!:!;!<!=!>!?!@!A!B!C!D!E(B 114;; C - Consonant ($(5!3!4!5!6!7!8!9!:!;!<!=!>!?!@!A!B!C!D!E(B
114;; $(5!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X(B) 115;; $(5!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X(B)
115;; N - Nukta ($(5!i(B) 116;; N - Nukta ($(5!i(B)
116;; H - Halant($(5!h(B) 117;; H - Halant($(5!h(B) or Virama
117;; V - Vowel ($(5!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2(B) 118;; V - Vowel ($(5!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2#&#'#*(B)
118;; D - Vowel Modifiers, i.e. Anuswar, Chandrabindu, Visarg ($(5!!!"(B) 119;; ("$(5#&#'#*(B" can be obtained by IS13194 vowels with nukta.)
119;; M - Matra ($(5!Z![!\!]!^!_!`!a!b!c!d!e!f!g(B) 120;; D - Vowel Modifiers, i.e. Anuswar, Chandrabindu, Visarga ($(5!!!"!#(B)
121;; M - Matra ($(5!Z![!\!]!^!_!`!a!b!c!d!e!f!g#K#L#M(B)
122;; ("$(5#K#L#M(B" can be obtained by IS13194 matras with nukta.)
120;; 123;;
121;; In Emacs, one syllable of Indian language is considered to be one 124;; In Emacs, one syllable of Indian language is considered to be one
122;; composite glyph. If we expand the above expression, it would be: 125;; composite glyph. If we expand the above expression, it would be:
123;; 126;;
124;; [[C [N] H] [C [N] H] C [N] H] C [N] [M] [D] | V [D] 127;; [[C [N] H] [C [N] H] [C [N] H] C [N] H] C [N] [M] [D] | V [D]
125;; 128;;
126;; Therefore, in worst case, the consonant syllabe will consist of 129;; Therefore, in worst case, the consonant syllabe will consist of
127;; following characters. 130;; following characters.
128;; 131;;
129;; C N H C N H C N H C N M D 132;; C N H C N H C N H C N H C N M D
133;;
134;; The example is a sanskrit word "kaurtsnya", where five consecutive
135;; consonant appears.
130;; 136;;
131;; On the other hand, incomplete consonant syllable before inputting 137;; On the other hand, incomplete consonant syllable before inputting
132;; base consonant must satisfy the following condition: 138;; base consonant must satisfy the following condition:
133;; 139;;
134;; [C [N] H] [C [N] H] C [N] H 140;; [C [N] H] [C [N] H] [C [N] H] C [N] H
135;; 141;;
136;; This is acceptable BEFORE proper consonant-syllable is input. The 142;; This is acceptable BEFORE proper consonant-syllable is input. The
137;; string which doesn't match with the above expression is invalid and 143;; string which doesn't match with the above expression is invalid and
@@ -141,21 +147,21 @@
141;; Third case can be considered, which is acceptable syllable and can 147;; Third case can be considered, which is acceptable syllable and can
142;; not add any code more. 148;; not add any code more.
143;; 149;;
144;; [[C [N] H] [C [N] H] C [N] H] C [N] [M] D 150;; [[C [N] H] [C [N] H] [C [N] H] C [N] H] C [N] [M] D
145;; 151;;
146;; However, to make editing possible even in this condition, we will 152;; However, to make editing possible even in this condition, we will
147;; not consider about this case. 153;; not consider about this case.
148 154
149(defconst devanagari-cons-syllable-examine 155(defconst devanagari-cons-syllable-examine
150 "\\(\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?[$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?[$(5!3(B-$(5!X(B]$(5!i(B?[$(5!Z(B-$(5!g(B]?[$(5!!!"(B]?" 156 "\\(\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?[$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?[$(5!3(B-$(5!X(B]$(5!i(B?\\([$(5!Z(B-$(5!g#K#L#M(B]\\|\\($(5!_!i(B\\)\\|\\($(5![!i(B\\)\\|\\($(5!\!i(B\\)\\)?[$(5!!!"!#(B]?"
151 "Regexp matching to one Devanagari consonant syllable.") 157 "Regexp matching to one Devanagari consonant syllable.")
152 158
153(defconst devanagari-cons-syllable-incomplete-examine 159(defconst devanagari-cons-syllable-incomplete-examine
154 "\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?[$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B$" 160 "\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?\\([$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B\\)?[$(5!3(B-$(5!X(B]$(5!i(B?$(5!h(B$"
155 "Regexp matching to one Devanagari incomplete consonant syllable.") 161 "Regexp matching to one Devanagari incomplete consonant syllable.")
156 162
157(defconst devanagari-vowel-syllable-examine 163(defconst devanagari-vowel-syllable-examine
158 "[$(5!$(B-$(5!2(B][$(5!!!"!#(B]?" 164 "\\([$(5!$(B-$(5!2#&#'#*(B]\\|\\($(5!*!i(B\\)\\|\\($(5!&!i(B\\)\\|\\($(5!'!i(B\\)\\)[$(5!!!"!#(B]?"
159 "Regexp matching to one Devanagari vowel syllable.") 165 "Regexp matching to one Devanagari vowel syllable.")
160 166
161;; 167;;
@@ -167,7 +173,7 @@
167(defconst devanagari-digit-viram-examine 173(defconst devanagari-digit-viram-examine
168 "[$(5!q(B-$(5!z!j(B]") 174 "[$(5!q(B-$(5!z!j(B]")
169(defconst devanagari-other-sign-examine 175(defconst devanagari-other-sign-examine
170 "[$(5!!!j(B]$(5!i(B") 176 "\\([$(5!!!j(B]$(5!i(B\\)\\|\\([$(5#!#J(B]\\)")
171 177
172(defconst devanagari-composite-glyph-unit-examine 178(defconst devanagari-composite-glyph-unit-examine
173 (concat "\\(" devanagari-cons-syllable-incomplete-examine 179 (concat "\\(" devanagari-cons-syllable-incomplete-examine
@@ -242,6 +248,16 @@
242 ;; ("[^$(5!h(B]\\($(5!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"p(B") 248 ;; ("[^$(5!h(B]\\($(5!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"p(B")
243 ("^\\($(5!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"p(B") 249 ("^\\($(5!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"p(B")
244 250
251 ;; Half Form Ligature
252 ;; Here is the half-form ligature which has higher priority than
253 ;; the common ligature rules listed below.
254 ;; special forms.
255 ("\\($(5!3!h!V!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"l(B")
256 ("\\($(5!:!h!<!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"m(B")
257 ;; Ordinary forms.
258 ("\\($(5!B!h!B!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"c(B")
259 ("\\($(5!F!h!F!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"k(B")
260
245 ;; If "r" is preceded by the vowel-suppressed consonant 261 ;; If "r" is preceded by the vowel-suppressed consonant
246 ;; (especially those with vertical line), it will be written as 262 ;; (especially those with vertical line), it will be written as
247 ;; slanted line below the preceding consonant character. Some of 263 ;; slanted line below the preceding consonant character. Some of
@@ -250,12 +266,15 @@
250 ("\\($(5!:!i!h!O(B\\)" . "$(5"!(B") 266 ("\\($(5!:!i!h!O(B\\)" . "$(5"!(B")
251 ("\\($(5!I!i!h!O(B\\)" . "$(5""(B") 267 ("\\($(5!I!i!h!O(B\\)" . "$(5""(B")
252 ("\\($(5!3!h!O(B\\)" . "$(5"#(B") 268 ("\\($(5!3!h!O(B\\)" . "$(5"#(B")
253 ("\\($(5!:!h!O(B\\)" . "$(5"$(B") 269 ("\\($(5!5!h!O(B\\)" . "$(5"$(B")
254 ("\\($(5!B!h!O(B\\)" . "$(5"%(B") 270 ("\\($(5!B!h!O(B\\)" . "$(5"%(B")
255 ("\\($(5!H!h!O(B\\)" . "$(5"&(B") 271 ("\\($(5!H!h!O(B\\)" . "$(5"&(B")
256 ("\\($(5!I!h!O(B\\)" . "$(5"'(B") 272 ("\\($(5!I!h!O(B\\)" . "$(5"'(B")
257 ("\\($(5!U!h!O(B\\)" . "$(5"((B") 273 ("\\($(5!U!h!O(B\\)" . "$(5")(B")
258 ("\\($(5!W!h!O(B\\)" . "$(5")(B") 274
275 ;; Special Rules
276 ;; In the following case, "$(5!<!h!:(B" ligature does not occur.
277 ("\\($(5!<!h(B\\)$(5!:!h!<!h(B" . "$(5"<(B")
259 278
260 ;; Ligature Rules 279 ;; Ligature Rules
261 ("\\($(5!3!h!B!h!O!h!M(B\\)" . "$(5$!(B") 280 ("\\($(5!3!h!B!h!O!h!M(B\\)" . "$(5$!(B")
@@ -294,7 +313,7 @@
294 ("\\($(5!8!h!<(B\\)" . "$(5$B(B") 313 ("\\($(5!8!h!<(B\\)" . "$(5$B(B")
295 ("\\($(5!9!h!M(B\\)" . "$(5$C(B") 314 ("\\($(5!9!h!M(B\\)" . "$(5$C(B")
296 ("\\($(5!:!h!O(B\\)" . "$(5$D(B") 315 ("\\($(5!:!h!O(B\\)" . "$(5$D(B")
297 ("\\($(5!:!h!h(B\\)" . "$(5$E(B") 316 ("\\($(5!:!h!<(B\\)" . "$(5$E(B")
298 ("\\($(5!<!h!8(B\\)" . "$(5$F(B") 317 ("\\($(5!<!h!8(B\\)" . "$(5$F(B")
299 ("\\($(5!<!h!:(B\\)" . "$(5$G(B") 318 ("\\($(5!<!h!:(B\\)" . "$(5$G(B")
300 ("\\($(5!=!h!3(B\\)" . "$(5$H(B") 319 ("\\($(5!=!h!3(B\\)" . "$(5$H(B")
@@ -372,14 +391,10 @@
372 ;; connection which is not listed here has not been examined yet. 391 ;; connection which is not listed here has not been examined yet.
373 ;; I don't know what to do with them. 392 ;; I don't know what to do with them.
374 ;; 393 ;;
375 ;; special forms
376 ("\\($(5!3!h!V!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"l(B")
377 ("\\($(5!:!h!<!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"m(B")
378 ;; ordinary forms 394 ;; ordinary forms
379 ("\\($(5!5!h!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"`(B") 395 ("\\($(5!5!h!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"`(B")
380 ("\\($(5!6!h!F!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"a(B") 396 ("\\($(5!6!h!F!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"a(B")
381 ;; ("\\($(5!<!h!8!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"c(B") ; Mistake, must check later. 397 ;; ("\\($(5!<!h!8!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"c(B") ; Mistake, must check later.
382 ("\\($(5!B!h!B!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"c(B")
383 ("\\($(5!B!h!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"d(B") 398 ("\\($(5!B!h!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"d(B")
384 ("\\($(5!E!h!F!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"e(B") 399 ("\\($(5!E!h!F!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"e(B")
385 ("\\($(5!E!h!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"f(B") 400 ("\\($(5!E!h!O!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"f(B")
@@ -400,8 +415,16 @@
400 ;; have the vertical line (such as "$(5!?(B"), "$(5"r(B" is put beneath the 415 ;; have the vertical line (such as "$(5!?(B"), "$(5"r(B" is put beneath the
401 ;; consonant. 416 ;; consonant.
402 ;; 417 ;;
403 ;; ("cons-not-yet-listed-up\\($(5!h!O(B\\)" . "$(5"q(B")
404 ("[$(5!7!9!=!>!?!@!D!O!P!R!S!X(B]\\($(5!h!O(B\\)" . "$(5"r(B") 418 ("[$(5!7!9!=!>!?!@!D!O!P!R!S!X(B]\\($(5!h!O(B\\)" . "$(5"r(B")
419 ("\\($(5!J!h!O(B\\)" . "$(5!J"r(B") ; Protect from Half form conversion.
420 ("\\($(5!E!h!O(B\\)" . "$(5!E"r(B") ; Will be replaced with precomposed font.
421 ("\\($(5!6!h!O(B\\)" . "$(5!6"r(B")
422 ("\\($(5!K!h!O(B\\)" . "$(5!K"r(B")
423 ("\\($(5!T!h!O(B\\)" . "$(5!T"r(B")
424 ("\\($(5!L!h!O(B\\)" . "$(5!L"r(B")
425 ("\\($(5!7!h!5!h!O(B\\)" . "$(5$;"r(B") ; Ggr
426 ("\\($(5!7!h!3!h!O(B\\)" . "$(5$9"r(B") ; Gkr
427
405 ("$(5!?!i(B\\($(5!h!O(B\\)" . "$(5"r(B") 428 ("$(5!?!i(B\\($(5!h!O(B\\)" . "$(5"r(B")
406 ("$(5!@!i(B\\($(5!h!O(B\\)" . "$(5"r(B") 429 ("$(5!@!i(B\\($(5!h!O(B\\)" . "$(5"r(B")
407 430
@@ -410,6 +433,9 @@
410 ("\\($(5!&!i(B\\)" . "$(5#&(B") 433 ("\\($(5!&!i(B\\)" . "$(5#&(B")
411 ("\\($(5!'!i(B\\)" . "$(5#'(B") 434 ("\\($(5!'!i(B\\)" . "$(5#'(B")
412 ("\\($(5!*!i(B\\)" . "$(5#*(B") 435 ("\\($(5!*!i(B\\)" . "$(5#*(B")
436 ("\\($(5![!i(B\\)" . "$(5#L(B")
437 ("\\($(5!\!i(B\\)" . "$(5#M(B")
438 ("\\($(5!_!i(B\\)" . "$(5#K(B")
413 ("\\($(5!3!i(B\\)" . "$(5#3(B") 439 ("\\($(5!3!i(B\\)" . "$(5#3(B")
414 ("\\($(5!4!i(B\\)" . "$(5#4(B") 440 ("\\($(5!4!i(B\\)" . "$(5#4(B")
415 ("\\($(5!5!i(B\\)" . "$(5#5(B") 441 ("\\($(5!5!i(B\\)" . "$(5#5(B")
@@ -448,6 +474,11 @@
448 ("\\($(5!U!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"U(B") 474 ("\\($(5!U!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"U(B")
449 ("\\($(5!V!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"V(B") 475 ("\\($(5!V!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"V(B")
450 ("\\($(5!W!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"W(B") 476 ("\\($(5!W!h(B\\)[$(5!3(B-$(5!X(B]" . "$(5"W(B")
477
478 ;; Special rule for "rR"
479 ("\\($(5!O!_(B\\)" . "$(5!*"p(B")
480 ;; If everything fails, "y" will connect to the front consonant.
481 ("\\($(5!h!M(B\\)" . "$(5"](B")
451 ) 482 )
452 "Alist of regexps of Devanagari character sequences vs composed characters.") 483 "Alist of regexps of Devanagari character sequences vs composed characters.")
453 484
@@ -546,11 +577,16 @@ Ligatures and special rules are processed."
546;; Glyphs will be ordered from low priority number to high priority number. 577;; Glyphs will be ordered from low priority number to high priority number.
547;; If application-priority is omitted, it is assumed to be 0. 578;; If application-priority is omitted, it is assumed to be 0.
548;; If application-direction is omitted, it is asumbed to be '(mr . ml). 579;; If application-direction is omitted, it is asumbed to be '(mr . ml).
580;;
581;; Priority
582;; Base Glyphs = {$(5!h!i(B} = Misc >
583;; {$(5"p"q"r(B} > Matras > {$(5!!!"!#(B}
584;; Question Halant and '$(5"q"r(B' priority problem.
549 585
550(defconst devanagari-composition-rules 586(defconst devanagari-composition-rules
551 '((?$(5!!(B 60 (tr . br)) 587 '((?$(5!!(B 70 (tr . br))
552 (?$(5!"(B 60 (tr . br)) 588 (?$(5!"(B 70 (mr . mr))
553 (?$(5!#(B 60) 589 (?$(5!#(B 70)
554 (?$(5!$(B 0) 590 (?$(5!$(B 0)
555 (?$(5!%(B 0) 591 (?$(5!%(B 0)
556 (?$(5!&(B 0) 592 (?$(5!&(B 0)
@@ -611,16 +647,16 @@ Ligatures and special rules are processed."
611 (?$(5!](B 40 (bc . tc)) 647 (?$(5!](B 40 (bc . tc))
612 (?$(5!^(B 40 (bc . tc)) 648 (?$(5!^(B 40 (bc . tc))
613 (?$(5!_(B 40 (bc . tc)) 649 (?$(5!_(B 40 (bc . tc))
614 (?$(5!`(B 40 (tc . bc)) 650 (?$(5!`(B 40 (mr . mr)) ; (tc . bc)
615 (?$(5!a(B 40 (tc . bc)) 651 (?$(5!a(B 40 (mr . mr))
616 (?$(5!b(B 40 (tc . bc)) 652 (?$(5!b(B 40 (mr . mr))
617 (?$(5!c(B 40 (tc . bc)) 653 (?$(5!c(B 40 (mr . mr))
618 (?$(5!d(B 40) 654 (?$(5!d(B 40)
619 (?$(5!e(B 40) 655 (?$(5!e(B 40)
620 (?$(5!f(B 40) 656 (?$(5!f(B 40)
621 (?$(5!g(B 40) 657 (?$(5!g(B 40)
622 (?$(5!h(B 0 (br . tr)) ; Halant's special treatment. 658 (?$(5!h(B 0 (br . tr))
623 (?$(5!i(B 0 (br . tr)) ; Nukta's special treatment. 659 (?$(5!i(B 0 (br . tr))
624 (?$(5!j(B 0) 660 (?$(5!j(B 0)
625 (nil 0) 661 (nil 0)
626 (nil 0) 662 (nil 0)
@@ -721,9 +757,9 @@ Ligatures and special rules are processed."
721 (?$(5"m(B 0) 757 (?$(5"m(B 0)
722 (?$(5"n(B 0) 758 (?$(5"n(B 0)
723 (?$(5"o(B 0) 759 (?$(5"o(B 0)
724 (?$(5"p(B 20 (tr . br)) 760 (?$(5"p(B 30 (mr . mr))
725 (?$(5"q(B 20 (br . tr)) 761 (?$(5"q(B 30 (br . tr))
726 (?$(5"r(B 20 (br . tr)) 762 (?$(5"r(B 30 (br . tr))
727 (?$(5"s(B 0) 763 (?$(5"s(B 0)
728 (?$(5"t(B 0) 764 (?$(5"t(B 0)
729 (?$(5"u(B 0) 765 (?$(5"u(B 0)
@@ -778,9 +814,9 @@ Ligatures and special rules are processed."
778 (?$(5#H(B 0) 814 (?$(5#H(B 0)
779 (?$(5#I(B 0) 815 (?$(5#I(B 0)
780 (?$(5#J(B 0) 816 (?$(5#J(B 0)
781 (?$(5#K(B 0) 817 (?$(5#K(B 40 (bc . tc))
782 (?$(5#L(B 0) 818 (?$(5#L(B 40 (bc . tc))
783 (?$(5#M(B 0) 819 (?$(5#M(B 40 (bc . tc))
784 (?$(5#N(B 0) 820 (?$(5#N(B 0)
785 (?$(5#O(B 0) 821 (?$(5#O(B 0)
786 (?$(5#P(B 0) 822 (?$(5#P(B 0)
@@ -929,10 +965,6 @@ Ligatures and special rules are processed."
929;; Determine composition priority and rule of the array of Glyphs. 965;; Determine composition priority and rule of the array of Glyphs.
930;; Sort the glyphs with their priority. 966;; Sort the glyphs with their priority.
931 967
932;; Example:
933;;(devanagari-reorder-glyph-for-composition '[?$(5"5(B ?$(5!X(B ?$(5![(B])
934;; => ((446680 0) (446773 0) (446683 50 (ml . mr)))
935
936(defun devanagari-reorder-glyph-for-composition (glyph-alist) 968(defun devanagari-reorder-glyph-for-composition (glyph-alist)
937 (let* ((pos 0) 969 (let* ((pos 0)
938 (ordered-glyphs '())) 970 (ordered-glyphs '()))
@@ -966,6 +998,19 @@ Ligatures and special rules are processed."
966 (if (= (length cmp-glyph-list) 1) (char-to-string (car cmp-glyph-list)) 998 (if (= (length cmp-glyph-list) 1) (char-to-string (car cmp-glyph-list))
967 (apply 'compose-chars cmp-glyph-list)))) 999 (apply 'compose-chars cmp-glyph-list))))
968 1000
1001;; Utility function for Phase 2.5
1002;; Check whether given glyph is a Devanagari vertical modifier or not.
1003;; If it is a vertical modifier, whether it should be 1-column shape or not
1004;; depends on previous non-vertical modifier.
1005 ; return nil if it is not vertical modifier.
1006(defun devanagari-vertical-modifier-p (glyph)
1007 (string-match (char-to-string glyph)
1008 "[$(5!]!^!_!`!a!b!c!h!i"p"q"r#K#L#M(B]"))
1009
1010(defun devanagari-non-vertical-modifier-p (glyph)
1011 (string-match (char-to-string glyph)
1012 "[$(5!Z![!\!d!e!f!g(B]"))
1013
969 1014
970;; 1015;;
971;; Phase 2.5 Convert Appropriate Character to 1-column shape. 1016;; Phase 2.5 Convert Appropriate Character to 1-column shape.
@@ -981,56 +1026,50 @@ Ligatures and special rules are processed."
981;; with 2 column base-glyph. 1026;; with 2 column base-glyph.
982;; 1027;;
983;; Execution Examples 1028;; Execution Examples
984;;(devanagari-wide-to-narrow '(446680 446773 (ml . mr) 446683)) 1029;;(devanagari-wide-to-narrow '(?$(5!3(B (ml . ml) ?$(5!a(B))
985;;(devanagari-wide-to-narrow '(?$(5!6(B (ml . ml) 446773 (tc . mr) 446683)) 1030;;(devanagari-wide-to-narrow '(?$(5!F(B (ml . ml) ?$(5!a(B))
1031
1032;(defun devanagari-wide-to-narrow (src-list)
1033; (if (null src-list) '()
1034; (cons
1035; (if (and (numberp (car src-list))
1036; (cdr (assq (car src-list) devanagari-1-column-char)))
1037; (cdr (assq (car src-list) devanagari-1-column-char))
1038; (car src-list))
1039; (devanagari-wide-to-narrow (cdr src-list)))))
986 1040
987(defun devanagari-wide-to-narrow (src-list) 1041(defun devanagari-wide-to-narrow (src-list)
988 (if (null src-list) '() 1042 (devanagari-wide-to-narrow-iter src-list t))
989 (cons 1043
990 (if (and (numberp (car src-list)) 1044(defun devanagari-wide-to-narrow-iter (src-list wide-p)
991 (cdr (assq (car src-list) devanagari-1-column-char))) 1045 (let ((glyph (car src-list)))
992 (cdr (assq (car src-list) devanagari-1-column-char)) 1046 (cond ((null src-list) '())
993 (car src-list)) 1047 ; not glyph code
994 (devanagari-wide-to-narrow (cdr src-list))))) 1048 ((not (numberp glyph))
995 1049 (cons glyph (devanagari-wide-to-narrow-iter (cdr src-list) wide-p)))
996;; Make this function obsolete temporary Because now Emacs supports 1050 ; vertical modifier glyph
997;; attaching 1 column character at the center 2 column char. However, 1051 ((devanagari-vertical-modifier-p glyph)
998;; there are still problems attempting to attach Halant or Nukta sign 1052 (if (and (null wide-p)
999;; at the non-vowel consonant. This problem can not be solved until 1053 (cdr (assq glyph devanagari-1-column-char)))
1000;; Emacs supports attaching the glyph at `temporary-preserved metric'. 1054 (cons (cdr (assq glyph devanagari-1-column-char))
1001 1055 (devanagari-wide-to-narrow-iter (cdr src-list) nil))
1002(defun devanagari-wide-to-narrow-old (src-list) 1056 (cons glyph
1003 (if (null src-list) (progn (error "devanagari-wide-to-narrow error") nil) 1057 (devanagari-wide-to-narrow-iter (cdr src-list) t))))
1004 (let* ((base-glyph (cdr (assq (car src-list) devanagari-1-column-char))) 1058 ; nonvertical modifier glyph
1005 (wide-base-glyph nil) 1059 ((devanagari-non-vertical-modifier-p glyph)
1006 (apply-glyph-list (cdr src-list))) 1060 (if (cdr (assq glyph devanagari-1-column-char))
1007 (if (null base-glyph) 1061 (cons (cdr (assq glyph devanagari-1-column-char))
1008 (progn 1062 (devanagari-wide-to-narrow-iter (cdr src-list) wide-p))
1009 (setq wide-base-glyph t) 1063 (cons glyph
1010 (setq base-glyph (car src-list)))) 1064 (devanagari-wide-to-narrow-iter (cdr src-list) wide-p))))
1011 (cons base-glyph 1065 ; normal glyph
1012 (devanagari-wide-to-narrow-iter apply-glyph-list wide-base-glyph)) 1066 (t
1013 ))) 1067 (if (cdr (assq glyph devanagari-1-column-char))
1014 1068 (cons (cdr (assq glyph devanagari-1-column-char))
1015;; Convert apply-glyph-list from 2-column to 1-column. 1069 (devanagari-wide-to-narrow-iter (cdr src-list) nil))
1016;; wide-base-glyph is t when base-glyph is 2-column. 1070 (cons glyph
1017;; When apply-glyph is put at the top or bottom of 2-column base-glyph, 1071 (devanagari-wide-to-narrow-iter (cdr src-list) t)))))))
1018;; they must be 2-column glyph, too. Otherwise, they will be 1072
1019;; converted to 1-column glyph if possible.
1020
1021(defun devanagari-wide-to-narrow-iter (apply-glyph-list wide-base-glyph)
1022 (if (< (length apply-glyph-list) 2) '()
1023 (let* ((apply-dir (car apply-glyph-list))
1024 (apply-glyph (car (cdr apply-glyph-list)))
1025 (apply-rest (cdr (cdr apply-glyph-list)))
1026 (put-t-or-b (member (car apply-dir) '(tl tc tr bl bc br)))
1027 (narrow-glyph (cdr (assq apply-glyph devanagari-1-column-char))))
1028 (append
1029 (list apply-dir
1030 (if (or (and wide-base-glyph put-t-or-b)
1031 (null narrow-glyph))
1032 apply-glyph narrow-glyph))
1033 (devanagari-wide-to-narrow-iter apply-rest wide-base-glyph)))))
1034 1073
1035;; 1074;;
1036;; Summary 1075;; Summary