*** empty log message ***
[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, 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter orya-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=orya)))
8
9 ;;; <li> ORYA-OTF.flt
10 ;;;
11 ;;; For Oriya OpenType fonts to draw the Oriya script.
12
13 (category
14  ;; B: consonants that have a below form
15  ;; C: consonants that do not
16  ;; This table is made for Samyak-Oriya.ttf and utkal.ttf.
17  ;; (lohit_or.ttf has more below form consonants.)
18  (0x0B00 0x0B7F ?X)                     ; generic
19  (0x0B01        ?a)                     ; SIGN CANDRABINDU
20  (0x0B02 0x0B03 ?A)                     ; SIGN ANUSVARA .. VISARGA
21  (0x0B05 0x0B14 ?V)                     ; LETTER A .. VOCALIC AU
22  (0x0B15 0x0B39 ?B)                     ; LETTER KA .. HA
23  (0x0B18 0x0B1A ?C)                     ; LETTER GHA .. CA
24  (0x0B1E        ?C)                     ; LETTER NYA
25  (0x0B22        ?C)                     ; LETTER DDHA
26  (0x0B25 0x0B26 ?C)                     ; LETTER THA .. DA
27  (0x0B2F        ?Y)                     ; LETTER YA
28  (0x0B30        ?R)                     ; LETTER RA
29  (0x0B36 0x0B37 ?C)                     ; LETTER SHA .. SSA
30  (0x0B3C        ?n)                     ; SIGN NUKTA
31  (0x0B3E        ?p)                     ; VOWEL SIGN AA
32  (0x0B3F        ?u)                     ; VOWEL SIGN I
33  (0x0B40        ?p)                     ; VOWEL SIGN II
34  (0x0B41 0x0B44 ?b)                     ; VOWEL SIGN U .. VOCALIC RR
35  (0x0B47        ?m)                     ; VOWEL SIGN E
36  (0x0B4D        ?H)                     ; SIGN VIRAMA
37  (0x0B56        ?u)                     ; AI LENGTH MARK
38  (0x0B57        ?p)                     ; AU LENGTH MARK
39  (0x0B5C 0x0B5D ?C)                     ; LETTER RRA .. RHA
40  (0x0B5F        ?Y)                     ; LETTER YYA
41  (0x0B60 0x0B61 ?V)                     ; LETTER VOCALIC RR .. LL
42  (0x0B62 0x0B63 ?b)                     ; VOWEL SIGN VOCALIC L .. LL
43  (0x0B71        ?C)                     ; LETTER WA
44
45  (0x200C        ?N)                     ; ZWNJ
46  (0x200D        ?J)                     ; ZWJ
47  (0x25CC        ?X)                     ; DOTTED CIRCLE
48
49  (rphf          ?r)
50  (pstf          ?P)
51  )
52
53 ;; Stage 0
54 ;; Preprocessing
55 (generator
56  (0
57   (cond
58    ;; Decompose two-part vowel signs.
59    ((0x0B48)
60     0x0B47 0x0B56)
61    ((0x0B4B)
62     0x0B47 0x0B3E)
63    ((0x0B4C)
64     0x0B47 0x0B57)
65
66    ;; Compose consonant and nukta.
67    ((0x0B21 0x0B3C)
68     0x0B5C)
69    ((0x0B22 0x0B3C)
70     0x0B5D)
71
72    ("." =))
73   *))
74
75 ;; Stage 1
76 ;; Syllable identification
77 (generator
78  (0
79   (cond
80    ;; Syllables with an independent vowel
81    ("(RH)?(Vn?)((J?H[BYR])?m?u?b?p?n?a?A?)"
82     < | (1 = =) (2 :otf=orya=nukt+) (3 = *) | >)
83
84    ;; Consonant-based syllables
85    ;;1        23                   4
86    ("([CBYR]n?((J?H|HJ?)[CBYR]n?)*)(H[NJ]?|m?u?b?p?n?a?A?)"
87     < |
88     (cond
89      (".+HJ$" :otf=orya=nukt,akhn+)
90      ("(.+)(H)N?$" (1 :otf=orya=nukt,akhn+) (2 =) 0x200C)
91      (".+" :otf=orya=nukt,akhn+))
92     | >)
93
94    ;; Two-part vowel signs
95    ((0x0B47 0x0B56)
96     (cond
97      ((font-facility 0x25CC) < = 0x25CC = >)
98      (".+" [ 0x0B48 ])))
99    ((0x0B47 0x0B3E)
100     (cond
101      ((font-facility 0x25CC) < = 0x25CC = >)
102      (".+" [ 0x0B4B ])))
103    ((0x0B47 0x0B57)
104     (cond
105      ((font-facility 0x25CC) < = 0x25CC = >)
106      (".+" [ 0x0B4C ])))
107
108    ;; Combining marks are displayed with a DOTTED CIRCLE.
109    ("m"
110     (cond
111      ((font-facility 0x25CC) < = 0x25CC >)
112      ("." [ = ])))
113    ("[nHubpaA]"
114     (cond
115      ((font-facility 0x25CC) < 0x25CC = >)
116      ("." [ = ])))
117
118    ;; Isolated blwf and pstf are displayed with a DOTTED CIRCLE in the
119    ;; next stage.
120    ("(J)(H)([BYR])"
121     < | (1 =) (3 =) (2 =) | >)
122
123    ("." =))
124   *))
125
126 ;; Stage 2
127 ;; Reorder halant for blwf and pstf
128 (generator
129  (0
130   (cond
131    ;; Isolated blwf and pstf
132    (" J([BYR]H) "
133     (cond
134      ((font-facility 0x25CC) < 0x25CC (1 :otf=orya=blwf,pstf+) >)
135      (" J([BYR]H) " [ (1 :otf=orya=blwf,pstf+) ])))
136
137    ;; Syllables with an overt halant
138    (" (RHJ?)?([^ ]+)(HN) "
139     | (1 = *) (2 reorder) (3 = =) |)
140
141    ;; Ordinary syllables
142    (" (RHJ?)?([^mubpaA ]+)(m?u?b?p?n?a?A?) "
143     | (1 = *) (2 reorder) (3 = *) |)
144
145    ("." =))
146   *)
147
148  (reorder
149   ("(.|.+([^YJ]|JY|HJ))((J?HY)*)$"
150    (1 reorder-BR *) (3 reorder-Y *)))
151
152  (reorder-BR
153   (cond
154    ("J?(H)([BR])"
155     (2 =) (1 =))
156    ("." =)))
157
158  (reorder-Y
159   ("J?(H)(Y)"
160    (2 =) (1 =)))
161  )
162
163 ;; Stage 3
164 ;; Language forms and matra reordering
165 (generator
166  (0
167   (cond
168    ;; Overt halant forms
169    (" (RHJ?)?([^ ]+)(HN) "
170     |
171     (1 (cond ("RHJ" :otf=orya=half+)
172              ("RH" :otf=orya=rphf+)))
173     (2 b4post) (2 post) (3 = =) |)
174
175    ;; Other syllables
176    ;; 1      2            3     4     5     6     7   8
177    (" (RHJ?)?([^mubpaA ]*)(mn?)?(un?)?(bn?)?(pn?)?(a)?(A)? "
178     | (3 = *)
179     (1 (cond ("RHJ" :otf=orya=half+)
180              ("RH" :otf=orya=rphf+)))
181     (2 b4post) (5 = *) (4 = *) (7 =) (2 post) (6 = *) (8 =) |)
182
183    ("." =))
184   *)
185
186  ;; Oriya should not have half forms nor vatu forms, but
187  ;; Samyak-Oriya.ttf and utkal.ttf do have them.
188  (b4post
189   (cond
190    ("(.H)J?(.*)"
191     (1 :otf=orya=half+)
192     (2 ("(.|.+([^YH]|JY|[BR]H))((YH)*)$" (1 lang-forms *))))
193    ("(.|.+([^YH]|JY|[BR]H))((YH)*)"
194     (1 lang-forms *))))
195
196  (lang-forms
197   (cond
198    ("(.H)J" (1 :otf=orya=half+))
199    (".H" :otf=orya=blwf,half,vatu+)
200    ("." =)))
201
202  (post
203   ("(.|.+([^YH]|JY|[BR]H))((YH)+)$"
204    (3 :otf=orya=pstf+)))
205  )
206
207 ;; Stage 4
208 ;; Final reordering #1 (Move pre-base matra after the last halant)
209 (generator
210  (0
211   (cond
212    ;; 1    2         3
213    (" (mn?)([^ ]+HJ?)([^H ]+) "
214     | (2 = *) (1 = *) (3 = *) |)
215
216    ("." =))
217   *))
218
219 ;; Stage 5
220 ;; Final reordering #2 (Move reph after the first halant)
221 (generator
222  (0
223   (cond
224    ;; Syllables with a reph and an overt halant
225    ;; 1     2  3           4
226    (" (mn?)?(r)([^HP ]+HJ?)([^ ]*) "
227     | (1 = *) (3 = *) (2 =) (4 = *) |)
228
229    ;; A reph without overt halant
230    ;; 1     2  3          4
231    (" (mn?)?(r)([^aPpA ]+)(a?P*(HN)?p?n?A?) "
232     | (1 = *) (3 = *) (2 =) (4 = *) |)
233
234    ("." =))
235   *))
236
237 ;; Stage 6
238 ;; Nukta for matra and Presentation forms
239 (generator
240  (0
241   (cond
242    (" ([^ ]+) "
243     | (1 :otf=orya=nukt,pres,abvs,blws,psts,haln+) |)
244
245    ("." =))
246   *))
247
248 ;; Stage 7
249 ;; Remove ZWNJ/ZWJ
250 (generator
251  (0
252   (cond
253    ("[NJ]")
254
255    ("." =))
256   *))
257
258 ;; Stage 8
259 ;; GPOS processing
260 (generator
261  (0
262   (cond
263    (" ([^ ]+) "
264     (1 :otf=orya=+abvm,blwm,dist))
265
266    ("." =))
267   *))
268
269 ;; Copyright (C) 2004, 2007, 2008, 2010
270 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
271 ;;   Registration Number H15PRO112
272
273 ;; This file is part of the m17n database; a sub-part of the m17n
274 ;; library.
275
276 ;; The m17n library is free software; you can redistribute it and/or
277 ;; modify it under the terms of the GNU Lesser General Public License
278 ;; as published by the Free Software Foundation; either version 2.1 of
279 ;; the License, or (at your option) any later version.
280
281 ;; The m17n library is distributed in the hope that it will be useful,
282 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
283 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
284 ;; Lesser General Public License for more details.
285
286 ;; You should have received a copy of the GNU Lesser General Public
287 ;; License along with the m17n library; if not, write to the Free
288 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
289 ;; Boston, MA 02110-1301, USA.
290
291 ;; Local Variables:
292 ;; mode: emacs-lisp
293 ;; End: