Add dev2, bng2, gur2, gjr2, ory2, tml2, tel2, knd2 and mlm2.
[m17n/m17n-db.git] / FLT / KNDA-OTF.flt
1 ;; KNDA-OTF.flt -- Font Layout Table for Kannada OpenType fonts
2 ;; Copyright (C) 2004, 2007  AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter knda-otf nil
6       (font (nil nil unicode-bmp :otf=knda=rphf)))
7
8 ;;; <li> KNDA-OTF.flt
9 ;;;
10 ;;; For Kannada OpenType fonts to draw the Kannada script.
11
12 (category
13  ;; C: consonant (except for RA)
14  ;; R: RA
15  ;; n: NUKTA
16  ;; H: HALANT
17  ;; u: vowel sign (above)
18  ;; b: vowel sign (below)
19  ;; p: vowel sign (post)
20  ;; l: length mark
21  ;; a: vowel modifier (post)
22  ;; V: independent vowel
23  ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
24  ;; J: ZWJ (ZERO WIDTH JOINER)
25  ;; X: generic
26  (0x0C80 0x0CFF ?X)                     ; generic
27  (0x0C82 0x0C83 ?a)                     ; SIGN ANUSVARA .. VISARGA
28  (0x0C85 0x0C94 ?V)                     ; LETTER A .. LETTER AU
29  (0x0C95 0x0CB9 ?C)                     ; LETTER KA .. LETTER HA
30  (0x0CB0        ?R)                     ; LETTER RA
31  (0x0CBC        ?n)                     ; SIGN NUKTA
32  (0x0CBE        ?p)                     ; VOWEL SIGN AA
33  (0x0CBF        ?u)                     ; VOWEL SIGN I
34  (0x0CC1 0x0CC4 ?p)                     ; VOWEL SIGN U .. RR
35  (0x0CC6        ?u)                     ; VOWEL SIGN E
36  (0x0CCC        ?u)                     ; VOWEL SIGN AU
37  (0x0CCD        ?H)                     ; SIGN VIRAMA
38  (0x0CD5 0x0CD6 ?l)                     ; LENGTH MARK .. AI LENGTH MARK
39  (0x0CDE        ?C)                     ; LETTER FA (LLLA)
40  (0x0CE0 0x0CE1 ?V)                     ; LETTER VOCALIC RR .. LL
41  (0x0CE2 0x0CE3 ?b)                     ; VOWEL SIGN VOCALIC L .. LL
42  (0x0964 0x0965 ?X)                     ; DANDA .. DOUBLE DANDA
43  (0x200C        ?N)                     ; ZWNJ
44  (0x200D        ?J)                     ; ZWJ
45  )
46
47 ;; Preprocessing.
48 (generator
49  (0
50   (cond
51    ;; Decompose two-part and three-part vowel signs.
52    ((0x0CC0)
53     0x0CBF 0x0CD5)
54    ((0x0CC7)
55     0x0CC6 0x0CD5)
56    ((0x0CC8)
57     0x0CC6 0x0CD6)
58    ((0x0CCA)
59     0x0CC6 0x0CC2)
60    ((0x0CCB)
61     0x0CC6 0x0CC2 0x0CD5)
62    ;; Move ZWJ between RA and HARANT.
63    ("(R)(J)(H)"
64     (2 =) (1 =) (3 =))
65    ("." =))
66   *))
67
68 ;; Syllable identification.
69 ;; Apply 'nukt' and 'akhn' before reordering.
70
71 (generator
72  (0
73   (cond
74    ;; A syllable with an above vowel sign.
75    ;;1   2      3          4
76    ("(J)?([CR]n?(H[CR]n?)*)(up?l?a?)"
77     < | (1 =) (2 otf:knda=nukt,akhn+) (4 = *) | >)
78
79    ;; A syllable with a post- or below vowel sign.
80    ;;1   2      3          4    5
81    ("(J)?([CR]n?(H[CR]n?)*)(p|b)(a)?"
82     < | (1 =) (2 otf:knda=nukt,akhn+) (4 =) (5 =) | >)
83
84    ;; A syllable with a vowel modifier, but without vowel signs.
85    ;;1   2      3          4
86    ("(J)?([CR]n?(H[CR]n?)*)(a)"
87     < | (1 =) (2 otf:knda=nukt,akhn+) (4 =) | >)
88
89    ;; No vowel signs, no vowel modifiers.
90    ;;1   2      3          4
91    ("(J)?([CR]n?(H[CR]n?)*)(HN?)?"
92     < | (1 =) (2 otf:knda=nukt,akhn+) (4 = *) | >)
93
94    ;; A syllable starting with an independent vowel.
95    ("Va?"
96     < | = * | >)
97
98    ("." =))
99   *))
100
101 ;; Reordering.  The base consonant is always the first one, because
102 ;; all Kannada consonants have a below form.
103 (generator
104  (0
105   (cond
106    ;; 1    2     34        5     6   7   8
107    (" (RH)?([^N])((H[^N])*)(u|b)?(p)?(l)?(a)? "
108     | (2 =) (5 =) (6 =) (3 move-h) (7 =) (1 otf:knda=rphf+) (8 =) |)
109
110    ;; A syllable ending with a halant.
111    ;; 1    2   34
112    (" (RH)?(.H)((.H)*)N? "
113     ;; WORKAROUND : Kedage fonts produce halant form with 'psts'.
114     | (2 otf:knda=haln,psts+)(3 = *) (1 otf:knda=rphf+) |)
115
116    ;; No reph movement if preceded by a ZWJ.
117    ;;  1  23        4     5   6
118    (" J(.)((H[^N])*)(u|b)?(p)?(l?a?) "
119     | (1 =) (4 =) (5 =) (2 move-h) (6 = *) |)
120
121    ;;  1   23
122    (" J(.H)((.H)*)N? "
123     | (1 otf:knda=haln,psts+) (2 = *) |)
124
125    ("." =))
126   *)
127
128  (move-h
129   (cond
130    ("(H)(.+)"
131     (2 = *) (1 =)))))
132
133 ;; Apply other OTF features.
134 (generator
135  (0
136   (cond
137    (" ([^ ]+) "
138     (1 otf:knda=blwf,abvs,blws,psts+abvm,blwm,dist))
139
140    ("."
141     [ = ]))
142   *))
143
144 ;; Copyright (C) 2004, 2007
145 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
146 ;;   Registration Number H15PRO112
147
148 ;; This file is part of the m17n database; a sub-part of the m17n
149 ;; library.
150
151 ;; The m17n library is free software; you can redistribute it and/or
152 ;; modify it under the terms of the GNU Lesser General Public License
153 ;; as published by the Free Software Foundation; either version 2.1 of
154 ;; the License, or (at your option) any later version.
155
156 ;; The m17n library is distributed in the hope that it will be useful,
157 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
158 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
159 ;; Lesser General Public License for more details.
160
161 ;; You should have received a copy of the GNU Lesser General Public
162 ;; License along with the m17n library; if not, write to the Free
163 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
164 ;; Boston, MA 02110-1301, USA.
165
166 ;; Local Variables:
167 ;; mode: emacs-lisp
168 ;; End: