*** empty log message ***
[m17n/m17n-db.git] / FLT / GJR2-OTF.flt
1 ;; GJR2-OTF.flt -- Font Layout Table for gjr2 OpenType fonts
2 ;; Copyright (C) 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter gjr2-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=gjr2)))
8
9 ;;; <li> GJR2-OTF.flt
10 ;;;
11 ;;; For gjr2 OpenType fonts to draw the Gujarati script.  
12
13 (category
14  ;; X: generic
15  ;; V: independent vowel
16  ;; C: consonant
17  ;; R: RA
18  ;; n: NUKTA
19  ;; H: HALANT
20  ;; m: vowel sign (pre)
21  ;; u: vowel sign (above)
22  ;; b: vowel sign (below)
23  ;; p: vowel sign (post)
24  ;; a: vowel modifier (above)
25  ;; A: vowel modifier (post)
26  ;; N: ZWNJ
27  ;; J: ZWJ
28  (0x0A80 0x0AFF ?X)                     ; generic
29  (0x0A81 0x0A82 ?a)                     ; SIGN CANDRABINDU .. ANUSVARA
30  (0x0A83        ?A)                     ; SIGN VISARGA
31  (0x0A85 0x0A94 ?V)                     ; LETTER A .. AU
32  (0x0A95 0x0AB9 ?C)                     ; LETTER KA .. HA
33  (0x0AB0        ?R)                     ; LETTER RA
34  (0x0ABC        ?n)                     ; SIGN NUKTA
35  (0x0ABE        ?p)                     ; VOWEL SIGN AA
36  (0x0ABF        ?m)                     ; VOWEL SIGN I
37  (0x0AC0        ?p)                     ; VOWEL SIGN II
38  (0x0AC1 0x0AC4 ?b)                     ; VOWEL SIGN UU .. VOCALIC RR
39  (0x0AC5 0x0AC8 ?u)                     ; VOWEL SIGN CANDRA E .. AI
40  (0x0AC9 0x0ACC ?p)                     ; VOWEL SIGN CANDRA O .. AU
41  (0x0ACD        ?H)                     ; SIGN VIRAMA
42  (0x0AE0 0x0AE1 ?V)                     ; LETTER VOCALIC RR  .. VOCALIC LL
43  (0x0AE2 0x0AE3 ?b)                     ; VOWEL SIGN VOCALIC L .. VOCALIC LL
44
45  (0x200C        ?N)                     ; ZWNJ
46  (0x200D        ?J)                     ; ZWJ
47  (0x25CC        ?X)                     ; DOTTED CIRCLE
48
49  (rphf          ?r)
50  )
51
52 ;; Stage 0
53 ;; Syllable identification
54 (generator
55  (0
56   (cond
57    ;; Syllables with an independent vowel
58    ("(RH)?Vn?(J?HR)?m?u?b?p?n?a?A?"
59     < | = * | >)
60
61    ;; Consonant-based syllables
62    ("([CR]n?J?HJ?)*[CR]n?(H[NJ]?|m?u?b?p?n?)a?A?"
63     < | = * | >)
64
65    ;; Combining marks are displayed with a DOTTED CIRCLE.
66    ("m"
67     (cond
68      ((font-facility 0x25CC) < = 0x25CC >)
69      ("." [ = ])))
70    ("[nHubpaA]"
71     (cond
72      ((font-facility 0x25CC) < 0x25CC = >)
73      ("." [ = ])))
74    ("JHR"
75     (cond
76      ((font-facility 0x25CC) < 0x25CC :otf=gjr2=blwf+ >)
77      (".+" [ :otf=gjr2=blwf+ ])))
78
79    ("." =))
80   *))
81
82 ;; Stage 1
83 ;; Basic shaping forms and matra reordering
84 (generator
85  (0
86   (cond
87    ;; Explicit halant form starting with RA + H + ZWJ
88    (" (RHJ[CRnHJ]+)(HN?a?A?) "
89     | (1 :otf=gjr2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+) (2 = *) |)
90
91    ;; Explicit halant form starting with a reph
92    (" (RH)([CRnHJ]+)(HN?a?A?) "
93     | (1 :otf=gjr2=rphf+) (2 :otf=gjr2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
94     (3 = *) |)
95
96    ;; Other explicit halant forms
97    (" ([CRnHJ]+)(HN?a?A?) "
98     | (1 :otf=gjr2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+) (2 = *) |)
99
100    ;; Ordinary syllables starting with RA + H + ZWJ
101    ;; 1            2     3
102    (" (RHJ[CRnHJ]*)(mn?)?(u?b?p?n?a?A?) "
103     ;;           |
104     ;; This is an asterisk.  (See DEV2-OTF.flt)
105     | (2 = *) (1 :otf=gjr2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
106     (3 = *) |)
107
108    ;; Ordinary syllables starting with a reph
109    ;; 1   2          3     4
110    (" (RH)([CRnHJV]+)(mn?)?(u?b?p?n?a?A?) "
111     | (3 = *) (1 :otf=gjr2=rphf+)
112     (2 :otf=gjr2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
113     (4 = *) |)
114    
115    ;; Other ordinary syllables
116    ;; 1          2     3
117    (" ([CRnHJV]+)(mn?)?(u?b?p?n?a?A?) "
118     | (2 = *) (1 :otf=gjr2=locl,nukt,akhn,rkrf,blwf,half,vatu,cjct+)
119     (3 = *) |)
120
121    ("." =))
122   *))    
123
124 ;; Stage 2
125 ;; Final reordering #1 (Move pre-base matra after the last halant)
126 (generator
127  (0
128   (cond
129    ;; 1    2         3
130    (" (mn?)([^ ]+HJ?)([^H ]+) "
131     | (2 = *) (1 = *) (3 = *) |)
132
133    ("." =))
134   *))
135
136 ;; Stage 3
137 ;; Final reordering #2 (Move reph after the first halant)
138 (generator
139  (0
140   (cond
141    ;; Syllables with a reph and an explicit halant
142    ;; 1     2  3          4
143    (" (mn?)?(r)([^H ]+HJ?)([^ ]*) "
144     | (1 = *) (3 = *) (2 =) (4 = *) |)
145
146    ;; A reph without explicit halant
147    ;; 1     2  3        4
148    (" (mn?)?(r)([^aA ]+)(a?A?) "
149     | (1 = *) (3 = *) (2 =) (4 = *) |)
150
151    ("." =))
152   *))
153
154 ;; Stage 4
155 ;; Nukta for matra and presentation forms
156 (generator
157  (0
158   (cond
159    (" ([^ ]+) "
160     | (1 :otf=gjr2=nukt,pres,abvs,blws,psts,haln,calt+) |)
161
162    ("." =))
163   *))
164
165 ;; Stage 5
166 ;; Remove ZWNJ/ZWJ
167 (generator
168  (0
169   (cond
170    ("[NJ]")
171
172    ("." =))
173   *))
174
175 ;; Stage 6
176 ;; GPOS processing
177 (generator
178  (0
179   (cond
180    (" ([^ ]+) "
181     (1 :otf=gjr2=+kern,dist,abvm,blwm))
182
183    ("." =))
184   *))
185
186 ;; Copyright (C) 2010
187 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
188 ;;   Registration Number H15PRO112
189
190 ;; This file is part of the m17n database; a sub-part of the m17n
191 ;; library.
192
193 ;; The m17n library is free software; you can redistribute it and/or
194 ;; modify it under the terms of the GNU Lesser General Public License
195 ;; as published by the Free Software Foundation; either version 2.1 of
196 ;; the License, or (at your option) any later version.
197
198 ;; The m17n library is distributed in the hope that it will be useful,
199 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
200 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
201 ;; Lesser General Public License for more details.
202
203 ;; You should have received a copy of the GNU Lesser General Public
204 ;; License along with the m17n library; if not, write to the Free
205 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
206 ;; Boston, MA 02110-1301, USA.
207
208 ;; Local Variables:
209 ;; mode: emacs-lisp
210 ;; End: