Add dev2, bng2, gur2, gjr2, ory2, tml2, tel2, knd2 and mlm2.
[m17n/m17n-db.git] / FLT / ORYA-OTF.flt
1 ;; ORYA-OTF.flt -- Font Layout Table for Oriya OpenType font
2 ;; Copyright (C) 2004, 2007, 2008 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter orya-otf nil
6       (font (nil nil unicode-bmp :otf=orya=rphf)))
7
8 ;;; <li> ORYA-OTF.flt
9 ;;;
10 ;;; For Oriya OpenType fonts to draw the Oriya script.
11
12 (category
13  ;; C: consonant (except for R, B and Y)
14  ;; R: consonant RA
15  ;; B: consonant (below)
16  ;; Y: consonant (post)
17  ;; n: NUKTA
18  ;; H: HALANT
19  ;; m: vowel sign (pre)
20  ;; u: vowel sign (above)
21  ;; b: vowel sign (below)
22  ;; p: vowel sign (post)
23  ;; t: vowel sign (two-part)
24  ;; A: vowel modifier (above)
25  ;; a: vowel modifier (post)
26  ;; V: independent vowel
27  ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
28  ;; J: ZWJ (ZERO WIDTH JOINER)
29  ;; X: generic
30  ;; Z: internal use
31  (0x0B00 0x0B7F ?X)                     ; generic
32  (0x0B00        ?Z)                     ; internal use
33  (0x0B01 0x0B03 ?a)                     ; SIGN CANDRABINDU .. VISARGA
34  (0x0B05 0x0B14 ?V)                     ; LETTER A .. VOCALIC AU
35  (0x0B15 0x0B39 ?C)                     ; LETTER KA .. HA
36  (0x0B24        ?B)                     ; LETTER TA
37  (0x0B28        ?B)                     ; LETTER NA
38  (0x0B2C 0x0B2E ?B)                     ; LETTER BA .. MA
39  (0x0B2F        ?Y)                     ; LETTER YA
40  (0x0B30        ?R)                     ; LETTER RA
41  (0x0B32 0x0B33 ?B)                     ; LETTER LA
42  (0x0B33        ?B)                     ; LETTER LLA
43  (0x0B3C        ?n)                     ; SIGN NUKTA
44  (0x0B3E        ?p)                     ; VOWEL SIGN AA
45  (0x0B3F        ?u)                     ; VOWEL SIGN I
46  (0x0B40        ?p)                     ; VOWEL SIGN II
47  (0x0B41 0x0B44 ?b)                     ; VOWEL SIGN U .. VOCALIC RR
48  (0x0B47        ?m)                     ; VOWEL SIGN E
49  (0x0B48 0x0B4C ?t)                     ; VOWEL SIGN AI .. AU
50  (0x0B4D        ?H)                     ; SIGN VIRAMA
51  (0x0B56        ?u)                     ; AI LENGTH MARK
52  (0x0B57        ?p)                     ; AU LENGTH MARK
53  (0x0B5C 0x0B5D ?C)                     ; LETTER RRA .. RHA
54  (0x0B5F        ?Y)                     ; LETTER YYA
55  (0x0B60 0x0B61 ?V)                     ; LETTER VOCALIC RR .. LL
56  (0x0B62 0x0B63 ?b)                     ; VOWEL SIGN VOCALIC L .. LL
57  (0x0B71        ?C)                     ; LETTER WA
58  (0x0B64 0x0B65 ?X)                     ; DANDA .. DOUBLE DANDA
59  (0x200C        ?N)                     ; ZWNJ
60  (0x200D        ?J)                     ; ZWJ
61  )
62
63 (generator
64  (0
65   (cond
66    ;; Decompose two-part vowel signs.
67    ((0x0B48)
68     0x0B47 0x0B56)
69    ((0x0B4B)
70     0x0B47 0x0B3E)
71    ((0x0B4C)
72     0x0B47 0x0B57)
73    ;; Compose consonant and nukta.
74    ((0x0B21 0x0B3C)
75     0x0B5C)
76    ((0x0B22 0x0B3C)
77     0x0B5D)
78    ;; Move ZWJ before the consonant.
79    ("([CRBY]n?)(J)"
80     (2 =) (1 = *))
81    ("." =))
82   *))
83
84 ;; Syllable identification and reordering.
85 ;; Do not apply 'rphf' if a syllable begins with a ZWJ.
86 (generator
87  (0
88   (cond
89    ;; A syllable with a ZWJ and a pre-base vowel sign.
90    ;;1  23                    4  5   6   7
91    ("(J)(([CRBY]n?H)*[CRBY]n?)(m)(u)?(p)?(a)?"
92     < | (1 =) (4 =) (2 pre-below) (5 =) (2 post) (6 =) (7 =) | >)
93
94    ;; A syllable with a ZWJ and a non-pre-base vowel sign.
95    ;;1  23                    45      6   7
96    ("(J)(([CRBY]n?H)*[CRBY]n?)(([bu])|(p))(a)?"
97     < | (1 =) (2 pre-below) (5 =) (2 post) (6 =) (7 =) | >)
98
99    ;; A syllable with a ZWJ and a vowel modifier, but without vowel signs.
100    ;;1  23                    4
101    ("(J)(([CRBY]n?H)*[CRBY]n?)(a)"
102     < | (1 =) (2 pre-below) (2 post) (4 =) | >)
103
104    ;; Add a ZWNJ explicitly when a syllable ends with a halant.
105    ;;1  23                    4
106    ("(J)(([CRBY]n?H)*[CRBY]n?)(HN?)?"
107     < | (1 =) (2 pre-below) (4 = 0x200C) (2 post) | >)
108
109    ;; With a pre-base vowel sign, without a ZWJ.
110    ;;1    23                    4  5   6   7
111    ("(RH)?(([CRBY]n?H)*[CRBY]n?)(m)(u)?(p)?(a)?"
112     < |
113     (4 =) (2 pre-below) (5 =) (1 otf:orya=rphf) (2 post) (6 =) (7 =)
114     | >)
115
116    ;; With a non-pre-base vowel sign, without a ZWJ.
117    ;; 1   23                    45      6   7
118    ("(RH)?(([CRBY]n?H)*[CRBY]n?)(([bu])|(p))(a)?"
119     < | (2 pre-below) (5 =) (1 otf:orya=rphf) (2 post) (6 =) (7 =) | >)
120
121    ;; With a vowel modifier, without vowel signs and a ZWJ.
122    ;;1    23                    4
123    ("(RH)?(([CRBY]n?H)*[CRBY]n?)(a)"
124     < | (2 pre-below) (1 otf:orya=rphf) (2 post) (4 =) | >)
125
126    ;; Add a ZWNJ explicitly when a syllable ends with a halant.
127    ;;1    23                    4
128    ("(RH)?(([CRBY]n?H)*[CRBY]n?)(HN?)?"
129     < | (2 pre-below) (1 otf:orya=rphf) (4 = 0x200C) (2 post) | >)
130
131    ;; A syllable starting with an independent vowel.
132    ("Va?"
133     < | = * | >)
134
135    ("." =))
136   *)
137
138  ;; Move a halant after the base consonant to the end.
139  ;; Fill the resulting gap with a special mark.
140  ;; Remove post-base parts.
141  (pre-below
142   (cond
143    ("([CRBYnH]*[CYn])H([RBH]+)[YH]+$"
144     (1 = *) 0x0B00 (2 = *))
145    ("([CRBYnH]*[CYn])(H)([RBH]+)$"
146     (1 = *) 0x0B00 (3 = *) (2 =))
147    ("([CRBYnH]*[Cn])[YH]*$"
148     (1 = *) 0x0B00)
149    ("([RB]n?)H([RBH]*)[YH]+$"
150     (1 = *) 0x0B00 (2 = *))
151    ("([RB]n?)(H)([RBH]*)$"
152     (1 = *) 0x0B00 (3 = *) (2 =))
153    ("([RBY]n?)[YH]*$"
154     (1 = *) 0x0B00)))
155
156  ;; Extract post-base parts and add a halant at the end.
157  ;; Produce nothing if there are no post-base parts.
158  (post
159   (cond
160    ("[CRBYnH]*[CRBn]H([YH]+)$"
161     (1 = *) 0x0B4D)
162    ("Yn?H([YH]+)$"
163     (1 = *) 0x0B4D)
164    (".+"
165     )))
166  )
167
168 ;; Apply language forms to concerning segments.
169 (generator
170  (0
171   (cond
172    ;; If a syllable contains a ZWNJ, render the final halant explicitly.
173    (" ([^Z]+)(Z)([^N]*)(HN)([^ ]*) "
174     | (1 otf:orya=nukt,akhn,half,pres+) (2 =) (3 otf:orya=blwf+) (4 = =)
175     (5 otf:orya=pstf+) |)
176
177    (" (J?m?)([^Z]+)(Z)([^ ]*) "
178     | (1 = *) (2 otf:orya=nukt,akhn,half,pres+) (3 =) (4 otf:orya=blwf,pstf+) |)
179
180    ("." =))
181   *))
182
183 ;; When the number of glyphs between a pre-base vowel sign and the
184 ;; post-base mark is more than one, move the pre-base vowel sign
185 ;; before the final glyph.
186 (generator
187  (0
188   (cond
189    (" (J)?(m)([^Z]+)([^Z])Z([^N ]*)N?([^ ]*) "
190     | (1 =) (3 = *) (2 =) (4 =) (5 = *) (6 = *)|)
191    (" ([^Z]+)Z([^N ]*)N?([^ ]*) "
192     | (1 = *) (2 = *) (3 = *) |)
193    ("." =))
194   *))
195
196 ;; Apply other features.
197 ;; Do not apply 'vatu' and 'blws' if there is a ZWJ.
198 ;; The 'pres' feature is applied again for pre-base vowel sign.
199 (generator
200  (0
201   (cond
202    (" J([^ ]+) "
203     (1 otf:orya=pres,abvs,pstp,haln+abvm,blwm,dist))
204    (" ([^ ]+) "
205     (1 otf:orya=vatu,pres,abvs,blws,pstp,haln+abvm,blwm,dist))
206    ("."
207     [ = ]))
208   *))
209
210 ;; Copyright (C) 2004, 2007, 2008
211 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
212 ;;   Registration Number H15PRO112
213
214 ;; This file is part of the m17n database; a sub-part of the m17n
215 ;; library.
216
217 ;; The m17n library is free software; you can redistribute it and/or
218 ;; modify it under the terms of the GNU Lesser General Public License
219 ;; as published by the Free Software Foundation; either version 2.1 of
220 ;; the License, or (at your option) any later version.
221
222 ;; The m17n library is distributed in the hope that it will be useful,
223 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
224 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
225 ;; Lesser General Public License for more details.
226
227 ;; You should have received a copy of the GNU Lesser General Public
228 ;; License along with the m17n library; if not, write to the Free
229 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
230 ;; Boston, MA 02110-1301, USA.
231
232 ;; Local Variables:
233 ;; mode: emacs-lisp
234 ;; End: