(FONT-SPEC): Fix typo.
[m17n/m17n-db.git] / FLT / GUR2-OTF.flt
1 ;; GUR2-OTF.flt -- Font Layout Table for gur2 OpenType fonts
2 ;; Copyright (C) 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter gur2-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=gur2)))
8
9 ;;; <li> GUR2-OTF.flt
10 ;;;
11 ;;; For gur2 OpenType fonts to draw the Gurmukhi script.
12
13 (category
14  (0x0A00 0x0A7F ?X)                     ; generic
15  (0x0A01 0x0A02 ?a)                     ; SIGN ADAK BINDI .. BINDI
16  (0x0A03        ?A)                     ; SIGN VISARGA
17  (0x0A05 0x0A14 ?V)                     ; LETTER A .. AU
18  (0x0A15 0x0A38 ?C)                     ; LETTER KA .. SA
19  (0x0A3C        ?n)                     ; SIGN NUKTA
20  (0x0A3E        ?p)                     ; VOWEL SIGN AA
21  (0x0A3F        ?m)                     ; VOWEL SIGN I
22  (0x0A40        ?p)                     ; VOWEL SIGN II
23  (0x0A41 0x0A42 ?b)                     ; VOWEL SIGN U .. UU
24  (0x0A47 0x0A4C ?u)                     ; VOWEL SIGN EE .. AU
25  (0x0A4D        ?H)                     ; SIGN VIRAMA
26 ;; (0x0A51      ?)                      ; SIGN UDAAT
27  (0x0A59 0x0A5E ?C)                     ; LETTER KHHA .. FA
28  (0x0A70        ?a)                     ; TIPPI
29  (0x0A71        ?d)                     ; ADDAK
30 ;; (0x0A75      ?)                      ; SIGN YAKASH
31
32  (0x200C        ?N)                     ; ZWNJ
33  (0x200D        ?J)                     ; ZWJ
34  (0x25CC        ?X)                     ; DOTTED CIRCLE
35
36  (pstf          ?P)
37  )
38
39 ;; Stage 0
40 ;; Preprocessing
41 (generator
42  (0
43   (cond
44    ;; Compose a consonant and a nukta
45    ((0x0A32 0x0A3C) 0x0A33)
46    ((0x0A38 0x0A3C) 0x0A36)
47    ((0x0A16 0x0A3C) 0x0A59)
48    ((0x0A17 0x0A3C) 0x0A5A)
49    ((0x0A1C 0x0A3C) 0x0A5B)
50    ((0x0A2B 0x0A3C) 0x0A5E)
51    ("." =))
52   *))
53
54 ;; Stage 1
55 ;; Syllable identification
56 (generator
57  (0
58   (cond
59    ;; Consonant-based syllables
60    ("(Cn?J?HJ?)*Cn?(H[NJ]?|m?u?b?p?n?)a?A?"
61     < | = * | >)
62
63    ;; Syllables with an independent vowel
64    ("Vn?(J?HC)?m?u?b?p?n?a?A?"
65     < | = * | >)
66
67    ;; Combining marks are displayed with a DOTTED CIRCLE.
68    ("m"
69     (cond
70      ((font-facility 0x25CC) < = 0x25CC >)
71      ("." [ = ])))
72    ("[nHubpaA]"
73     (cond
74      ((font-facility 0x25CC) < 0x25CC = >)
75      ("." [ = ])))
76    ("JHC"
77     (cond
78      ((font-facility 0x25CC) < 0x25CC :otf=gur2=blwf,pstf+ >)
79      (".+" [ :otf=gur2=blwf,pstf+ ])))
80
81    ("." =))
82   *))
83
84 ;; Stage 2
85 ;; Basic shaping forms and matra reordering
86 (generator
87  (0
88   (cond
89    ;; Explicit halant forms
90    (" ([CnHJ]+)(HN?a?A?) "
91     (1 :otf?gur2=locl,nukt,akhn,blwf,pstf+)
92     | (1 shaping) (2 = *) |)
93
94    ;; Ordinary syllables
95    ;; 1          2    3     4     5     6
96    (" ([CnHJV]+)(mn?)?(un?)?(bn?)?(pn?)?(a?A?) "
97     (1 :otf?gur2=locl,nukt,akhn,blwf,pstf+)
98     | (2 = *) (1 shaping) (4 = *) (3 = *) (5 = *) (6 = *) |)
99
100    ("." =))
101   *)
102
103  (shaping
104   (cond
105    ("([CnHJP]*[CV]n?)((J?PP)+)$"
106     (1 :otf=gur2=locl,nukt,akhn,blwf,cjct+) (2 :otf=gur2=pstf+))
107    (".+"
108     (0 :otf=gur2=locl,nukt,akhn,blwf,cjct+))))
109  )
110
111 ;; Stage 3
112 ;; Final reordering (Move pre-base matra after the last halant)
113 (generator
114  (0
115   (cond
116    ;; 1    2         3
117    (" (mn?)([^ ]+HJ?)([^H ]+) "
118     | (2 = *) (1 = *) (3 = *) |)
119
120    ("." =))
121   *))
122
123 ;; Stage 4
124 ;; Nukta for matra and presentation forms
125 (generator
126  (0
127   (cond
128    (" ([^ ]+) "
129     | (1 :otf=gur2=nukt,pres,abvs,blws,psts,haln,calt+) |)
130
131    ("." =))
132   *))
133
134 ;; Stage 5
135 ;; Remove ZWNJ/ZWJ
136 (generator
137  (0
138   (cond
139    ("[NJ]")
140
141    ("." =))
142   *))
143
144 ;; Stage 6
145 ;; GPOS processing
146 (generator
147  (0
148   (cond
149    (" ([^ ]+) "
150     (1 :otf=gur2=+kern,dist,abvm,blwm))
151
152    ("." =))
153   *))
154
155 ;; Copyright (C) 2010
156 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
157 ;;   Registration Number H15PRO112
158
159 ;; This file is part of the m17n database; a sub-part of the m17n
160 ;; library.
161
162 ;; The m17n library is free software; you can redistribute it and/or
163 ;; modify it under the terms of the GNU Lesser General Public License
164 ;; as published by the Free Software Foundation; either version 2.1 of
165 ;; the License, or (at your option) any later version.
166
167 ;; The m17n library is distributed in the hope that it will be useful,
168 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
169 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
170 ;; Lesser General Public License for more details.
171
172 ;; You should have received a copy of the GNU Lesser General Public
173 ;; License along with the m17n library; if not, write to the Free
174 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
175 ;; Boston, MA 02110-1301, USA.
176
177 ;; Local Variables:
178 ;; mode: emacs-lisp
179 ;; End: