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