Add dev2, bng2, gur2, gjr2, ory2, tml2, tel2, knd2 and mlm2.
[m17n/m17n-db.git] / FLT / KND2-OTF.flt
1 ;; KND2-OTF.flt -- Font Layout Table for knd2 OpenType fonts
2 ;; Copyright (C) 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter knd2-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=knd2)))
8
9 ;;; <li> KND2-OTF.flt
10 ;;;
11 ;;; For knd2 OpenType fonts to draw the Kannada script.
12
13 ;; It seems that tunga.ttf has problems w.r.t. reph and ZWJ.  For
14 ;; example, Uniscribe does not render RA + HAL + ZWJ + KA (0CB0 + 0CCD
15 ;; + 200D + 0C95) as described in the page
16 ;; <http://www.microsoft.com/typography/otfntdev/kanadot/shaping.aspx>.
17 ;; Perhaps the font still uses the old specification that was defined
18 ;; in Unicode 4.0.
19
20 ;; Glyphs are reordered in the following way to layout the Kannada script.
21 ;; 1. base consonant
22 ;; 2. matra set #1 (0CBE, 0CBF, 0CC1, 0CC6, 0CCC)
23 ;; 3. vowel sign UU (0CC2)
24 ;; 4. blwf consonants
25 ;; 5. matra set #2 (0CC3, 0CC4, 0CD5, 0CD6)
26 ;; 6. reph
27 ;; 7. anusvara (0C82) and visarga (0C83)
28
29 ;; 0CE2 and 0CE3, which should be included in "matra set #1" above,
30 ;; are not yet implemented.
31
32 (category
33  ;; b: before subscript matras
34  ;; a: after subscript matras
35  (0x0C80 0x0CFF ?X)                     ; generic
36  (0x0C82 0x0C83 ?A)                     ; SIGN ANUSVARA .. VISARGA
37  (0x0C85 0x0C94 ?V)                     ; LETTER A .. LETTER AU
38  (0x0C95 0x0CB9 ?C)                     ; LETTER KA .. LETTER HA
39  (0x0CB0        ?R)                     ; LETTER RA
40  (0x0CBC        ?n)                     ; SIGN NUKTA
41  (0x0CBE 0x0CBF ?b)                     ; VOWEL SIGN AA .. I
42  (0x0CC1 0x0CC2 ?b)                     ; VOWEL SIGN U .. UU
43  (0x0CC3 0x0CC4 ?a)                     ; VOWEL SIGN VOCALIC R .. VOCALIC RR
44  (0x0CC6        ?b)                     ; VOWEL SIGN E
45  (0x0CCC        ?b)                     ; VOWEL SIGN AU
46  (0x0CCD        ?H)                     ; SIGN VIRAMA
47  (0x0CD5 0x0CD6 ?a)                     ; LENGTH MARK .. AI LENGTH MARK
48  (0x0CDE        ?C)                     ; LETTER FA (LLLA)
49  (0x0CE0 0x0CE1 ?V)                     ; LETTER VOCALIC RR .. VOCALIC LL
50  (0x0CE2 0x0CE3 ?b)                     ; VOWEL SIGN VOCALIC L .. VOCALIC LL
51
52  (0x200C        ?N)                     ; ZWNJ
53  (0x200D        ?J)                     ; ZWJ
54  (0x25CC        ?X)                     ; DOTTED CIRCLE
55
56  (blwf          ?B)
57  (rphf          ?r)
58  )
59
60 ;; Stage 0
61 ;; Preprocessing
62 (generator
63  (0
64   (cond
65    ;; Decompose two-part and three-part vowel signs.
66    ((0x0CC0)
67     0x0CBF 0x0CD5)
68    ((0x0CC7)
69     0x0CC6 0x0CD5)
70    ((0x0CC8)
71     0x0CC6 0x0CD6)
72    ((0x0CCA)
73     0x0CC6 0x0CC2)
74    ((0x0CCB)
75     0x0CC6 0x0CC2 0x0CD5)
76
77    ("." =))
78   *))
79
80 ;; Stage 1
81 ;; Syllable identification
82 (generator
83  (0
84   (cond
85    ;; Syllables with an independent vowel
86    ("(RH)?Vn?(J?H[CR])?b?b?a?A?"
87     < | (0 = *) | >)
88
89    ;; Consonant-based syllables
90    ("([CR]n?J?HJ?)*[CR]n?(H[NJ]?|b?b?a?n?)A?"
91     < | (0 = *) | >)
92
93    ;; Combining marks are displayed with a DOTTED CIRCLE.
94    ("n|H|bb?a?|a|A|JH[CR]"
95     < 0x25CC (0 :otf=knd2=blwf+) >)
96
97    ("." =))
98   *))
99
100 ;; Stage 2
101 ;; Basic shaping forms
102 (generator
103  (0
104   (cond
105    ;; Syllables starting with RA + H + ZWJ
106    (" (RHJ[CRnHJ]*)((H[NJ]?|b?b?a?n?)A?) "
107     ;;           |
108     ;; This is an asterisk.  (See DEV2-OTF.flt)
109     | (1 :otf=knd2=locl,nukt,akhn,blwf,cjct+) (2 = *) |)
110
111    ;; Syllables starting with a reph
112    (" (RH)([CRnHJV]+)((H[NJ]?|b?b?n?a?n?)A?) "
113     | (1 :otf=knd2=rphf+) (2 :otf=knd2=locl,nukt,akhn,blwf,cjct+) (3 = *) |)
114    
115    ;; Other syllables
116    (" ([CRnHJV]+)((H[NJ]?|b?b?n?a?n?)A?) "
117     | (1 :otf=knd2=locl,nukt,akhn,blwf,cjct+) (2 = *) |)
118
119    ("." =))
120   *))
121
122 ;; Stage 3
123 ;; Final reordering #1 (Move before-subscript matras)
124 (generator
125  (0
126   (cond
127    (" ([^B ]*[^BJ])J?(B*)(bb?n?)([^ ]*) "
128     | (1 = *) (3 = *) (2 = *) (4 = *) |)
129
130    ("." =))
131   *))
132
133 ;; Stage 4
134 ;; Final reordering #2 (Move reph after the first halant)
135 (generator
136  (0
137   (cond
138    ;; Syllables with a reph and an explicit halant
139    ;; 1  2           3
140    (" (r)([^H ]+HJ?)([^ ]*) "
141     | (2 = *) (1 =) (3 = *) |)
142
143    ;; A reph without explicit halant
144    ;; 1  2       3
145    (" (r)([^A ]+)(A)? "
146     | (2 = *) (1 =) (3 =) |)
147
148    ("." =))
149   *))
150
151 ;; Stage 5
152 ;; Nukta for matra and presentation forms
153 (generator
154  (0
155   (cond
156    (" ([^ ]+) "
157     | (1 :otf=knd2=nukt,pres,abvs,blws,psts,haln,calt+) |)
158
159    ("." =))
160   *))
161
162 ;; Stage 6
163 ;; Remove ZWNJ/ZWJ
164 (generator
165  (0
166   (cond
167    ("[NJ]")
168
169    ("." =))
170   *))
171
172 ;; Stage 7
173 ;; GPOS processing
174 (generator
175  (0
176   (cond
177    (" ([^ ]+) "
178     (1 :otf=knd2=+kern,dist,abvm,blwm))
179
180    ("." =))
181   *))
182
183 ;; Copyright (C) 2010
184 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
185 ;;   Registration Number H15PRO112
186
187 ;; This file is part of the m17n database; a sub-part of the m17n
188 ;; library.
189
190 ;; The m17n library is free software; you can redistribute it and/or
191 ;; modify it under the terms of the GNU Lesser General Public License
192 ;; as published by the Free Software Foundation; either version 2.1 of
193 ;; the License, or (at your option) any later version.
194
195 ;; The m17n library is distributed in the hope that it will be useful,
196 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
197 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
198 ;; Lesser General Public License for more details.
199
200 ;; You should have received a copy of the GNU Lesser General Public
201 ;; License along with the m17n library; if not, write to the Free
202 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
203 ;; Boston, MA 02110-1301, USA.
204
205 ;; Local Variables:
206 ;; mode: emacs-lisp
207 ;; End: