Do not require liga as a GSUB feature.
[m17n/m17n-db.git] / FLT / DEV2-OTF.flt
1 ;; DEV2-OTF.flt -- Font Layout Table for dev2 OpenType fonts
2 ;; Copyright (C) 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter dev2-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=dev2)))
8
9 ;;; <li> DEV2-OTF.flt
10 ;;;
11 ;;; For dev2 OpenType fonts to draw the Devanagari script.  
12
13 ;; No matter what the Microsoft Typography web page says, modifier
14 ;; character sequences accepted by Uniscribe are the following.
15
16 ;; 1. matra (pre, below, above, post)
17 ;; 2. one of candrabindu (0901), anusvara (0902), grave (0953), acute (0954)
18 ;; 3. udatta (0951) and/or anudatta (0952)
19 ;; 4. visarga (0903)
20
21 ;; For rendering, on the other hand, the combination of Uniscribe and
22 ;; mangal.ttf (dev2) requires the following orders.
23
24 ;; for above marks:
25 ;; 1. above- or post matra
26 ;; 2. reph
27 ;; 3. one of candrabindu (0901), anusvara (0902), grave (0953), acute (0954)
28 ;; 4. udatta (0951)
29
30 ;; for below marks:
31 ;; 1. below matra
32 ;; 2. anudatta (0952)
33
34 (category
35  ;; X: generic
36  ;; V: independent vowel
37  ;; C: consonant
38  ;; R: RA
39  ;; n: NUKTA
40  ;; H: HALANT
41  ;; m: vowel sign (pre)
42  ;; u: vowel sign (above)
43  ;; b: vowel sign (below)
44  ;; p: vowel sign (post)
45  ;; a: vowel modifier / accent (above)
46  ;; A: vowel modifier (post)
47  ;; s: stress sign (above)
48  ;; S: stress sign (below)
49  ;; N: ZWNJ
50  ;; J: ZWJ
51  (0x0900 0x097F ?X)                     ; generic
52  (0x0900 0x0902 ?a)                     ; SIGN INVERTED CANDRABINDU .. ANUSVARA
53  (0x0903        ?A)                     ; SIGN VISARGA
54  (0x0904 0x0914 ?V)                     ; LETTER SHORT A .. AU
55  (0x0915 0x0939 ?C)                     ; LETTER KA .. HA
56  (0x0930        ?R)                     ; LETTER RA
57  (0x093C        ?n)                     ; SIGN NUKTA
58  (0x093E        ?p)                     ; VOWEL SIGN AA
59  (0x093F        ?m)                     ; VOWEL SIGN I
60  (0x0940        ?p)                     ; VOWEL SIGN II
61  (0x0941 0x0944 ?b)                     ; VOWEL SIGN UU .. VOCALIC RR
62  (0x0945 0x0948 ?u)                     ; VOWEL SIGN CANDRA E .. AI
63  (0x0949 0x094C ?p)                     ; VOWEL SIGN CANDRA O .. AU
64  (0x094D        ?H)                     ; SIGN VIRAMA
65  (0x094E        ?m)                     ; VOWEL SIGN PRISHTHAMATRA E
66  (0x0951        ?s)                     ; STRESS SIGN UDATTA
67  (0x0952        ?S)                     ; STRESS SIGN ANUDATTA
68  (0x0953 0x0954 ?a)                     ; GRAVE ACCENT .. ACUTE ACCENT
69  (0x0955        ?u)                     ; VOWEL SIGN CHANDRA LONG E
70  (0x0958 0x095F ?C)                     ; LETTER QA .. YYA
71  (0x0960 0x0961 ?V)                     ; LETTER VOCALIC RR  .. VOCALIC LL
72  (0x0962 0x0963 ?b)                     ; VOWEL SIGN VOCALIC L .. VOCALIC LL
73  (0x0972        ?V)                     ; LETTER CANDRA A
74  (0x0979 0x097F ?C)                     ; LETTER ZHA .. BBA
75
76  (0x200C        ?N)                     ; ZWNJ
77  (0x200D        ?J)                     ; ZWJ
78  (0x25CC        ?X)                     ; DOTTED CIRCLE
79
80  (rphf          ?r)
81  )
82
83 ;; Stage 0
84 ;; Preprocessing
85 (generator
86  (0
87   (cond
88    ;; Compose a consonant and a nukta
89    ((0x0928 0x093C) 0x0929)
90    ((0x0930 0x093C) 0x0931)
91    ((0x0933 0x093C) 0x0934)
92    ((0x0915 0x093C) 0x0958)
93    ((0x0916 0x093C) 0x0959)
94    ((0x0917 0x093C) 0x095A)
95    ((0x091C 0x093C) 0x095B)
96    ((0x0921 0x093C) 0x095C)
97    ((0x0922 0x093C) 0x095D)
98    ((0x092B 0x093C) 0x095E)
99    ((0x092F 0x093C) 0x095F)
100
101    ("." =))
102   *))
103
104 ;; Stage 1
105 ;; Syllable identification
106 (generator
107  (0
108   (cond
109    ;; Syllables with an independent vowel
110    ("(RH)?Vn?(J?HR)?m?u?b?p?n?a?(Ss?|sS?)?A?"
111     < | = * | >)
112
113    ;; Consonant-based syllables
114    ("([CR]n?J?HJ?)*[CR]n?(H[NJ]?|m?u?b?p?n?)a?(Ss?|sS?)?A?"
115     < | = * | >)
116
117    ;; Combining marks are displayed with a DOTTED CIRCLE.
118    ("m"
119     (cond
120      ((font-facility 0x25CC) < = 0x25CC >)
121      ("." [ = ])))
122    ("[nHubpaSsA]"
123     (cond
124      ((font-facility 0x25CC) < 0x25CC = >)
125      ("." [ = ])))
126    ("JHR"
127     (cond
128      ((font-facility 0x25CC) < 0x25CC :otf=dev2=blwf+ >)
129      (".+" [ :otf=dev2=blwf+ ])))
130
131    ("." =))
132   *))
133
134 ;; Stage 2
135 ;; Basic shaping forms and matra reordering
136 (generator
137  (0
138   (cond
139    ;; Explicit halant form starting with RA + H + ZWJ
140    (" (RHJ[CRnHJ]+)(HN?a?(Ss?|sS?)?A?) "
141     | (1 :otf=dev2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+) (2 = *) |)
142
143    ;; Explicit halant form starting with a reph
144    (" (RH)([CRnHJ]+)(HN?a?(Ss?|sS?)?A?) "
145     | (1 :otf=dev2=rphf+) (2 :otf=dev2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
146     (3 = *) |)
147
148    ;; Other explicit halant forms
149    (" ([CRnHJ]+)(HN?a?(Ss?|sS?)?A?) "
150     | (1 :otf=dev2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+) (2 = *) |)
151
152    ;; Ordinary syllables starting with RA + H + ZWJ
153    ;; 1            2     3
154    (" (RHJ[CRnHJ]*)(mn?)?(u?b?p?n?a?(Ss?|sS?)?A?) "
155     ;;           |
156     ;; This is an asterisk.  If it were a plus sign, an isolated RHJ
157     ;; would match with the next pattern, not with this one.
158     | (2 = *) (1 :otf=dev2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
159     (3 = *) |)
160
161    ;; Ordinary syllables starting with a reph
162    ;; 1   2          3     4
163    (" (RH)([CRnHJV]+)(mn?)?(u?b?p?n?a?(Ss?|sS?)?A?) "
164     | (3 = *) (1 :otf=dev2=rphf+)
165     (2 :otf=dev2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
166     (4 = *) |)
167    
168    ;; Other ordinary syllables
169    ;; 1          2     3
170    (" ([CRnHJV]+)(mn?)?(u?b?p?n?a?(Ss?|sS?)?A?) "
171     | (2 = *) (1 :otf=dev2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
172     (3 = *) |)
173
174    ("." =))
175   *))    
176
177 ;; Stage 3
178 ;; Final reordering #1 (Move pre-base matra after the last halant)
179 (generator
180  (0
181   (cond
182    ;; 1    2            3
183    (" (mn?)([^ ]+H[JS]?)([^H ]+) "
184     | (2 = *) (1 = *) (3 = *) |)
185
186    ("." =))
187   *))
188
189 ;; Stage 4
190 ;; Final reordering #2 (Move reph after the first halant)
191 (generator
192  (0
193   (cond
194    ;; Syllables with a reph and an explicit halant
195    ;; 1     2  3          4
196    (" (mn?)?(r)([^H ]+HJ?)([^ ]*) "
197     | (1 = *) (3 = *) (2 =) (4 = *) |)
198
199    ;; A reph without explicit halant
200    ;; 1     2  3          4  5
201    (" (mn?)?(r)([^aSsA ]+)(a?(Ss?|sS?)?A?) "
202     | (1 = *) (3 = *) (2 =) (4 = *) |)
203
204    ("." =))
205   *))
206
207 ;; Stage 5
208 ;; Nukta for matra and presentation forms
209 (generator
210  (0
211   (cond
212    (" ([^ ]+) "
213     | (1 :otf=dev2=nukt,pres,abvs,blws,psts,haln,calt+) |)
214
215    ("." =))
216   *))
217
218 ;; Stage 6
219 ;; Remove ZWNJ/ZWJ
220 (generator
221  (0
222   (cond
223    ("[NJ]")
224
225    ("." =))
226   *))
227
228 ;; Stage 7
229 ;; GPOS processing
230 (generator
231  (0
232   (cond
233    (" ([^ ]+) "
234     (1 :otf=dev2=+kern,dist,abvm,blwm))
235
236    ("." =))
237   *))
238
239 ;; Copyright (C) 2010
240 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
241 ;;   Registration Number H15PRO112
242
243 ;; This file is part of the m17n database; a sub-part of the m17n
244 ;; library.
245
246 ;; The m17n library is free software; you can redistribute it and/or
247 ;; modify it under the terms of the GNU Lesser General Public License
248 ;; as published by the Free Software Foundation; either version 2.1 of
249 ;; the License, or (at your option) any later version.
250
251 ;; The m17n library is distributed in the hope that it will be useful,
252 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
253 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
254 ;; Lesser General Public License for more details.
255
256 ;; You should have received a copy of the GNU Lesser General Public
257 ;; License along with the m17n library; if not, write to the Free
258 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
259 ;; Boston, MA 02110-1301, USA.
260
261 ;; Local Variables:
262 ;; mode: emacs-lisp
263 ;; End: