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