aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2000-06-01 10:59:56 +0000
committerKenichi Handa2000-06-01 10:59:56 +0000
commit6b12c74972789d2bcab3f2db34e2ceb33ca24fdc (patch)
tree98c18a8a35116d4fec8c8e3e8378d27ba5fbcbde
parente6f023725d964ffb1e0618ae3a305daa3a921a4c (diff)
downloademacs-6b12c74972789d2bcab3f2db34e2ceb33ca24fdc.tar.gz
emacs-6b12c74972789d2bcab3f2db34e2ceb33ca24fdc.zip
(tibetan-add-components): Fixes for new
encoding of Tibetan characters. (tibetan-decompose-precomposition-alist): New variable. (tibetan-decompose-region): Convert precomposed characters to non-precomposed characters. (tibetan-decompose-string): Likewise. (tibetan-composition-function): Fix args to thibetan-compose-string.
-rw-r--r--lisp/language/tibet-util.el58
1 files changed, 48 insertions, 10 deletions
diff --git a/lisp/language/tibet-util.el b/lisp/language/tibet-util.el
index 009f88a5616..a558a6b426f 100644
--- a/lisp/language/tibet-util.el
+++ b/lisp/language/tibet-util.el
@@ -118,7 +118,7 @@ The returned string has no composition information."
118;;; 118;;;
119;;; Here are examples of the words "bsgrubs" and "h'uM" 119;;; Here are examples of the words "bsgrubs" and "h'uM"
120;;; 120;;;
121;;; 4$(7"70"714%qx!"U0"G###C"U14"70"714"G0"G1(B 4$(7"Hx!#Ax!"Ur'"_0"H"A"U"_1(B 121;;; 4$(7"70"714%qx!"U0"G###C"U14"70"714"G0"G1(B 4$(7"Hx!"Rx!"Ur'"_0"H"A"U"_1(B
122;;; 122;;;
123;;; M 123;;; M
124;;; b s b s h 124;;; b s b s h
@@ -144,7 +144,7 @@ The returned string has no composition information."
144 ;; If 'a follows a consonant, turn it into the subjoined form. 144 ;; If 'a follows a consonant, turn it into the subjoined form.
145 (if (and (= char ?$(7"A(B) 145 (if (and (= char ?$(7"A(B)
146 (aref (char-category-set (car last)) ?0)) 146 (aref (char-category-set (car last)) ?0))
147 (setq char ?$(7#A(B)) 147 (setq char ?$(7"R(B)) ;; modified for new font by Tomabechi 1999/12/10
148 148
149 (cond 149 (cond
150 ;; Compose upper vowel sign vertically over. 150 ;; Compose upper vowel sign vertically over.
@@ -153,27 +153,30 @@ The returned string has no composition information."
153 153
154 ;; Compose lower vowel sign vertically under. 154 ;; Compose lower vowel sign vertically under.
155 ((aref (char-category-set char) ?3) 155 ((aref (char-category-set char) ?3)
156 (setq rule stack-under)) 156 (if (eq char ?$(7"Q(B) ;; `$(7"Q(B' should not visible when composed.
157 (setq rule nil)
158 (setq rule stack-under)))
157 159
158 ;; Transform ra-mgo (superscribed r) if followed by a subjoined 160 ;; Transform ra-mgo (superscribed r) if followed by a subjoined
159 ;; consonant other than w, ', y, r. 161 ;; consonant other than w, ', y, r.
160 ((and (= (car last) ?$(7"C(B) 162 ((and (= (car last) ?$(7"C(B)
161 (not (memq char '(?$(7#>(B ?$(7#A(B ?$(7#B(B ?$(7#C(B)))) 163 (not (memq char '(?$(7#>(B ?$(7"R(B ?$(7#B(B ?$(7#C(B))))
162 (setcar last ?$(7#P(B) 164 (setcar last ?$(7!"(B) ;; modified for newfont by Tomabechi 1999/12/10
163 (setq rule stack-under)) 165 (setq rule stack-under))
164 166
165 ;; Transform initial base consonant if followed by a subjoined 167 ;; Transform initial base consonant if followed by a subjoined
166 ;; consonant but 'a. 168 ;; consonant but 'a.
167 (t 169 (t
168 (let ((laststr (char-to-string (car last)))) 170 (let ((laststr (char-to-string (car last))))
169 (if (and (/= char ?$(7#A(B) 171 (if (and (/= char ?$(7"R(B) ;; modified for new font by Tomabechi
170 (string-match "[$(7"!(B-$(7"="?"@"D(B-$(7"J(B]" laststr)) 172 (string-match "[$(7"!(B-$(7"="?"@"D(B-$(7"J"K(B]" laststr))
171 (setcar last (string-to-char 173 (setcar last (string-to-char
172 (cdr (assoc (char-to-string (car last)) 174 (cdr (assoc (char-to-string (car last))
173 tibetan-base-to-subjoined-alist))))) 175 tibetan-base-to-subjoined-alist)))))
174 (setq rule stack-under)))) 176 (setq rule stack-under))))
175 177
176 (setcdr last (list rule char)))) 178 (if rule
179 (setcdr last (list rule char)))))
177 180
178;;;###autoload 181;;;###autoload
179(defun tibetan-compose-string (str) 182(defun tibetan-compose-string (str)
@@ -231,10 +234,45 @@ The returned string has no composition information."
231 (forward-char 1)) 234 (forward-char 1))
232 (compose-region from to components))))))) 235 (compose-region from to components)))))))
233 236
237(defvar tibetan-decompose-precomposition-alist
238 (mapcar (function (lambda (x) (cons (string-to-char (cdr x)) (car x))))
239 tibetan-precomposition-rule-alist))
240
234;;;###autoload 241;;;###autoload
235(defalias 'tibetan-decompose-region 'decompose-region) 242(defun tibetan-decompose-region (from to)
243 "Decompose Tibetan text in the region FROM and TO.
244This is different from decompose-region because precomposed Tibetan characters
245are decomposed into normal Tiebtan character sequences."
246 (interactive "r")
247 (save-restriction
248 (narrow-to-region from to)
249 (decompose-region from to)
250 (goto-char from)
251 (while (not (eobp))
252 (let* ((char (following-char))
253 (slot (assq char tibetan-decompose-precomposition-alist)))
254 (if slot
255 (progn
256 (delete-char 1)
257 (insert (cdr slot)))
258 (forward-char 1))))))
259
260
236;;;###autoload 261;;;###autoload
237(defalias 'tibetan-decompose-string 'decompose-string) 262(defun tibetan-decompose-string (str)
263 "Decompose Tibetan string STR.
264This is different from decompose-string because precomposed Tibetan characters
265are decomposed into normal Tiebtan character sequences."
266 (let ((new "")
267 (len (length str))
268 (idx 0)
269 char slot)
270 (while (< idx len)
271 (setq char (aref str idx)
272 slot (assq (aref str idx) tibetan-decompose-precomposition-alist)
273 new (concat new (if slot (cdr slot) (char-to-string char)))
274 idx (1+ idx)))
275 new))
238 276
239;;;###autoload 277;;;###autoload
240(defun tibetan-composition-function (from to pattern &optional string) 278(defun tibetan-composition-function (from to pattern &optional string)