*** empty log message ***
[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 multi-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     < | = * | >)
88
89    ;; Consonant-based syllables
90    ("([CR]n?J?HJ?)*[CR]n?(H[NJ]?|b?b?a?n?)A?"
91     < | = * | >)
92
93    ;; Multi-part vowel signs
94    ((0x0CBF 0x0CD5)
95     (cond
96      ((font-facility 0x25CC) < 0x25CC 0x0CBF 0x0CD5 >)
97      (".+" < 0x0CC0 >)))
98    ((0x0CC6 0x0CD5)
99     (cond
100      ((font-facility 0x25CC) < 0x25CC 0x0CC6 0x0CD5 >)
101      (".+" < 0x0CC7 >)))
102    ((0x0CC6 0x0CD6)
103     (cond
104      ((font-facility 0x25CC) < 0x25CC 0x0CC6 0x0CD6 >)
105      (".+" < 0x0CC8 >)))
106    ((0x0CC6 0x0CC2 0x0CD5)
107     (cond
108      ((font-facility 0x25CC) < 0x25CC 0x0CC6 0x0CC2 0x0CD5 >)
109      (".+" < 0x0CCB >)))
110    ((0x0CC6 0x0CC2)
111     (cond
112      ((font-facility 0x25CC) < 0x25CC 0x0CC6 0x0CC2 >)
113      (".+" < 0x0CCA >)))
114
115    ;; Combining marks are displayed with a DOTTED CIRCLE.
116    ("[nHbaA]"
117     (cond
118      ((font-facility 0x25CC) < 0x25CC = >)
119      ("." [ = ])))
120    ("JH[CR]"
121     (cond
122      ((font-facility 0x25CC) < 0x25CC :otf=knd2=blwf+ >)
123      (".+" [ :otf=knd2=blwf+ ])))
124
125    ("." =))
126   *))
127
128 ;; Stage 2
129 ;; Basic shaping forms
130 (generator
131  (0
132   (cond
133    ;; Syllables starting with RA + H + ZWJ
134    (" (RHJ[CRnHJ]*)((H[NJ]?|b?b?a?n?)A?) "
135     ;;           |
136     ;; This is an asterisk.  (See DEV2-OTF.flt)
137     | (1 :otf=knd2=locl,nukt,akhn,blwf,cjct+) (2 = *) |)
138
139    ;; Syllables starting with a reph
140    (" (RH)([CRnHJV]+)((H[NJ]?|b?b?n?a?n?)A?) "
141     | (1 :otf=knd2=rphf+) (2 :otf=knd2=locl,nukt,akhn,blwf,cjct+) (3 = *) |)
142    
143    ;; Other syllables
144    (" ([CRnHJV]+)((H[NJ]?|b?b?n?a?n?)A?) "
145     | (1 :otf=knd2=locl,nukt,akhn,blwf,cjct+) (2 = *) |)
146
147    ("." =))
148   *))
149
150 ;; Stage 3
151 ;; Final reordering #1 (Move before-subscript matras)
152 (generator
153  (0
154   (cond
155    (" ([^B ]*[^BJ])J?(B*)(bb?n?)([^ ]*) "
156     | (1 = *) (3 = *) (2 = *) (4 = *) |)
157
158    ("." =))
159   *))
160
161 ;; Stage 4
162 ;; Final reordering #2 (Move reph after the first halant)
163 (generator
164  (0
165   (cond
166    ;; Syllables with a reph and an explicit halant
167    ;; 1  2           3
168    (" (r)([^H ]+HJ?)([^ ]*) "
169     | (2 = *) (1 =) (3 = *) |)
170
171    ;; A reph without explicit halant
172    ;; 1  2       3
173    (" (r)([^A ]+)(A)? "
174     | (2 = *) (1 =) (3 =) |)
175
176    ("." =))
177   *))
178
179 ;; Stage 5
180 ;; Nukta for matra and presentation forms
181 (generator
182  (0
183   (cond
184    (" ([^ ]+) "
185     | (1 :otf=knd2=nukt,pres,abvs,blws,psts,haln,calt+) |)
186
187    ("." =))
188   *))
189
190 ;; Stage 6
191 ;; Remove ZWNJ/ZWJ
192 (generator
193  (0
194   (cond
195    ("[NJ]")
196
197    ("." =))
198   *))
199
200 ;; Stage 7
201 ;; GPOS processing
202 (generator
203  (0
204   (cond
205    (" ([^ ]+) "
206     (1 :otf=knd2=+kern,dist,abvm,blwm))
207
208    ("." =))
209   *))
210
211 ;; Copyright (C) 2010
212 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
213 ;;   Registration Number H15PRO112
214
215 ;; This file is part of the m17n database; a sub-part of the m17n
216 ;; library.
217
218 ;; The m17n library is free software; you can redistribute it and/or
219 ;; modify it under the terms of the GNU Lesser General Public License
220 ;; as published by the Free Software Foundation; either version 2.1 of
221 ;; the License, or (at your option) any later version.
222
223 ;; The m17n library is distributed in the hope that it will be useful,
224 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
225 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
226 ;; Lesser General Public License for more details.
227
228 ;; You should have received a copy of the GNU Lesser General Public
229 ;; License along with the m17n library; if not, write to the Free
230 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
231 ;; Boston, MA 02110-1301, USA.
232
233 ;; Local Variables:
234 ;; mode: emacs-lisp
235 ;; End: