Include syllable final HJ to otf part.
[m17n/m17n-db.git] / FLT / GURU-OTF.flt
1 ;; GURU-OTF.flt -- Font Layout Table for Gurmukhi OpenType fonts
2 ;; Copyright (C) 2004, 2007, 2008  AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter guru-otf nil
6       (font (nil nil unicode-bmp :otf=guru=blwf)))
7
8 ;;; <li> GURU-OTF.flt
9 ;;;
10 ;;; For Gurmukhi OpenType fonts to draw the Gurmukhi script.
11
12 (category
13  ;; C: general consonant (except for R and Y)
14  ;; R: consonant (below)
15  ;; Y: consonant YA
16  ;; n: NUKTA
17  ;; H: HALANT
18  ;; m: vowel sign (pre)
19  ;; u: vowel sign (above)
20  ;; b: vowel sign (below)
21  ;; p: vowel sign (post)
22  ;; A: vowel modifier (above)
23  ;; a: vowel modifier (post)
24  ;; V: independent vowel
25  ;; d: ADDAK
26  ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
27  ;; J: ZWJ (ZERO WIDTH JOINER)
28  ;; X: generic
29  ;; Z: internal use
30  (0x0A00 0x0A7F ?X)                     ; generic
31  (0x0A00        ?Z)                     ; internal use
32  (0x0A01 0x0A02 ?A)                     ; SIGN ADAK BINDI .. BINDI
33  (0x0A03        ?a)                     ; SIGN VISARGA
34  (0x0A05 0x0A14 ?V)                     ; LETTER A .. AU
35  (0x0A15 0x0A38 ?C)                     ; LETTER KA .. SA
36  (0x0A2F        ?Y)                     ; LETTER YA
37  (0x0A30        ?R)                     ; LETTER RA
38  (0x0A35        ?R)                     ; LETTER VA
39  (0x0A39        ?R)                     ; LETTER HA
40  (0x0A3C        ?n)                     ; SIGN NUKTA
41  (0x0A3E        ?p)                     ; VOWEL SIGN AA
42  (0x0A3F        ?m)                     ; VOWEL SIGN I
43  (0x0A40        ?p)                     ; VOWEL SIGN II
44  (0x0A41 0x0A42 ?b)                     ; VOWEL SIGN U .. UU
45  (0x0A47 0x0A4C ?u)                     ; VOWEL SIGN EE .. AU
46  (0x0A4D        ?H)                     ; SIGN VIRAMA
47 ;; (0x0A51      ?)                      ; SIGN UDAAT
48  (0x0A59 0x0A5E ?C)                     ; LETTER KHHA .. FA
49  (0x0A70        ?A)                     ; TIPPI
50  (0x0A71        ?d)                     ; ADDAK
51 ;; (0x0A75      ?)                      ; SIGN YAKASH
52  (0x0964 0x0965 ?X)                     ; DANDA .. DOUBLE DANDA
53  (0x200C        ?N)                     ; ZWNJ
54  (0x200D        ?J)                     ; ZWJ
55  )
56
57 ;; Compose consonant and nukta
58 (generator
59  (0
60   (cond
61    ((0x0A32 0x0A3C) 0x0A33)
62    ((0x0A38 0x0A3C) 0x0A36)
63    ((0x0A16 0x0A3C) 0x0A59)
64    ((0x0A17 0x0A3C) 0x0A5A)
65    ((0x0A1C 0x0A3C) 0x0A5B)
66    ((0x0A2B 0x0A3C) 0x0A5E)
67    ("." =))
68   *))
69
70 ;; Reordering
71 (generator
72  (0
73   (cond
74    ;; A syllable with vowel signs.
75    ;;1       2           34   5       6   7
76    ("([CRY]n?(H[CRY]n?)*)((m)|(ub?|b)|(p))(A?a?d?)"
77     < | (4 =) (1 pre-below) (5 = *) (1 post) (6 =) (7 = *) | >)
78
79    ;; A syllable with vowel modifiers or an Addak.
80    ;;1       2           3
81    ("([CRY]n?(H[CRY]n?)*)(Aa?d?|ad?|d)"
82     < | (1 pre-below) (1 post) (3 = *) | >)
83
84    ;; Add a ZWNJ explicitly when a syllable ends with a halant.
85    ;;1       2           3
86    ("([CRY]n?(H[CRY]n?)*)(HN?)?"
87     < | (1 pre-below) (3 = 0x200C) (1 post) | >)
88
89    ;; A syllable starting with an independent vowel.
90    ;; In older texts, LETTER OO may followed by VOWEL SIGN U.
91    ("Vb?A?a?d?"
92     < | = * | >)
93
94    ("." =))
95   *)
96
97  ;; Move the halant after the base consonant to the end.
98  ;; Fill the resulting gap with a special mark.
99  ;; Remove post-base parts.
100  (pre-below
101   (cond
102    ("(.+)(H)(R)(HY)?$"
103     (1 = *) 0x0A00 (3 =) (2 =))
104    ("(.+)HY$"
105     (1 = *) 0x0A00)
106    (".+"
107     = * 0x0A00)))
108
109  ;; Extract post-base parts and add a halant at the end.
110  ;; Produce nothing if there are no post-base parts.
111  (post
112   (cond
113    (".*(H)(Y)$"
114     (2 =) (1 =))
115    (".+"
116     ))))
117
118 ;; Apply language forms to concerning segments.  Note that the Saab
119 ;; font generates below form with 'vatu' instead of 'blwf'.
120 (generator
121  (0
122   (cond
123    ;; Explicit Halant.
124    ;; 1       2    3   4
125    (" ([^Z]+)Z(RH)?(H)N(YH)? "
126     | (1 otf:guru=nukt+) (2 otf:guru=blwf,vatu+) (3 =) (4 otf:guru=pstf+) |)
127
128    ;; Vowel signs and vowel modifiers.
129    ;; 1   2       3    4     5    6
130    (" (m)?([^Z]+)Z(RH)?(u?b?)(YH)?(p?A?a?d?) "
131     | (1 =) (2 otf:guru=nukt+) (3 otf:guru=blwf,vatu+) (4 = *)
132     (5 otf:guru=pstf+) (6 = *) |)
133
134    ("." =))
135   *))
136
137 ;; Other features
138 (generator
139  (0
140   (cond
141    (" ([^ ]+) "
142     (1 otf:guru=vatu,pres,abvs,blws,psts,haln+abvm,blwm,dist))
143
144    ("."
145     [ = ]))
146   *))
147
148 ;; Copyright (C) 2004, 2007, 2008
149 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
150 ;;   Registration Number H15PRO112
151
152 ;; This file is part of the m17n database; a sub-part of the m17n
153 ;; library.
154
155 ;; The m17n library is free software; you can redistribute it and/or
156 ;; modify it under the terms of the GNU Lesser General Public License
157 ;; as published by the Free Software Foundation; either version 2.1 of
158 ;; the License, or (at your option) any later version.
159
160 ;; The m17n library is distributed in the hope that it will be useful,
161 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
162 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
163 ;; Lesser General Public License for more details.
164
165 ;; You should have received a copy of the GNU Lesser General Public
166 ;; License along with the m17n library; if not, write to the Free
167 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
168 ;; Boston, MA 02110-1301, USA.
169
170 ;; Local Variables:
171 ;; mode: emacs-lisp
172 ;; End: