*** empty log message ***
[m17n/m17n-db.git] / FLT / MLYM-OTF.flt
1 ;; MLYM-OTF.flt -- Font Layout Table for Malayalam OpenType fonts
2 ;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter mlym-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=mlym)))
8
9 ;;; <li> MLYM-OTF.flt
10 ;;;
11 ;;; For Malayalam OpenType fonts to draw the reformed Malayalam script.
12
13 ;; AnjaliOldLipi.ttf, Dyuthi3.ttf, Meera_04.ttf, Rachana_04.ttf, suruma2.ttf
14 ;; blwf: 0d32
15 ;; pstf: 0d2f 0d30 0d35
16
17 ;; RaghuMalayalamSans2.ttf
18 ;; blwf: 0d32
19 ;; pstf: 0d2f 0d30 0d35 0d41
20
21 ;; lohit_ml.ttf
22 ;; blwf: 0d32
23 ;; pstf: 0d2f 0d30 0d31 0d35 0d41
24
25 ;; Kalyani121.ttf
26 ;; blwf: N/A
27 ;; pstf: 0d2f 0d30 0d32 0d35 0d41
28
29 (category
30  (0x0D00 0x0D7F ?X)                     ; generic
31  (0x0D02 0x0D03 ?A)                     ; SIGN ANUSVARA .. VISARGA
32  (0x0D05 0x0D14 ?V)                     ; LETTER A .. AU
33  (0x0D15 0x0D39 ?C)                     ; LETTER KA .. HA
34  (0x0D2F        ?P)                     ; LETTER YA
35  (0x0D30        ?R)                     ; LETTER RA
36  (0x0D32        ?B)                     ; LETTER LA
37  (0x0D35        ?P)                     ; LETTER VA
38  (0x0D3E 0x0D44 ?p)                     ; VOWEL SIGN AA .. VOCALIC RR
39  (0x0D46 0x0D48 ?m)                     ; VOWEL SIGN E .. AI
40  (0x0D4D        ?H)                     ; SIGN VIRAMA
41  (0x0D57        ?p)                     ; AU LENGTH MARK
42  (0x0D60 0x0D61 ?V)                     ; LETTER VOCALIC RR .. VOCALIC LL
43  (0x0D62 0x0D63 ?b)                     ; VOWEL SIGN VOCALIC L .. LL
44
45  (0x200C        ?N)                     ; ZWNJ
46  (0x200D        ?J)                     ; ZWJ
47  (0x25CC        ?X)                     ; DOTTED CIRCLE
48
49  (pstf          ?r)
50  )
51
52 ;; Stage 0
53 ;; Preprocessing
54 (generator
55  (0
56   (cond
57    ;; Decompose two-part vowel signs
58    ((0x0D4A) 0x0D46 0x0D3E)
59    ((0x0D4B) 0x0D47 0x0D3E)
60    ((0x0D4C) 0x0D46 0x0D57)
61
62    ("." =))
63   *))
64
65 ;; Stage 1
66 ;; Syllable identification
67 (generator
68  (0
69   (cond
70    ;; Consonant-based syllables
71    ;;1      23                 4
72    ("([CBPR]((J?H|HJ?)[CBPR])*)(H[NJ]?|m?p?A?)"
73     < |
74     (cond
75      (".+HJ$" :otf=mlym=nukt,akhn+)
76      ("(.+)(H)N?$" (1 :otf=mlym=nukt,akhn+) (2 =) 0x200C)
77      (".+" :otf=mlym=nukt,akhn+))
78     | >)
79
80    ;; Syllables with an independent vowel
81    ("V(J?H[BPR])?m?p?A?"
82     < | = * | >)
83
84    ;; Two-part vowel signs
85    ((0x0D46 0x0D3E)
86     (cond
87      ((font-facility 0x25CC) < = 0x25CC = >)
88      (".+" [ 0x0D4A ])))
89    ((0x0D47 0x0D3E)
90     (cond
91      ((font-facility 0x25CC) < = 0x25CC = >)
92      (".+" [ 0x0D4B ])))
93    ((0x0D46 0x0D57)
94     (cond
95      ((font-facility 0x25CC) < = 0x25CC = >)
96      (".+" [ 0x0D4C ])))
97
98    ;; Combining marks are displayed with a DOTTED CIRCLE.
99    ("m"
100     (cond
101      ((font-facility 0x25CC) < = 0x25CC >)
102      ("." [ = ])))
103    ("[HbpA]"
104     (cond
105      ((font-facility 0x25CC) < 0x25CC = >)
106      ("." [ = ])))
107
108    ;; Isolated blwf and pstf are displayed with a DOTTED CIRCLE in the
109    ;; next stage.
110    ("(J)(H)([BPR])"
111     < | (1 =) (3 =) (2 =) | >)
112
113    ("." =))
114   *))
115
116 ;; Stage 2
117 ;; Reorder halant for blwf and pstf
118 (generator
119  (0
120   (cond
121    ;; Isolated blwf and pstf
122    (" J([BP]H) "
123     (cond
124      ((font-facility 0x25CC) < 0x25CC (1 :otf=mlym=blwf,pstf+) >)
125      (" J([BP]H) " [ (1 :otf=mlym=blwf,pstf+) ])))
126
127    ;; Isolated pref
128    (" J(RH) "
129     (cond
130      ((font-facility 0x25CC) < (1 :otf=mlym=pstf+) 0x25CC >)
131      (" J(RH) " [ (1 :otf=mlym=pstf+) ])))
132
133    ;; Overt halnt forms
134    (" ([^ ]+)(HN) "
135     | (1 reorder) (2 = =) |)
136
137    ;; Ordinary syllables
138    (" ([^mbpA ]+)(m?p?A?) "
139     | (1 reorder) (2 = *) |)
140
141    ("." =))
142   *)
143
144  (reorder
145   (cond
146    ;; pref after pstf
147    ("(.|.+([^PJ]|JP))((J?HP)*J?HR)$"
148     (1 reorder-B *) (3 reorder-any *))
149    ;; pref between blwf and pstf
150    ("(.*[^J])(J?HR(J?HP)+)$"
151     (1 reorder-B *) (2 reorder-any *))
152    ;; pref before blwf
153    ("(.*[^J])(J?HR(J?HB)+(J?HP)*)$"
154     (1 reorder-B *) (2 reorder-any *))
155    ;; no pref
156    ("(.|.+([^PJ]|JP|HJ))((J?HP)*)$"
157     (1 reorder-B *) (3 reorder-any *))))
158
159  (reorder-B
160   (cond
161    ("J?(H)(B)"
162     (2 =) (1 =))
163    ("." =)))
164
165  (reorder-any
166   ("J?(H)(.)"
167    (2 =) (1 =)))
168  )
169
170 ;; Stage 3
171 ;; Language forms and matra reordering
172 (generator
173  (0
174   (cond
175    ;; Overt halant forms
176    (" ([^ ]+)(HN) "
177     | (1 blwf-pstf) (2 = =) |)
178
179    ;; Other syllables
180    ;; 1          2   3
181    (" ([^mpA ]+)(m)?(p?A?) "
182     | (2 =) (1 blwf-pstf) (3 = *) |)
183
184    ("." =))
185   *)
186
187  (blwf-pstf
188   (cond
189    ;;1              23     4
190    ("(.|.+BH|.+[^H])((PH)*)(RH)$"
191     (4 :otf=mlym=pstf) (1 :otf=mlym=blwf+) (2 :otf=mlym=pstf+))
192    ;;1   2   3
193    ("(.*)(RH)((PH)+)$"
194     (2 :otf=mlym=pstf+) (1 :otf=mlym=blwf+) (3 :otf=mlym=pstf+))
195    ;;1   2   34     5
196    ("(.*)(RH)((BH)+)((PH)*)$"
197     (2 :otf=mlym=pstf+) (1 :otf=mlym=blwf+) (3 :otf=mlym=blwf+)
198     (5 :otf=mlym=pstf+))
199    ;;1              2
200    ("(.|.+BH|.+[^H])((PH)*)$"
201     (1 :otf=mlym=blwf+) (2 :otf=mlym=pstf+))))
202  )
203
204 ;; Stage 4
205 ;; Final reordering (Move pre-base matra and pref after the last halant)
206 (generator
207  (0
208   (cond
209    ;; With a pref, one or more intermediate-  and a final overt halant forms.
210    ;; 1  2         3
211    (" (r)([^ ]+HJ?)([^H ]+HN) "
212     | (2 = *) (1 =) (3 = *) |)
213
214    ;; With a pref and a final overt halant form.  Don't move the pref.
215    (" r[^H ]+HN "
216     = *)
217
218    ;; 1     2         3
219    (" (m?r?)([^ ]+HJ?)([^H ]+) "
220     | (2 = *) (1 = *) (3 = *) |)
221
222    ("." =))
223   *))
224
225 ;; Stage 5
226 ;; Remove ZWNJ/ZWJ
227 (generator
228  (0
229   (cond
230    ("[NJ]")
231
232    ("." =))
233   *))
234
235 ;; Stage 6
236 ;; GPOS processing
237 (generator
238  (0
239   (cond
240    (" ([^ ]+) "
241     (1 :otf=mlym=+abvm,blwm,dist))
242
243    ("." =))
244   *))
245
246 ;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
247 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
248 ;;   Registration Number H15PRO112
249
250 ;; This file is part of the m17n database; a sub-part of the m17n
251 ;; library.
252
253 ;; The m17n library is free software; you can redistribute it and/or
254 ;; modify it under the terms of the GNU Lesser General Public License
255 ;; as published by the Free Software Foundation; either version 2.1 of
256 ;; the License, or (at your option) any later version.
257
258 ;; The m17n library is distributed in the hope that it will be useful,
259 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
260 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
261 ;; Lesser General Public License for more details.
262
263 ;; You should have received a copy of the GNU Lesser General Public
264 ;; License along with the m17n library; if not, write to the Free
265 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
266 ;; Boston, MA 02110-1301, USA.
267
268 ;; Local Variables:
269 ;; mode: emacs-lisp
270 ;; End: