comparison lisp/language/tibet-util.el @ 29596:c3845ffcb423

Convert all tibetan-1-column characters to the corresponding tibetan characters. (tibetan-add-components): Delete code for the special treatment of 'a chung.
author Kenichi Handa <handa@m17n.org>
date Mon, 12 Jun 2000 06:11:56 +0000
parents 1ebd8db9c3dc
children cb30c41d1bb4
comparison
equal deleted inserted replaced
29595:df1f973a0120 29596:c3845ffcb423
137 137
138 (defun tibetan-add-components (components char) 138 (defun tibetan-add-components (components char)
139 (let ((last (last components)) 139 (let ((last (last components))
140 (stack-upper '(tc . bc)) 140 (stack-upper '(tc . bc))
141 (stack-under '(bc . tc)) 141 (stack-under '(bc . tc))
142 rule) 142 rule comp-vowel tmp)
143 ;; Special treatment for 'a chung. 143 ;; Special treatment for 'a chung.
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 ;; * Disabled by Tomabechi 2000/06/09 *
146 (aref (char-category-set (car last)) ?0)) 146 ;; Because in Unicode, $(7"A(B may follow directly a consonant without
147 (setq char ?$(7"R(B)) ;; modified for new font by Tomabechi 1999/12/10 147 ;; any intervening vowel, as in 4$(7"90"914""0"""Q14"A0"A1!;(B=4$(7"90"91(B 4$(7""0""1(B 4$(7"A0"A1(B not 4$(7"90"91(B 4$(7""0""1(B $(7"Q(B 4$(7"A0"A1(B
148 148 ;;(if (and (= char ?$(7"A(B)
149 ;; (aref (char-category-set (car last)) ?0))
150 ;; (setq char ?$(7"R(B)) ;; modified for new font by Tomabechi 1999/12/10
151
152 ;; Composite vowel signs are decomposed before being added
153 ;; Added by Tomabechi 2000/06/08
154 (if (memq char '(?$(7"T(B ?$(7"V(B ?$(7"W(B ?$(7"X(B ?$(7"Y(B ?$(7"Z(B ?$(7"b(B))
155 (setq comp-vowel
156 (cddr (assoc (char-to-string char)
157 tibetan-composite-vowel-alist))
158 char
159 (cadr (assoc (char-to-string char)
160 tibetan-composite-vowel-alist))))
149 (cond 161 (cond
150 ;; Compose upper vowel sign vertically over. 162 ;; Compose upper vowel sign vertically over.
151 ((aref (char-category-set char) ?2) 163 ((aref (char-category-set char) ?2)
152 (setq rule stack-upper)) 164 (setq rule stack-upper))
153 165
154 ;; Compose lower vowel sign vertically under. 166 ;; Compose lower vowel sign vertically under.
155 ((aref (char-category-set char) ?3) 167 ((aref (char-category-set char) ?3)
156 (if (eq char ?$(7"Q(B) ;; `$(7"Q(B' should not visible when composed. 168 (if (eq char ?$(7"Q(B) ;; `$(7"Q(B' should not visible when composed.
157 (setq rule nil) 169 (setq rule nil)
158 (setq rule stack-under))) 170 (setq rule stack-under)))
159
160 ;; Transform ra-mgo (superscribed r) if followed by a subjoined 171 ;; Transform ra-mgo (superscribed r) if followed by a subjoined
161 ;; consonant other than w, ', y, r. 172 ;; consonant other than w, ', y, r.
162 ((and (= (car last) ?$(7"C(B) 173 ((and (= (car last) ?$(7"C(B)
163 (not (memq char '(?$(7#>(B ?$(7"R(B ?$(7#B(B ?$(7#C(B)))) 174 (not (memq char '(?$(7#>(B ?$(7"R(B ?$(7#B(B ?$(7#C(B))))
164 (setcar last ?$(7!"(B) ;; modified for newfont by Tomabechi 1999/12/10 175 (setcar last ?$(7!"(B) ;; modified for newfont by Tomabechi 1999/12/10
165 (setq rule stack-under)) 176 (setq rule stack-under))
166
167 ;; Transform initial base consonant if followed by a subjoined 177 ;; Transform initial base consonant if followed by a subjoined
168 ;; consonant but 'a. 178 ;; consonant but 'a.
169 (t 179 (t
170 (let ((laststr (char-to-string (car last)))) 180 (let ((laststr (char-to-string (car last))))
171 (if (and (/= char ?$(7"R(B) ;; modified for new font by Tomabechi 181 (if (and (/= char ?$(7"R(B) ;; modified for new font by Tomabechi
174 (cdr (assoc (char-to-string (car last)) 184 (cdr (assoc (char-to-string (car last))
175 tibetan-base-to-subjoined-alist))))) 185 tibetan-base-to-subjoined-alist)))))
176 (setq rule stack-under)))) 186 (setq rule stack-under))))
177 187
178 (if rule 188 (if rule
179 (setcdr last (list rule char))))) 189 (setcdr last (list rule char)))
190 ;; Added by Tomabechi 2000/06/08
191 (if comp-vowel
192 (nconc last comp-vowel))
193 ))
180 194
181 ;;;###autoload 195 ;;;###autoload
182 (defun tibetan-compose-string (str) 196 (defun tibetan-compose-string (str)
183 "Compose Tibetan string STR." 197 "Compose Tibetan string STR."
184 (let ((idx 0)) 198 (let ((idx 0))
185 ;; `$(7"A(B' is included in the pattern for subjoined consonants 199 ;; `$(7"A(B' is included in the pattern for subjoined consonants
186 ;; because we treat it specially in tibetan-add-components. 200 ;; because we treat it specially in tibetan-add-components.
201 ;; (This feature is removed by Tomabechi 2000/06/08)
187 (while (setq idx (string-match tibetan-composable-pattern str idx)) 202 (while (setq idx (string-match tibetan-composable-pattern str idx))
188 (let ((from idx) 203 (let ((from idx)
189 (to (match-end 0)) 204 (to (match-end 0))
190 components) 205 components)
191 (if (eq (string-match tibetan-precomposition-rule-regexp str idx) idx) 206 (if (eq (string-match tibetan-precomposition-rule-regexp str idx) idx)
212 (save-restriction 227 (save-restriction
213 (narrow-to-region beg end) 228 (narrow-to-region beg end)
214 (goto-char (point-min)) 229 (goto-char (point-min))
215 ;; `$(7"A(B' is included in the pattern for subjoined consonants 230 ;; `$(7"A(B' is included in the pattern for subjoined consonants
216 ;; because we treat it specially in tibetan-add-components. 231 ;; because we treat it specially in tibetan-add-components.
232 ;; (This feature is removed by Tomabechi 2000/06/08)
217 (while (re-search-forward tibetan-composable-pattern nil t) 233 (while (re-search-forward tibetan-composable-pattern nil t)
218 (let ((from (match-beginning 0)) 234 (let ((from (match-beginning 0))
219 (to (match-end 0)) 235 (to (match-end 0))
220 components) 236 components)
221 (goto-char from) 237 (goto-char from)