*** empty log message ***
[m17n/m17n-db.git] / FLT / KNDA-OTF.flt
1 ;; KNDA-OTF.flt -- Font Layout Table for Kannada OpenType fonts
2 ;; Copyright (C) 2004, 2007, 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter knda-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=knda)))
8
9 ;;; <li> KNDA-OTF.flt
10 ;;;
11 ;;; For Kannada OpenType fonts to draw the Kannada script.
12
13 (category
14  ;; b: before subscript matras
15  ;; a: after subscript matras
16  (0x0C80 0x0CFF ?X)                     ; generic
17  (0x0C82 0x0C83 ?A)                     ; SIGN ANUSVARA .. VISARGA
18  (0x0C85 0x0C94 ?V)                     ; LETTER A .. LETTER AU
19  (0x0C95 0x0CB9 ?C)                     ; LETTER KA .. LETTER HA
20  (0x0CB0        ?R)                     ; LETTER RA
21  (0x0CBC        ?n)                     ; SIGN NUKTA
22  (0x0CBE 0x0CBF ?b)                     ; VOWEL SIGN AA .. I
23  (0x0CC1 0x0CC2 ?b)                     ; VOWEL SIGN U .. UU
24  (0x0CC3 0x0CC4 ?a)                     ; VOWEL SIGN VOCALIC R .. VOCALIC RR
25  (0x0CC6        ?b)                     ; VOWEL SIGN E
26  (0x0CCC        ?b)                     ; VOWEL SIGN AU
27  (0x0CCD        ?H)                     ; SIGN VIRAMA
28  (0x0CD5 0x0CD6 ?a)                     ; LENGTH MARK .. AI LENGTH MARK
29  (0x0CDE        ?C)                     ; LETTER FA (LLLA)
30  (0x0CE0 0x0CE1 ?V)                     ; LETTER VOCALIC RR .. VOCALIC LL
31  (0x0CE2 0x0CE3 ?b)                     ; VOWEL SIGN VOCALIC L .. VOCALIC LL
32
33  (0x200C        ?N)                     ; ZWNJ
34  (0x200D        ?J)                     ; ZWJ
35  (0x25CC        ?X)                     ; DOTTED CIRCLE
36
37  (blwf          ?B)
38  (rphf          ?r)
39  )
40
41 ;; Stage 0
42 ;; Preprocessing
43 (generator
44  (0
45   (cond
46    ;; Decompose multi-part vowel signs.
47    ((0x0CC0)
48     0x0CBF 0x0CD5)
49    ((0x0CC7)
50     0x0CC6 0x0CD5)
51    ((0x0CC8)
52     0x0CC6 0x0CD6)
53    ((0x0CCA)
54     0x0CC6 0x0CC2)
55    ((0x0CCB)
56     0x0CC6 0x0CC2 0x0CD5)
57
58    ("." =))
59   *))
60
61 ;; Stage 1
62 ;; Syllable identification
63 (generator
64  (0
65   (cond
66    ;; Syllables with an independent vowel
67    ("(RH)?(Vn?)((J?H[CR])?b?b?a?A?)"
68     < | (1 = =) (2 :otf=knda=nukt+) (3 = *) | >)
69
70    ;; Consonant-based syllables
71    ;;1      23                 4
72    ("([CR]n?((J?H|HJ?)[CR]n?)*)(H[NJ]?|b?b?a?n?A?)"
73     < |
74     (cond
75      (".+HJ$" :otf=knda=nukt,akhn+)
76      ("(.+)(H)N?$" (1 :otf=knda=nukt,akhn+) (2 =) 0x200C)
77      (".+" :otf=knda=nukt,akhn+))
78     | >)
79
80    ;; Multi-part vowel signs
81    ((0x0CBF 0x0CD5)
82     (cond
83      ((font-facility 0x25CC) < 0x25CC = = >)
84      (".+" [ 0x0CC0 ])))
85    ((0x0CC6 0x0CD5)
86     (cond
87      ((font-facility 0x25CC) < 0x25CC = = >)
88      (".+" [ 0x0CC7 ])))
89    ((0x0CC6 0x0CD6)
90     (cond
91      ((font-facility 0x25CC) < 0x25CC = = >)
92      (".+" [ 0x0CC8 ])))
93    ((0x0CC6 0x0CC2 0x0CD5)
94     (cond
95      ((font-facility 0x25CC) < 0x25CC = = = >)
96      (".+" [ 0x0CCB ])))
97    ((0x0CC6 0x0CC2)
98     (cond
99      ((font-facility 0x25CC) < 0x25CC = = >)
100      (".+" [ 0x0CCA ])))
101
102    ;; Combining marks are displayed with a DOTTED CIRCLE.
103    ("[nHbaA]"
104     (cond
105      ((font-facility 0x25CC) < 0x25CC = >)
106      ("." [ = ])))
107
108    ;; Isolated blwf is displayed with a DOTTED CIRCLE in the
109    ;; next stage.
110    ("(J)(H)([CR])"
111     < | (1 =) (3 =) (2 =) | >)
112
113    ("." =))
114   *))
115
116 ;; Stage 2
117 ;; Reorder halant for blwf
118 (generator
119  (0
120   (cond
121    ;; Isolated blwf
122    (" J([CR]H) "
123     (cond
124      ((font-facility 0x25CC) < 0x25CC (1 :otf=knda=blwf+) >)
125      (" J([CR]H) " [ (1 :otf=knda=blwf+) ])))
126
127    ;; Syllables with an overt halant
128    (" (RHJ?)?([^ ]+)(HN) "
129     | (1 = *) (2 reorder *) (3 = =) |)
130
131    ;; Ordinary syllables
132    (" (RHJ?)?([^baA ]+)(b?b?n?a?n?A?) "
133     | (1 = *) (2 reorder *) (3 = *) |)
134
135    ("." =))
136   *)
137
138  (reorder
139   (cond
140    ("J?(H)([CR])" (2 =) (1 =))
141    ("." =)))
142  )
143
144 ;; Stage 3
145 ;; Language forms
146 ;; Although all consonants have a blow form and none has a half form,
147 ;; we have to prevent the first consonant from forming the below form.
148 (generator
149  (0
150   (cond
151    ;; Overt halant forms
152    (" (RHJ?)?([^ ]+)(HN) "
153     |
154     (1 (cond ("RHJ" = =)
155              ("RH" :otf=knda=rphf+)))
156     (2 (cond ("(.H)J?(.*)" (1 :otf=knda=half+) (2 lang-forms *))
157              (".+" lang-forms *)))
158     (3 = =) |)
159
160    ;; Other syllables
161    (" (RHJ?)?([^baA ]*)(b?b?n?a?n?A?) "
162     |
163     (1 (cond ("RHJ" = =)
164              ("RH" :otf=knda=rphf+)))
165     (2 (cond ("(.H)J?(.*)" (1 :otf=knda=half+) (2 lang-forms *))
166              (".+" lang-forms *)))
167     (3 = *) |)
168
169    ("." =))
170   *)
171
172  (lang-forms
173   (cond
174    ("(.H)J" (1 :otf=knda=half+))
175    (".H" :otf=knda=blwf,half+)
176    ("." =)))
177  )
178
179 ;; Stage 4
180 ;; Final reordering #1 (Move before-subscript matras)
181 (generator
182  (0
183   (cond
184    (" ([^B ]*[^BJ])J?(B*)(bb?n?)([^ ]*) "
185     | (1 = *) (3 = *) (2 = *) (4 = *) |)
186
187    ("." =))
188   *))
189
190 ;; Stage 5
191 ;; Final reordering #2 (Move reph after the first halant)
192 (generator
193  (0
194   (cond
195    ;; Syllables with a reph and an explicit halant
196    ;; 1  2           3
197    (" (r)([^H ]+HJ?)([^ ]*) "
198     | (2 = *) (1 =) (3 = *) |)
199
200    ;; A reph without explicit halant
201    ;; 1  2       3
202    (" (r)([^A ]+)(A)? "
203     | (2 = *) (1 =) (3 =) |)
204
205    ("." =))
206   *))
207
208 ;; Stage 6
209 ;; Nukta for matra and presentation forms
210 (generator
211  (0
212   (cond
213    (" ([^ ]+) "
214     | (1 :otf=knda=nukt,pres,abvs,blws,psts,haln+) |)
215
216    ("." =))
217   *))
218
219 ;; Stage 7
220 ;; Remove ZWNJ/ZWJ
221 (generator
222  (0
223   (cond
224    ("[NJ]")
225
226    ("." =))
227   *))
228
229 ;; Stage 8
230 ;; GPOS processing
231 (generator
232  (0
233   (cond
234    (" ([^ ]+) "
235     (1 :otf=knda=+abvm,blwm,dist))
236
237    ("." =))
238   *))
239
240 ;; Copyright (C) 2004, 2007, 2010
241 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
242 ;;   Registration Number H15PRO112
243
244 ;; This file is part of the m17n database; a sub-part of the m17n
245 ;; library.
246
247 ;; The m17n library is free software; you can redistribute it and/or
248 ;; modify it under the terms of the GNU Lesser General Public License
249 ;; as published by the Free Software Foundation; either version 2.1 of
250 ;; the License, or (at your option) any later version.
251
252 ;; The m17n library is distributed in the hope that it will be useful,
253 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
254 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
255 ;; Lesser General Public License for more details.
256
257 ;; You should have received a copy of the GNU Lesser General Public
258 ;; License along with the m17n library; if not, write to the Free
259 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
260 ;; Boston, MA 02110-1301, USA.
261
262 ;; Local Variables:
263 ;; mode: emacs-lisp
264 ;; End: