annotate lisp/language/tml-util.el @ 89869:0282c54de0d2

Sync with HEAD (1.103).
author Kenichi Handa <handa@m17n.org>
date Thu, 11 Mar 2004 23:42:18 +0000
parents 2f877ed80fa6
children 68c22ea6027c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49702
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
1 ;;; tml-util.el --- support for composing tamil characters -*-coding: iso-2022-7bit;-*-
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
2
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
3 ;; Copyright (C) 2001 Free Software Foundation, Inc.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
4
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
5 ;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org>
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
6 ;; Keywords: multilingual, Indian, Tamil
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
7
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
9
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
13 ;; any later version.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
14
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
19
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 ;; Created: Nov. 08. 2002
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27 ;;; Commentary:
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29 ;; This file provides character(Unicode) to glyph(CDAC) conversion and
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 ;; composition of Tamil script characters.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32 ;;; Code:
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 ;; Tamil Composable Pattern
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 ;; C .. Consonants
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
36 ;; V .. Vowel
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37 ;; H .. Pulli
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38 ;; M .. Matra
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39 ;; V .. Vowel
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 ;; A .. Anuswar
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41 ;; D .. Chandrabindu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
42 ;; 1. vowel
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
43 ;; V
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
44 ;; 2. syllable : only ligature-formed pattern forms composition.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
45 ;; (CkHCs|C)(H|M)?
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
46 ;; 3. sri special
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
47 ;; (CsHCrVi)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
49 ;; oririnal
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
50 ;; ((CH)?(CH)?(CH)?CH)?C(H|M?(A|D)?)?
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
51
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
52 (defconst tamil-consonant
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
53 "[$,1<5(B-$,1<Y(B]")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
54
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
55 (defconst tamil-composable-pattern
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
56 (concat
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
57 "\\([$,1<%(B-$,1<4(B]\\)\\|"
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
58 "[$,1<"<#(B]\\|" ;; vowel modifier considered independent
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
59 "\\(\\(?:\\(?:$,1<5<m<W(B\\)\\|[$,1<5(B-$,1<Y(B]\\)[$,1<m<^(B-$,1<l(B]?\\)\\|"
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 "\\($,1<W<m<P<`(B\\)")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61 "Regexp matching a composable sequence of Tamil characters.")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
63 ;;;###autoload
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
64 (defun tamil-compose-region (from to)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
65 (interactive "r")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66 (save-excursion
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67 (save-restriction
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
68 (narrow-to-region from to)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69 (goto-char (point-min))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 (while (re-search-forward tamil-composable-pattern nil t)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71 (tamil-compose-syllable-region (match-beginning 0)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 (match-end 0))))))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73 (defun tamil-compose-string (string)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
74 (with-temp-buffer
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
75 (insert (decompose-string string))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
76 (tamil-compose-region (point-min) (point-max))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
77 (buffer-string)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
78
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
79 (defun tamil-post-read-conversion (len)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
80 (save-excursion
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
81 (save-restriction
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
82 (let ((buffer-modified-p (buffer-modified-p)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
83 (narrow-to-region (point) (+ (point) len))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
84 (tamil-compose-region (point-min) (point-max))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
85 (set-buffer-modified-p buffer-modified-p)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
86 (- (point-max) (point-min))))))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
88 (defun tamil-range (from to)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
89 "Make the list of the integers of range FROM to TO."
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
90 (let (result)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
91 (while (<= from to) (setq result (cons to result) to (1- to))) result))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
92
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
93 (defun tamil-regexp-of-hashtbl-keys (hashtbl)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94 "Return a regular expression that matches all keys in hashtable HASHTBL."
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
95 (let ((max-specpdl-size 1000))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
96 (regexp-opt
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
97 (sort
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
98 (let (dummy)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
99 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
100 dummy)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
101 (function (lambda (x y) (> (length x) (length y))))))))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
102
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
103
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
104 ;; Notes on conversion steps.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
105
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
106 ;; 1. chars to glyphs
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
107 ;; Simple replacement of characters to glyphs is done.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
108
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
109 ;; 2. glyphs reordering.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
110 ;; following "$,4)j(B", "$,4)k(B", "$,4)l(B" goes to the front.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
111
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
112 ;; 3. glyphs to glyphs
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
113 ;; reordered vowels are ligatured to consonants.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
114
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
115 ;; 4. Composition.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
116 ;; left modifiers will be attached at the left.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
117 ;; others will be attached right.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
118
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
119 (defvar tml-char-glyph
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
120 '(;; various signs
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
121 ("$,1<"(B" . "$,4)b(B") ;; not good
49702
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
122 ("$,1<#(B" . "$,4*G(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
123 ;; Independent Vowels
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
124 ("$,1<%(B" . "$,4*<(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
125 ("$,1<&(B" . "$,4*=(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
126 ("$,1<'(B" . "$,4*>(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
127 ("$,1<((B" . "$,4*?(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
128 ("$,1<)(B" . "$,4*@(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
129 ("$,1<*(B" . "$,4*A(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
130 ("$,1<.(B" . "$,4*B(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
131 ("$,1</(B" . "$,4*C(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
132 ("$,1<0(B" . "$,4*D(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
133 ("$,1<2(B" . "$,4*E(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
134 ("$,1<3(B" . "$,4*F(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
135 ("$,1<4(B" . "$,4*E*W(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
136 ;; Consonants
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
137 ("$,1<5<m<W<m(B" . "$,4):(B") ; ks.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
138 ("$,1<5<m<W(B" . "$,4*^(B") ; ks
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
139 ("$,1<5(B" . "$,4*H(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
140
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
141 ("$,1<9(B" . "$,4*I(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
142 ("$,1<:(B" . "$,4*J(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
143 ("$,1<<(B" . "$,4*\(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
144 ("$,1<<<m(B" . "$,4)8(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
145 ("$,1<>(B" . "$,4*K(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146 ("$,1<?(B" . "$,4*L(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
147 ("$,1<C(B" . "$,4*M(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
148 ("$,1<D(B" . "$,4*N(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 ("$,1<H(B" . "$,4*O(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
150 ("$,1<I(B" . "$,4*Y(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
151 ("$,1<I<m(B" . "$,4)a(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
152 ("$,1<J(B" . "$,4*P(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
153 ("$,1<N(B" . "$,4*Q(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
154 ("$,1<O(B" . "$,4*R(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
155 ("$,1<P(B" . "$,4*S(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
156 ("$,1<Q(B" . "$,4*X(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
157 ("$,1<R(B" . "$,4*T(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
158 ("$,1<S(B" . "$,4*W(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
159 ("$,1<T(B" . "$,4*V(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
160 ("$,1<U(B" . "$,4*U(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
161 ("$,1<W(B" . "$,4*[(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
162 ("$,1<W<m(B" . "$,4)7(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
163 ("$,1<W<m<P<`(B" . "$,4*_(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
164 ("$,1<X(B" . "$,4*Z(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
165 ("$,1<X<m(B" . "$,4)6(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
166 ("$,1<Y(B" . "$,4*](B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
167 ("$,1<Y<m(B" . "$,4)9(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
168
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
169 ;; Dependent vowel signs
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
170 ("$,1<^(B" . "$,4)c(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
171 ("$,1<_(B" . "$,4)d(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
172 ("$,1<`(B" . "$,4)f(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
173 ("$,1<a(B" . "$,4)g(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
174 ("$,1<b(B" . "$,4)h(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
175 ("$,1<f(B" . "$,4)j(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
176 ("$,1<g(B" . "$,4)k(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
177 ("$,1<h(B" . "$,4)l(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
178 ("$,1<j(B" . "$,4)j)c(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
179 ("$,1<k(B" . "$,4)k)c(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
180 ("$,1<l(B" . "$,4)j*W(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
181
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
182 ;; Various signs
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
183 ("$,1<m(B" . "$,4)b(B")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
184 ("$,1<w(B" . "nil") ;; not supported?
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
185 ))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
186
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
187 (defvar tml-char-glyph-hash
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
188 (let* ((hash (make-hash-table :test 'equal)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
190 tml-char-glyph)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
191 hash))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
192
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
193 (defvar tml-char-glyph-regexp
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
194 (tamil-regexp-of-hashtbl-keys tml-char-glyph-hash))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
195
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
196 ;; Tamil languages needed to be reordered.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
197
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
198 (defvar tml-consonants-regexp
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
199 "[$,4*H*^*I*J*\*K*L*M*N*O*Y*P*Q*R*S*X*T*W*V*U*[*Z*](B]")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
200
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
201 (defvar tml-glyph-reorder-key-glyphs "[$,4)j)k)l(B]")
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
202
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
203 (defvar tml-glyph-reordering-regexp-list
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
204 (cons
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
205 (concat "\\(" tml-consonants-regexp "\\)\\([$,4)j)k)l(B]\\)") "\\2\\1"))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
206
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
207 ;; Tamil vowel modifiers to be ligatured.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
208 (defvar tml-glyph-glyph
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
209 '(
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
210 ("$,4*H)d(B" . "$,4(a(B") ; ki
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
211 ("$,4*^)d(B" . "$,4(v(B") ; ksi
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
212 ("$,4*^)f(B" . "$,4)2(B") ; ksi~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
213 ("$,4*I)d(B" . "$,4(b(B") ; n^i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
214 ("$,4*J)d(B" . "$,4(c(B") ; ci
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
215 ("$,4*K)d(B" . "$,4(d(B") ; n~i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
216 ("$,4*L)d(B" . "$,4)n(B") ; t.i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
217 ("$,4*M)d(B" . "$,4(e(B") ; n.i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
218 ("$,4*N)d(B" . "$,4(f(B") ; ti
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
219 ("$,4*O)d(B" . "$,4(g(B") ; ni
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 ("$,4*P)d(B" . "$,4(h(B") ; pi
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
221 ("$,4*Q)d(B" . "$,4(i(B") ; mi
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
222 ("$,4*R)d(B" . "$,4(j(B") ; yi
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
223 ("$,4*S)d(B" . "$,4(k(B") ; ri
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
224 ("$,4*T)d(B" . "$,4(l(B") ; li
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
225 ("$,4*U)d(B" . "$,4(m(B") ; vi
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
226 ("$,4*V)d(B" . "$,4(n(B") ; l_i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
227 ("$,4*W)d(B" . "$,4(o(B") ; l.i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
228 ("$,4*X)d(B" . "$,4(p(B") ; r_i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
229 ("$,4*Y)d(B" . "$,4(q(B") ; n_i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
230 ("$,4*Z)d(B" . "$,4(r(B") ; si
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
231 ("$,4*[)d(B" . "$,4(s(B") ; s'i
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
232 ("$,4*\)d(B" . "$,4(t(B") ; ji
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
233 ("$,4*])d(B" . "$,4(u(B") ; hi
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
234
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
235 ("$,4*H)f(B" . "$,4(w(B") ; ki~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
236 ("$,4*I)f(B" . "$,4(x(B") ; n^i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
237 ("$,4*J)f(B" . "$,4(y(B") ; ci~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
238 ("$,4*K)f(B" . "$,4(z(B") ; n~i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
239 ("$,4*L)f(B" . "$,4)o(B") ; t.i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
240 ("$,4*M)f(B" . "$,4)!(B") ; n.i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
241 ("$,4*N)f(B" . "$,4)"(B") ; ti~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
242 ("$,4*O)f(B" . "$,4)#(B") ; ni~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
243 ("$,4*P)f(B" . "$,4)$(B") ; pi~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
244 ("$,4*Q)f(B" . "$,4)%(B") ; mi~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
245 ("$,4*R)f(B" . "$,4)&(B") ; yi~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
246 ("$,4*S)f(B" . "$,4)'(B") ; ri~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
247 ("$,4*T)f(B" . "$,4)((B") ; li~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
248 ("$,4*U)f(B" . "$,4))(B") ; vi~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
249 ("$,4*V)f(B" . "$,4)*(B") ; l_i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
250 ("$,4*W)f(B" . "$,4)+(B") ; l.i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
251 ("$,4*X)f(B" . "$,4),(B") ; r_i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
252 ("$,4*Y)f(B" . "$,4)-(B") ; n_i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
253 ("$,4*Z)f(B" . "$,4).(B") ; si~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
254 ("$,4*[)f(B" . "$,4)/(B") ; s'i~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
255 ("$,4*\)f(B" . "$,4)0(B") ; ji~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
256 ("$,4*])f(B" . "$,4)1(B") ; hi~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
257
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
258 ("$,4*H)g(B" . "$,4)p(B") ; ku
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
259 ("$,4*I)g(B" . "$,4)q(B") ; n^u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
260 ("$,4*J)g(B" . "$,4)r(B") ; cu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
261 ("$,4*K)g(B" . "$,4)s(B") ; n~u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
262 ("$,4*L)g(B" . "$,4)t(B") ; t.u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
263 ("$,4*M)g(B" . "$,4)u(B") ; n.u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
264 ("$,4*N)g(B" . "$,4)v(B") ; tu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
265 ("$,4*O)g(B" . "$,4)x(B") ; nu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
266 ("$,4*P)g(B" . "$,4)y(B") ; pu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
267 ("$,4*Q)g(B" . "$,4)z(B") ; mu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
268 ("$,4*R)g(B" . "$,4){(B") ; yu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
269 ("$,4*S)g(B" . "$,4)|(B") ; ru
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
270 ("$,4*T)g(B" . "$,4)}(B") ; lu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
271 ("$,4*U)g(B" . "$,4)~(B") ; vu
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
272 ("$,4*V)g(B" . "$,4)(B") ; l_u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
273 ("$,4*W)g(B" . "$,4* (B") ; l.u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
274 ("$,4*X)g(B" . "$,4*!(B") ; r_u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
275 ("$,4*Y)g(B" . "$,4*"(B") ; n_u
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
276
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
277 ("$,4*H)h(B" . "$,4*#(B") ; ku~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
278 ("$,4*I)h(B" . "$,4*$(B") ; n^u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
279 ("$,4*J)h(B" . "$,4*%(B") ; cu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
280 ("$,4*K)h(B" . "$,4*&(B") ; n~u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
281 ("$,4*L)h(B" . "$,4*'(B") ; t.u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
282 ("$,4*M)h(B" . "$,4*((B") ; n.u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
283 ("$,4*N)h(B" . "$,4*)(B") ; tu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
284 ("$,4*O)h(B" . "$,4*+(B") ; nu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
285 ("$,4*P)h(B" . "$,4*,(B") ; pu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
286 ("$,4*Q)h(B" . "$,4*-(B") ; mu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
287 ("$,4*R)h(B" . "$,4*.(B") ; yu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
288 ("$,4*S)h(B" . "$,4*/(B") ; ru~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
289 ("$,4*T)h(B" . "$,4*6(B") ; lu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
290 ("$,4*U)h(B" . "$,4*7(B") ; vu~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
291 ("$,4*V)h(B" . "$,4*8(B") ; l_u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
292 ("$,4*W)h(B" . "$,4*9(B") ; l.u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
293 ("$,4*X)h(B" . "$,4*:(B") ; r_u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
294 ("$,4*Y)h(B" . "$,4*;(B") ; n_u~
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
295 ))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
296
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
297 (defvar tml-glyph-glyph-hash
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
298 (let* ((hash (make-hash-table :test 'equal)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
299 (mapc (function (lambda (x) (puthash (car x) (cdr x) hash)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
300 tml-glyph-glyph)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
301 hash))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
302
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
303 (defvar tml-glyph-glyph-regexp
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
304 (tamil-regexp-of-hashtbl-keys tml-glyph-glyph-hash))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
305
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
306 (defun tamil-compose-syllable-string (string)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
307 (with-temp-buffer
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
308 (insert (decompose-string string))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
309 (tamil-compose-syllable-region (point-min) (point-max))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
310 (buffer-string)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
311
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
312 (defun tamil-compose-syllable-region (from to)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
313 "Compose tamil syllable in region FROM to TO."
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
314 (let (glyph-str match-str glyph-reorder-regexps)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
315 (save-excursion
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
316 (save-restriction
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
317 (narrow-to-region from to)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
318 (goto-char (point-min))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
319 ;; char-glyph-conversion
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
320 (while (not (eobp))
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
321 (if (looking-at tml-char-glyph-regexp)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
322 (progn
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
323 (setq match-str (match-string 0)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
324 glyph-str
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
325 (concat glyph-str
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
326 (gethash match-str tml-char-glyph-hash)))
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
327 (goto-char (match-end 0)))
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
328 (setq glyph-str (concat glyph-str (string (following-char))))
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
329 (forward-char 1)))
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
330 (or glyph-str
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
331 (aset glyph-str 0 (following-char)))
49702
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
332 ;; glyph reordering
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 (when (string-match tml-glyph-reorder-key-glyphs glyph-str)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
334 (if (string-match (car tml-glyph-reordering-regexp-list)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
335 glyph-str)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
336 (setq glyph-str
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
337 (replace-match (cdr tml-glyph-reordering-regexp-list)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
338 nil nil glyph-str))))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
339 ;; glyph-glyph-conversion
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
340 (when (string-match tml-glyph-glyph-regexp glyph-str)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
341 (setq match-str (match-string 0 glyph-str))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
342 (setq glyph-str
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
343 (replace-match (gethash match-str tml-glyph-glyph-hash)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
344 nil nil glyph-str)))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
345 ;; concatenate and attach reference-points.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
346 (setq glyph-str
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
347 (cdr
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
348 (apply
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
349 'nconc
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
350 (mapcar
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
351 (function
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
352 (lambda (x) (list '(5 . 3) x))) ;; default ref. point.
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
353 glyph-str))))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
354 (compose-region from to glyph-str)))))
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
355
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
356 ;;;###autoload
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
357 (defun tamil-composition-function (pos &optional string)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
358 "Compose Tamil characters after the position POS.
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
359 If STRING is not nil, it is a string, and POS is an index to the string.
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
360 In this case, compose characters after POS of the string."
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
361 (if string
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
362 ;; Not yet implemented.
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
363 nil
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
364 (goto-char pos)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
365 (if (looking-at tamil-composable-pattern)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
366 (prog1 (match-end 0)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
367 (tamil-compose-syllable-region pos (match-end 0))))))
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
368
49702
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
369 (provide 'tml-util)
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
370
369dbdebd88a New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
371 ;;; tml-util.el ends here