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