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