Mercurial > emacs
annotate lisp/language/devan-util.el @ 89264:bb4ce770b305
Delete the superfluous autoload cookie
near the head of the file.
(devanagari-compose-region): Add autoload cookie.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 30 Oct 2002 00:59:16 +0000 |
parents | 4b2c6fea90ce |
children | ea8374ccb41f |
rev | line source |
---|---|
89141 | 1 ;;; devan-util.el --- Support for composing Devanagari characters -*-coding: iso-2022-7bit;-*- |
17052 | 2 |
41469 | 3 ;; Copyright (C) 2001 Free Software Foundation, Inc. |
17052 | 4 |
41469 | 5 ;; Maintainer: KAWABATA, Taichi <batta@beige.ocn.ne.jp> |
6 ;; Keywords: multilingual, Devanagari | |
17052 | 7 |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
17314
f438ebf1c679
Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents:
17300
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
f438ebf1c679
Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents:
17300
diff
changeset
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
f438ebf1c679
Fix FSF address in comment.
Kenichi Handa <handa@m17n.org>
parents:
17300
diff
changeset
|
23 ;; Boston, MA 02111-1307, USA. |
17052 | 24 |
41469 | 25 ;; Created: Feb. 17. 2001 |
26 | |
17052 | 27 ;;; Commentary: |
28 | |
41469 | 29 ;; This file provides character(Unicode) to glyph(CDAC) conversion and |
30 ;; composition of Devanagari script characters. | |
17052 | 31 |
32 ;;; Code: | |
33 | |
41469 | 34 ;; Devanagari Composable Pattern |
35 ;; C .. Consonants | |
36 ;; V .. Vowel | |
37 ;; H .. Halant | |
38 ;; M .. Matra | |
39 ;; V .. Vowel | |
40 ;; A .. Anuswar | |
41 ;; D .. Chandrabindu | |
42 ;; (N .. Zerowidth Non Joiner) | |
43 ;; (J .. Zerowidth Joiner. ) | |
44 ;; 1. vowel | |
45 ;; V(A/D)? | |
46 ;; 2. syllable : maximum of 5 consecutive consonants. (e.g. kartsnya) | |
41602 | 47 ;; ((CH)?(CH)?(CH)?CH)?C(H|M?(A|D)?)? |
17052 | 48 |
41469 | 49 (defconst devanagari-consonant |
50 "[$,15U(B-$,15y68(B-$,16?(B]") | |
17052 | 51 |
41469 | 52 (defconst devanagari-composable-pattern |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
53 (concat |
41469 | 54 "\\([$,15E(B-$,15T6@6A(B][$,15A5B(B]?\\)\\|$,15C(B" |
55 "\\|\\(" | |
56 "\\(?:\\(?:[$,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\\)?" | |
57 "[$,15U(B-$,15y68(B-$,16?(B]\\(?:$,16-(B\\|[$,15~(B-$,16-6B6C(B]?[$,15B5A(B]?\\)?" | |
58 "\\)") | |
59 "Regexp matching a composable sequence of Devanagari characters.") | |
17052 | 60 |
89264
bb4ce770b305
Delete the superfluous autoload cookie
Kenichi Handa <handa@m17n.org>
parents:
89141
diff
changeset
|
61 ;;;###autoload |
41469 | 62 (defun devanagari-compose-region (from to) |
17300
01d528c5dd18
Handle more Devanagari characters correctly.
Kenichi Handa <handa@m17n.org>
parents:
17087
diff
changeset
|
63 (interactive "r") |
26894 | 64 (save-excursion |
65 (save-restriction | |
66 (narrow-to-region from to) | |
67 (goto-char (point-min)) | |
41469 | 68 (while (re-search-forward devanagari-composable-pattern nil t) |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
69 (devanagari-compose-syllable-region (match-beginning 0) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
70 (match-end 0)))))) |
41469 | 71 (defun devanagari-compose-string (string) |
72 (with-temp-buffer | |
73 (insert (decompose-string string)) | |
74 (devanagari-compose-region (point-min) (point-max)) | |
75 (buffer-string))) | |
76 | |
42054
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
77 (defun devanagari-post-read-conversion (len) |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
78 (save-excursion |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
79 (save-restriction |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
80 (let ((buffer-modified-p (buffer-modified-p))) |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
81 (narrow-to-region (point) (+ (point) len)) |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
82 (devanagari-compose-region (point-min) (point-max)) |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
83 (set-buffer-modified-p buffer-modified-p) |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
84 (- (point-max) (point-min)))))) |
144a811f0590
(devanagari-post-read-conversion): New
Dave Love <fx@gnu.org>
parents:
41602
diff
changeset
|
85 |
42061
0332665b9445
(devanagari-range): Renamed from `range'. All calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
42054
diff
changeset
|
86 (defun devanagari-range (from to) |
41469 | 87 "Make the list of the integers of range FROM to TO." |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
88 (let (result) |
41469 | 89 (while (<= from to) (setq result (cons to result) to (1- to))) result)) |
90 | |
42061
0332665b9445
(devanagari-range): Renamed from `range'. All calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
42054
diff
changeset
|
91 (defun devanagari-regexp-of-hashtbl-keys (hashtbl) |
0332665b9445
(devanagari-range): Renamed from `range'. All calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
42054
diff
changeset
|
92 "Return a regular expression that matches all keys in hashtable HASHTBL." |
41469 | 93 (let ((max-specpdl-size 1000)) |
94 (regexp-opt | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
95 (sort |
41469 | 96 (let (dummy) |
97 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl) | |
98 dummy) | |
99 (function (lambda (x y) (> (length x) (length y)))))))) | |
100 | |
101 (defun devanagari-composition-function (from to pattern &optional string) | |
102 "Compose Devanagari characters in REGION, or STRING if specified. | |
103 Assume that the REGION or STRING must fully match the composable | |
104 PATTERN regexp." | |
105 (if string (devanagari-compose-syllable-string string) | |
106 (devanagari-compose-syllable-region from to)) | |
107 (- to from)) | |
108 | |
109 ;; Register a function to compose Devanagari characters. | |
110 (mapc | |
111 (function (lambda (ucs) | |
88616
1e2984f890a6
Add coding tag, avoid decode-char.
Dave Love <fx@gnu.org>
parents:
42311
diff
changeset
|
112 (aset composition-function-table ucs |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
113 (list (cons devanagari-composable-pattern |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
114 'devanagari-composition-function))))) |
42061
0332665b9445
(devanagari-range): Renamed from `range'. All calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
42054
diff
changeset
|
115 (nconc '(#x0903) (devanagari-range #x0905 #x0939) (devanagari-range #x0958 #x0961))) |
41469 | 116 |
117 ;; Notes on conversion steps. | |
17052 | 118 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
119 ;; 1. chars to glyphs |
41469 | 120 ;; |
121 ;; Rules will not be applied to the halant appeared at the end of the | |
122 ;; text. Also, the preceding/following "r" will be treated as special case. | |
123 | |
124 ;; 2. glyphs reordering. | |
125 ;; | |
126 ;; The glyphs are split by halant, and each glyph groups are | |
127 ;; re-ordered in the following order. | |
128 ;; | |
129 ;; Note that `consonant-glyph' mentioned here does not contain the | |
130 ;; vertical bar (right modifier) attached at the right of the | |
131 ;; consonant. | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
132 ;; |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
133 ;; If the glyph-group contains right modifier, |
41469 | 134 ;; (1) consonant-glyphs/vowels, with nukta sign |
135 ;; (2) spacing | |
136 ;; (3) right modifier (may be matra) | |
137 ;; (4) top matra | |
138 ;; (5) preceding "r" | |
139 ;; (6) anuswar | |
140 ;; (7) following "r" | |
141 ;; (8) bottom matra or halant. | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
142 ;; |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
143 ;; Otherwise, |
41469 | 144 ;; (1) consonant-glyph/vowels, with nukta sign |
145 ;; (3) left matra | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
146 ;; (4) top matra |
41469 | 147 ;; (5) preceding "r" |
148 ;; (6) anuswar | |
149 ;; (7) following "r" | |
150 ;; (8) bottom matra or halant. | |
151 ;; (2) spacing | |
152 | |
153 ;; 3. glyph to glyph | |
154 ;; | |
155 ;; For better display, some glyph display would be tuned. | |
156 | |
157 ;; 4. Composition. | |
158 ;; | |
159 ;; left modifiers will be attached at the left. | |
160 ;; others will be attached right. | |
161 | |
162 ;; Problem:: | |
163 ;; Can we generalize this methods to other Indian scripts? | |
17052 | 164 |
41523 | 165 (defvar dev-char-glyph |
166 '(("$,15E(B" . "$,4 K(B") | |
41599 | 167 ("$,15F(B" . "$,4 K")(B") |
168 ("$,15~(B" . "$,4")(B") | |
41523 | 169 ("$,15G(B" . "$,4 \(B") |
41599 | 170 ("$,15(B" . "$,4"*(B") |
171 ("$,155A(B" . "$,4"*(B\$,4"&(B") | |
41523 | 172 ("$,15H(B" . "$,4 \"'(B") |
41599 | 173 ("$,15H5A(B" . "$,4 \"'"&(B") |
174 ("$,16 (B" . "$,4"2(B") | |
175 ("$,16 5A(B" . "$,4"2"&(B") | |
41523 | 176 ("$,15I(B" . "$,4 ](B") |
41599 | 177 ("$,16!(B" . "$,4"6(B") |
178 ("$,15J(B" . "$,4 ^"P(B") | |
179 ("$,16"(B" . "$,4":(B") | |
180 ("$,15K(B" . "$,4 `"Q(B") | |
181 ("$,16#(B" . "$,4">(B") | |
41523 | 182 ;;("$,15L(B" . nil) ; not implemented. |
41599 | 183 ("$,16$(B" . "$,4"?(B") |
184 ("$,15M(B" . "$,4 b"L(B") | |
185 ("$,15M5A(B" . "$,4 b"$(B") | |
186 ("$,15M5B(B" . "$,4 b"$(B") | |
187 ("$,16%(B" . "\$,4"L(B") | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
188 ("$,15N(B" . "$,4 b"@(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
189 ("$,15N5A(B" . "$,4 b"@"&(B") |
41599 | 190 ("$,16&(B" . "\$,4"@(B") |
191 ("$,16&5A(B" . "\$,4"@(B\$,4"&(B") | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
192 ("$,15O(B" . "$,4 b(B") |
41599 | 193 ("$,16'(B" . "\$,4"D(B") |
194 ("$,16'5A(B" . "\$,4"D(B\$,4"&(B") | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
195 ("$,15P(B" . "$,4 b"D(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
196 ("$,15P5A(B" . "$,4 b"D"&(B") |
41599 | 197 ("$,16((B" . "\$,4"H(B") |
198 ("$,16(5A(B" . "\$,4"H(B\$,4"&(B") | |
199 ("$,15Q(B" . "$,4 K")"L(B") ;; special rule for reodering. | |
200 ("$,15Q5A(B" . "$,4 K")"$(B") | |
201 ("$,15Q5B(B" . "$,4 K")"$(B") | |
202 ("$,16)(B" . "\$,4")"L(B") | |
203 ("$,16)5A(B" . "\$,4")"$(B") | |
204 ("$,16)5B(B" . "\$,4")"$(B") | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
205 ("$,15R(B" . "$,4 K")"@(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
206 ("$,15R5A(B" . "$,4 K")"@"&(B") |
41599 | 207 ("$,16*(B" . "\$,4")"@(B") |
208 ("$,16*5A(B" . "\$,4")"@"&(B") | |
209 ("$,15S(B" . "$,4 K")"D(B") | |
210 ("$,15S5A(B" . "$,4 K")"D"&(B") | |
211 ("$,16+(B" . "\$,4")"D(B") | |
212 ("$,16+5A(B" . "\$,4")"D"&(B") | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
213 ("$,15T(B" . "$,4 K")"H(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
214 ("$,15T5A(B" . "$,4 K")"H"&(B") |
41599 | 215 ("$,16,(B" . "\$,4")"H(B") |
216 ("$,16,5A(B" . "\$,4")"H"&(B") | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
217 ("$,16@(B" . "$,4 a"Q(B") |
41523 | 218 ;;("$,16B(B" . nil) |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
219 ;;("$,16A(B" . nil) |
41523 | 220 ;;("$,16C(B" . nil) |
41469 | 221 |
41523 | 222 ;; GRUTTALS |
41599 | 223 ("$,15U(B" . "$,4 e"R(B") |
41523 | 224 ("$,15U6-(B" . "$,4 c(B") |
41599 | 225 ("$,15U6-5p(B" . "$,4 g"R(B") |
226 ("$,15U6-5d(B" . "$,4 h"R(B") | |
227 ("$,15U6-5w(B" . "$,4 i")(B") | |
41523 | 228 ("$,15U6-5w6-(B" . "$,4 i(B") |
41469 | 229 |
41599 | 230 ("$,15V(B" . "$,4 j")(B") |
41523 | 231 ("$,15V6-(B" . "$,4 j(B") |
41599 | 232 ("$,15V6-5p(B" . "$,4 l")(B") |
41523 | 233 ("$,15V6-5p6-(B" . "$,4 l(B") |
41469 | 234 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
235 ("$,15W(B" . "$,4 m")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
236 ("$,15W6-(B" . "$,4 m(B") |
41599 | 237 ("$,15W6-5p(B" . "$,4 o")(B") |
41523 | 238 ("$,15W6-5p6-(B" . "$,4 o(B") |
41469 | 239 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
240 ("$,15X(B" . "$,4 p")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
241 ("$,15X6-(B" . "$,4 p(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
242 ("$,15X6-5p(B" . "$,4 q")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
243 ("$,15X6-5p6-(B" . "$,4 q(B") |
41469 | 244 |
41599 | 245 ("$,15Y(B" . "$,4 r"S(B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
246 ;; PALATALS |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
247 ("$,15Z(B" . "$,4 s")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
248 ("$,15Z6-(B" . "$,4 s(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
249 ("$,15Z6-5p(B" . "$,4 t")(B") |
41523 | 250 ("$,15Z6-5p6-(B" . "$,4 t(B") |
41469 | 251 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
252 ("$,15[(B" . "$,4 u"T(B") |
41469 | 253 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
254 ("$,15\(B" . "$,4 v")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
255 ("$,15\6-(B" . "$,4 v(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
256 ("$,15\6-5p(B" . "$,4 x")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
257 ("$,15\6-5p6-(B" . "$,4 x(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
258 ("$,15\6-5^(B" . "$,4 y")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
259 ("$,15\6-5^6-(B" . "$,4 y(B") |
17052 | 260 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
261 ("$,15](B" . "$,4 z")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
262 ("$,15]6-(B" . "$,4 z(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
263 ("$,15]6-5p(B" . "$,4 {")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
264 ("$,15]6-5p6-(B" . "$,4 {(B") |
41469 | 265 |
41599 | 266 ("$,15^(B" . "$,4 |")(B") |
41523 | 267 ("$,15^6-(B" . "$,4 |(B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
268 ;; CEREBRALS |
41599 | 269 ("$,15_(B" . "$,4 }"U(B") |
270 ("$,15_6-5_(B" . "$,4 ~"U(B") | |
271 ("$,15_6-5`(B" . "$,4 "U(B") | |
41469 | 272 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
273 ("$,15`(B" . "$,4! "V(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
274 ("$,15`6-5`(B" . "$,4!!"V(B") |
41469 | 275 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
276 ("$,15a(B" . "$,4!""W(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
277 ("$,15a6-5a(B" . "$,4!$"W(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
278 ("$,15a6-5b(B" . "$,4!%"W(B") |
41469 | 279 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
280 ("$,15b(B" . "$,4!&"X(B") |
41469 | 281 |
41599 | 282 ("$,15c(B" . "$,4!(")(B") |
41523 | 283 ("$,15c6-(B" . "$,4!((B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
284 ;; DENTALS |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
285 ("$,15d(B" . "$,4!)")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
286 ("$,15d6-(B" . "$,4!)(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
287 ("$,15d6-5p(B" . "$,4!*")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
288 ("$,15d6-5p6-(B" . "$,4!*(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
289 ("$,15d6-5d(B" . "$,4!+")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
290 ("$,15d6-5d6-(B" . "$,4!+(B") |
41469 | 291 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
292 ("$,15e(B" . "$,4!,")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
293 ("$,15e6-(B" . "$,4!,(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
294 ("$,15e6-5p(B" . "$,4!-")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
295 ("$,15e6-5p6-(B" . "$,4!-(B") |
41469 | 296 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
297 ("$,15f(B" . "$,4!."Y(B") |
41599 | 298 ("$,15f6#(B" . "$,4!/"Y(B") |
299 ("$,15f6-5p(B" . "$,4!0"Y(B") | |
300 ("$,15f6-5f(B" . "$,4!1"Y(B") | |
301 ("$,15f6-5g(B" . "$,4!2"Y(B") | |
41523 | 302 ("$,15f6-5n(B" . "$,4!3(B") |
303 ("$,15f6-5o(B" . "$,4!4(B") | |
41599 | 304 ("$,15f6-5u(B" . "$,4!5"Y(B") |
17773
f1ece95d00c2
(in-is13194-devanagari-post-read-conversion): New function.
Kenichi Handa <handa@m17n.org>
parents:
17314
diff
changeset
|
305 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
306 ("$,15g(B" . "$,4!6")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
307 ("$,15g6-(B" . "$,4!6(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
308 ("$,15g6-5p(B" . "$,4!7")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
309 ("$,15g6-5p6-(B" . "$,4!7(B") |
41469 | 310 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
311 ("$,15h(B" . "$,4!8")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
312 ("$,15h6-(B" . "$,4!8(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
313 ("$,15h6-5p(B" . "$,4!9")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
314 ("$,15h6-5p6-(B" . "$,4!9")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
315 ("$,15h6-5h(B" . "$,4!:")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
316 ("$,15h6-5h6-(B" . "$,4!:(B") |
41469 | 317 |
41599 | 318 ("$,15i(B" . "$,4!8"#")(B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
319 ;; LABIALS |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
320 ("$,15j(B" . "$,4!;")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
321 ("$,15j6-(B" . "$,4!;(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
322 ("$,15j6-5p(B" . "$,4!<")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
323 ("$,15j6-5p6-(B" . "$,4!<(B") |
41469 | 324 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
325 ("$,15k(B" . "$,4!a"[(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
326 ("$,15k6-(B" . "$,4!=(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
327 ("$,15k6-5p(B" . "$,4!c"[(B") |
41469 | 328 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
329 ("$,15l(B" . "$,4!d")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
330 ("$,15l6-(B" . "$,4!d(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
331 ("$,15l6-5p(B" . "$,4!e")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
332 ("$,15l6-5p6-(B" . "$,4!e(B") |
41469 | 333 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
334 ("$,15m(B" . "$,4!f")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
335 ("$,15m6-(B" . "$,4!f(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
336 ("$,15m6-5p(B" . "$,4!g")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
337 ("$,15m6-5p6-(B" . "$,4!g(B") |
41469 | 338 |
41599 | 339 ("$,15n(B" . "$,4!h")(B") |
41523 | 340 ("$,15n6-(B" . "$,4!h(B") |
41599 | 341 ("$,15n6-5p(B" . "$,4!i")(B") |
41523 | 342 ("$,15n6-5p6-(B" . "$,4!i(B") |
343 ;; SEMIVOWELS | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
344 ("$,15o(B" . "$,4!j")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
345 ("$,15o6-(B" . "$,4!j(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
346 ("$,15o6-5p(B" . "$,4!k")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
347 ("$,15o6-5p6-(B" . "$,4!k(B") |
41523 | 348 ("$,16-5o(B" . "$,4!l(B") ;; when every ohter lig. fails. |
41469 | 349 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
350 ("$,15p(B" . "$,4!n"W(B") |
41523 | 351 ;; ("$,15p6-(B" . "\$,4"'(B") ;; special case. only the topmost pos. |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
352 ("$,15q(B" . "$,4!n"#"W(B") |
41523 | 353 ("$,15q6-(B" . "$,4!m(B") ;; IS 13194 speical rule. |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
354 ("$,15p6!(B" . "$,4!o"[(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
355 ("$,15p6"(B" . "$,4!p"\(B") |
17052 | 356 |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
357 ("$,15r(B" . "$,4!q")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
358 ("$,15r6-(B" . "$,4!q(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
359 ("$,15s(B" . "$,4!s(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
360 ("$,15s6-(B" . "$,4!r(B") |
41599 | 361 ("$,15t(B" . "$,4!s"#(B") |
362 ("$,15t6-(B" . "$,4!r"#(B") | |
41469 | 363 |
41599 | 364 ("$,15u(B" . "$,4!t")(B") |
41523 | 365 ("$,15u6-(B" . "$,4!t(B") |
41599 | 366 ("$,15u6-5p(B" . "$,4!u")(B") |
41523 | 367 ("$,15u6-5p6-(B" . "$,4!u(B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
368 ;; SIBILANTS |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
369 ("$,15v(B" . "$,4!v")(B") |
41523 | 370 ("$,15v6-(B" . "$,4!v(B") |
41599 | 371 ("$,15v6-5u(B" . "$,4!w")(B") |
41523 | 372 ("$,15v6-5u6-(B" . "$,4!w(B") |
41599 | 373 ("$,15v6-5p(B" . "$,4!x")(B") |
41523 | 374 ("$,15v6-5p6-(B" . "$,4!x(B") |
41469 | 375 |
41599 | 376 ("$,15w(B" . "$,4!y")(B") |
41523 | 377 ("$,15w6-(B" . "$,4!y(B") |
41599 | 378 ("$,15x(B" . "$,4!z")(B") |
41523 | 379 ("$,15x6-(B" . "$,4!z(B") |
41599 | 380 ("$,15x6-5p(B" . "$,4!{")(B") |
41523 | 381 ("$,15x6-5p6-(B" . "$,4!{(B") |
17300
01d528c5dd18
Handle more Devanagari characters correctly.
Kenichi Handa <handa@m17n.org>
parents:
17087
diff
changeset
|
382 |
41523 | 383 ("$,15y(B" . "$,4!}(B") |
384 ("$,15y6-(B" . "$,4!|(B") | |
385 ("$,15y6#(B" . "$,4!~(B") | |
386 ("$,15y6-5p(B" . "$,4!(B") | |
41599 | 387 ("$,15y6-5n(B" . "$,4" (B") |
388 ("$,15y6-5o(B" . "$,4"!(B") | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
389 ;; NUKTAS |
41599 | 390 ("$,168(B" . "$,4 f"R"S(B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
391 ("$,1686-(B" . "$,4 d(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
392 ("$,169(B" . "$,4 k")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
393 ("$,1696-(B" . "$,4 k(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
394 ("$,16:(B" . "$,4 n")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
395 ("$,16:6-(B" . "$,4 n(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
396 ("$,16;(B" . "$,4 w")(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
397 ("$,16;6-(B" . "$,4 w(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
398 ("$,16<(B" . "$,4!#"W(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
399 ("$,16=(B" . "$,4!'"X(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
400 ("$,16>(B" . "$,4!b"[(B") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
401 ("$,16>6-(B" . "$,4!>(B") |
41599 | 402 ("$,16?(B" . "$,4!j"#")(B") |
41523 | 403 ;; misc modifiers. |
41599 | 404 ("$,15A(B" . "\$,4"$(B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
405 ("$,15B(B" . "\$,4"&(B") |
41523 | 406 ("$,15C(B" . "$,4 F(B") |
41599 | 407 ("$,15|(B" . "$,4"#(B") |
41523 | 408 ("$,15}(B" . "$,4 E(B") |
41599 | 409 ("$,16-(B" . "$,4""(B") |
410 ("$,16-5p(B" . "$,4"%(B") ;; following "r" | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
411 ;; ("$,160(B" . "$,4 D(B") |
41523 | 412 ;; ("$,16D(B" . "$,4 J(B") |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
413 ;; ("$,16F(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
414 ;; ("$,16G(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
415 ;; ("$,16H(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
416 ;; ("$,16I(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
417 ;; ("$,16J(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
418 ;; ("$,16K(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
419 ;; ("$,16L(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
420 ;; ("$,16M(B" . "") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
421 ;; ("$,16N(B" . "") |
41523 | 422 ;; ("$,16O(B" . "") |
423 ) | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
424 "Devanagari characters to glyphs conversion table. |
41523 | 425 Default value contains only the basic rules. You may add your own |
426 preferred rule from the sanskrit fonts." ) | |
41469 | 427 |
428 (defvar dev-char-glyph-hash | |
429 (let* ((hash (makehash 'equal))) | |
430 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) | |
431 dev-char-glyph) | |
432 hash)) | |
433 | |
434 (defvar dev-char-glyph-regexp | |
42061
0332665b9445
(devanagari-range): Renamed from `range'. All calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
42054
diff
changeset
|
435 (devanagari-regexp-of-hashtbl-keys dev-char-glyph-hash)) |
41469 | 436 |
437 ;; glyph-to-glyph conversion table. | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
438 ;; it is supposed that glyphs are ordered in |
41469 | 439 ;; [consonant/nukta] - [matra/halant] - [preceding-r] - [anuswar]. |
440 | |
41523 | 441 (defvar dev-glyph-glyph |
41599 | 442 '(("\$,4"'(B\$,4"&(B" . "\$,4"((B") |
443 ("\$,4"'(B\$,4"$(B" . "\$,4"((B") | |
444 ("$,4"*(B\$,4"&(B" . "$,4"+(B") | |
445 ("$,4"*(B\$,4"'(B" . "$,4",(B") | |
446 ("$,4"*(B\$,4"'(B\$,4"&(B" . "$,4"-(B") | |
447 ("$,4"2(B\$,4"&(B" . "$,4"3(B") | |
448 ("$,4"2(B\$,4"'(B" . "$,4"4(B") | |
449 ("$,4"2(B\$,4"'(B\$,4"&(B" . "$,4"5(B") | |
450 ("$,4"#(B\$,4"6(B" . "$,4"7(B") | |
451 ("$,4"%(B\$,4"6(B" . "$,4"8(B") | |
452 ;;("$,4"6(B" . "$,4"9(B") | |
453 ("$,4"#(B\$,4":(B" . "$,4";(B") | |
454 ("$,4"%(B\$,4":(B" . "$,4"<(B") | |
455 ;;("$,4":(B" . "$,4"=(B") | |
456 ("\$,4"@(B\$,4"&(B" . "\$,4"A(B") | |
457 ("\$,4"@(B\$,4"'(B" . "\$,4"B(B") | |
458 ("\$,4"@(B\$,4"'(B\$,4"&(B" . "\$,4"C(B") | |
459 ("\$,4"D(B\$,4"&(B" . "\$,4"E(B") | |
460 ("\$,4"D(B\$,4"'(B" . "\$,4"F(B") | |
461 ("\$,4"D(B\$,4"'(B\$,4"&(B" . "\$,4"G(B") | |
462 ("\$,4"H(B\$,4"&(B" . "\$,4"I(B") | |
463 ("\$,4"H(B\$,4"'(B" . "\$,4"J(B") | |
464 ("\$,4"H(B\$,4"'(B\$,4"&(B" . "\$,4"K(B") | |
465 ("\$,4"L(B\$,4"&(B" . "\$,4"M(B") | |
466 ("\$,4"L(B\$,4"'(B" . "\$,4"N(B") | |
467 ("\$,4"L(B\$,4"'(B\$,4"&(B" . "\$,4"O(B") | |
41523 | 468 )) |
41469 | 469 (defvar dev-glyph-glyph-hash |
470 (let* ((hash (makehash 'equal))) | |
471 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) | |
472 dev-glyph-glyph) | |
473 hash)) | |
474 (defvar dev-glyph-glyph-regexp | |
42061
0332665b9445
(devanagari-range): Renamed from `range'. All calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
42054
diff
changeset
|
475 (devanagari-regexp-of-hashtbl-keys dev-glyph-glyph-hash)) |
41469 | 476 |
477 | |
478 ;; yet another glyph-to-glyph conversions. | |
41523 | 479 (defvar dev-glyph-glyph-2 |
41599 | 480 '(("$,4"*(B" . "$,4".(B") |
481 ("$,4"+(B" . "$,4"/(B") | |
482 ("$,4",(B" . "$,4"0(B") | |
483 ("$,4"-(B" . "$,4"1(B"))) | |
41469 | 484 (defvar dev-glyph-glyph-2-hash |
485 (let* ((hash (makehash 'equal))) | |
486 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash))) | |
487 dev-glyph-glyph-2) | |
488 hash)) | |
489 (defvar dev-glyph-glyph-2-regexp | |
42061
0332665b9445
(devanagari-range): Renamed from `range'. All calls changed.
Richard M. Stallman <rms@gnu.org>
parents:
42054
diff
changeset
|
490 (devanagari-regexp-of-hashtbl-keys dev-glyph-glyph-2-hash)) |
41469 | 491 |
492 | |
493 (defun dev-charseq (from &optional to) | |
494 (if (null to) (setq to from)) | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
495 (devanagari-range (make-char 'devanagari-glyph from) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
496 (make-char 'devanagari-glyph to))) |
17300
01d528c5dd18
Handle more Devanagari characters correctly.
Kenichi Handa <handa@m17n.org>
parents:
17087
diff
changeset
|
497 |
41469 | 498 (defvar dev-glyph-cvn |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
499 (append |
41469 | 500 (dev-charseq #x2b) |
501 (dev-charseq #x3c #xc1) | |
502 (dev-charseq #xc3)) | |
503 "Devanagari Consonants/Vowels/Nukta Glyphs") | |
504 | |
505 (defvar dev-glyph-space | |
506 (dev-charseq #xf0 #xfe) | |
507 "Devanagari Spacing Glyphs") | |
508 | |
509 (defvar dev-glyph-right-modifier | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
510 (append |
41469 | 511 (dev-charseq #xc9) |
512 (dev-charseq #xd2 #xd5)) | |
513 "Devanagari Modifiers attached at the right side.") | |
514 | |
515 (defvar dev-glyph-right-modifier-regexp | |
516 (concat "[" dev-glyph-right-modifier "]")) | |
517 | |
518 (defvar dev-glyph-left-matra | |
519 (dev-charseq #xca #xd1) | |
520 "Devanagari Matras attached at the left side.") | |
521 | |
522 (defvar dev-glyph-top-matra | |
523 (dev-charseq #xe0 #xef) | |
524 "Devanagari Matras attached at the top side.") | |
525 | |
526 (defvar dev-glyph-bottom-modifier | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
527 (append |
41469 | 528 (dev-charseq #xd6 #xdf) |
529 (dev-charseq #xc2)) | |
530 "Devanagari Modifiers attached at the bottom.") | |
531 | |
532 (defvar dev-glyph-order | |
533 `((,dev-glyph-cvn . 1) | |
534 (,dev-glyph-space . 2) | |
535 (,dev-glyph-right-modifier . 3) | |
536 (,dev-glyph-left-matra . 3) ;; processed by reference point. | |
537 (,dev-glyph-top-matra . 4) | |
538 (,(dev-charseq #xc7 #xc8) . 5) | |
539 (,(dev-charseq #xc6) . 6) | |
540 (,(dev-charseq #xc5) . 7) | |
541 (,dev-glyph-bottom-modifier . 8))) | |
542 | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
543 (mapc |
41469 | 544 (function (lambda (x) |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
545 (mapc |
41469 | 546 (function (lambda (y) |
547 (put-char-code-property y 'composition-order (cdr x)))) | |
548 (car x)))) | |
549 dev-glyph-order) | |
550 | |
551 (mapc | |
552 (function (lambda (x) | |
553 (put-char-code-property x 'reference-point '(3 . 5)))) | |
554 dev-glyph-left-matra) | |
555 | |
556 (defun devanagari-compose-syllable-string (string) | |
557 (with-temp-buffer | |
558 (insert (decompose-string string)) | |
559 (devanagari-compose-syllable-region (point-min) (point-max)) | |
560 (buffer-string))) | |
17300
01d528c5dd18
Handle more Devanagari characters correctly.
Kenichi Handa <handa@m17n.org>
parents:
17087
diff
changeset
|
561 |
41523 | 562 (defun devanagari-compose-syllable-region (from to) |
563 "Compose devanagari syllable in region FROM to TO." | |
564 (let ((glyph-str nil) (cons-num 0) glyph-str-list | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
565 (last-halant nil) (preceding-r nil) (last-modifier nil) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
566 (last-char (char-before to)) match-str |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
567 glyph-block split-pos) |
41523 | 568 (save-excursion |
569 (save-restriction | |
89096
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
570 ;;; *** char-to-glyph conversion *** |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
571 ;; Special rule 1. -- Last halant must be preserved. |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
572 (if (eq last-char ?$,16-(B) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
573 (progn |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
574 (setq last-halant t) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
575 (narrow-to-region from (1- to))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
576 (narrow-to-region from to) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
577 ;; note if the last char is modifier. |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
578 (if (or (eq last-char ?$,15A(B) (eq last-char ?$,15B(B)) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
579 (setq last-modifier t))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
580 (goto-char (point-min)) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
581 ;; Special rule 2. -- preceding "r halant" must be modifier. |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
582 (when (looking-at "$,15p6-(B.") |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
583 (setq preceding-r t) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
584 (goto-char (+ 2 (point)))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
585 ;; translate the rest characters into glyphs |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
586 (while (re-search-forward dev-char-glyph-regexp nil t) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
587 (setq match-str (match-string 0)) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
588 (setq glyph-str |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
589 (concat glyph-str |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
590 (gethash match-str dev-char-glyph-hash))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
591 ;; count the number of consonant-glyhs. |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
592 (if (string-match devanagari-consonant match-str) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
593 (setq cons-num (1+ cons-num)))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
594 ;; preceding-r must be attached before the anuswar if exists. |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
595 (if preceding-r |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
596 (if last-modifier |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
597 (setq glyph-str (concat (substring glyph-str 0 -1) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
598 "$,4"'(B" (substring glyph-str -1))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
599 (setq glyph-str (concat glyph-str "$,4"'(B")))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
600 (if last-halant (setq glyph-str (concat glyph-str "$,4""(B"))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
601 ;;; *** glyph-to-glyph conversion *** |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
602 (when (string-match dev-glyph-glyph-regexp glyph-str) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
603 (setq glyph-str |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
604 (replace-match (gethash (match-string 0 glyph-str) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
605 dev-glyph-glyph-hash) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
606 nil t glyph-str)) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
607 (if (and (> cons-num 1) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
608 (string-match dev-glyph-glyph-2-regexp glyph-str)) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
609 (setq glyph-str |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
610 (replace-match (gethash (match-string 0 glyph-str) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
611 dev-glyph-glyph-2-hash) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
612 nil t glyph-str)))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
613 ;;; *** glyph reordering *** |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
614 (while (setq split-pos (string-match "$,4""(B\\|.$" glyph-str)) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
615 (setq glyph-block (substring glyph-str 0 (1+ split-pos))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
616 (setq glyph-str (substring glyph-str (1+ split-pos))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
617 (setq |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
618 glyph-block |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
619 (if (string-match dev-glyph-right-modifier-regexp glyph-block) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
620 (sort (string-to-list glyph-block) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
621 (function (lambda (x y) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
622 (< (get-char-code-property x 'composition-order) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
623 (get-char-code-property y 'composition-order))))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
624 (sort (string-to-list glyph-block) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
625 (function (lambda (x y) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
626 (let ((xo (get-char-code-property x 'composition-order)) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
627 (yo (get-char-code-property y 'composition-order))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
628 (if (= xo 2) nil (if (= yo 2) t (< xo yo))))))))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
629 (setq glyph-str-list (nconc glyph-str-list glyph-block))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
630 ;; concatenate and attach reference-points. |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
631 (setq glyph-str |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
632 (cdr |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
633 (apply |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
634 'nconc |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
635 (mapcar |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
636 (function (lambda (x) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
637 (list |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
638 (or (get-char-code-property x 'reference-point) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
639 '(5 . 3) ;; default reference point. |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
640 ) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
641 x))) |
856a479d9c34
(dev-charseq): Avoid indian-glyph-char.
Dave Love <fx@gnu.org>
parents:
88616
diff
changeset
|
642 glyph-str-list)))))) |
41523 | 643 (compose-region from to glyph-str))) |
17300
01d528c5dd18
Handle more Devanagari characters correctly.
Kenichi Handa <handa@m17n.org>
parents:
17087
diff
changeset
|
644 |
18309
bd8b521f5218
Provide XXX-util instead of
Kenichi Handa <handa@m17n.org>
parents:
18203
diff
changeset
|
645 (provide 'devan-util) |
42311 | 646 |
647 ;;; devan-util.el ends here |