Add Gurmukhi OTF
[m17n/m17n-db.git] / GUR-OTF.flt
1 ;; GUR-OTF.flt -- Font Layout Table for Gurmukhi OpenType fonts
2 ;; Copyright (C) 2004
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., 59 Temple Place, Suite 330, Boston, MA
22 ;; 02111-1307, USA.
23
24 ;;; <li> GUR-OTF.flt
25 ;;;
26 ;;; For Gurmukhi OpenType fonts to draw Punjabi.  
27 ;;; Designed for saab.otf (version 0.91).
28 ;;; <http://guca.sourceforge.net/typography/fonts/saab/index.shtml>
29
30 (category
31  ;; C: general consonant
32  ;; Y: post-base consonat (YA)
33  ;; R: below-base consonat (RA, VA, HA)
34  ;; n: NUKTA
35  ;; H: HALANT
36  ;; m: MATRA (pre)
37  ;; u: MATRA (above)
38  ;; b: MATRA (below)
39  ;; p: MATRA (post)
40  ;; A: vowel modifier (above)
41  ;; a: vowel modifier (post)
42  ;; V: independent vowel
43  ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
44  ;; J: ZWJ (ZERO WIDTH JOINER)
45  ;; E: ELSE
46  ;;
47  (0x200C        ?N)                     ; ZWNJ
48  (0x200D        ?J)                     ; ZWJ
49  (0x0A00 0x0A7F ?E)                     ; ELSE
50  (0x0A01        ?A)                     ; SIGN ADAK BINDI (above)
51  (0x0A02        ?A)                     ; SIGN BINDI (above)
52  (0x0A03        ?a)                     ; SIGN VISARGA (post)
53  (0x0A05 0x0A14 ?V)                     ; LETTER A .. LETTER AU
54  (0x0A15 0x0A38 ?C)                     ; LETTER KA .. LETTER 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 (post)
61  (0x0A3F        ?m)                     ; VOWEL SIGN I (pre)
62  (0x0A40        ?p)                     ; VOWEL SIGN II (post)
63  (0x0A41        ?b)                     ; VOWEL SIGN U (below)
64  (0x0A42        ?b)                     ; VOWEL SIGN UU (below)
65  (0x0A47        ?u)                     ; VOWEL SIGN EE (above)
66  (0x0A48        ?u)                     ; VOWEL SIGN AI (above)
67  (0x0A4B        ?u)                     ; VOWEL SIGN OO (above)
68  (0x0A4C        ?u)                     ; VOWEL SIGN AU (above)
69  (0x0A4D        ?H)                     ; SIGN VIRAMA (HARANT)
70  (0x0A59 0x0A5E ?C)                     ; LETTER KHHA .. LETTER FA
71  (0x0A70        ?A)                     ; TIPPI (above)
72  (0x0A7F        ?X)                     ; internal use
73  )
74
75 ;; Step 1 : Syllable identification and Halant movement.
76 (generator
77  (0
78   (cond
79    ;; A syllable ending with a vowel sign and/or a vowel modifier.
80    ("(([CRY]n?H)*[CRY]n?)([mubp][Aa]?|[Aa])"
81     < | (1 move-base-Halant) (3 =) | >)
82
83    ;; A syllable without a vowel sign nor a vowel modifier.
84    ("(([CRY]n?H)*[CRY]n?)(H)?"
85     < | (0 move-base-Halant) | >)
86
87    ;; A syllable starting with an independent vowel.
88    ("V[Aa]?"
89     < | = * | > )
90
91    ("." =))
92   *)
93
94  ;; Move Halant on the base consonant to the tail.
95  ;; 0x0A7F indicates the postion for above- or below Matra.
96  (move-base-Halant
97   (cond
98    ("(([CRY]n?H)*[CRY]n?)(H)(Y)"
99     (1 = *)
100     0x0A7F
101     (4 =)
102     (3 =))
103    ("(([CRY]n?H)*[CRY]n?)(H)(R)"
104     (1 = *)
105     (4 =)
106     (3 =)
107     0x0A7F)
108    ("([CRY]n?H)*[CRY]n?H"
109     = * 0x200C)
110    (".*"
111     = * 0x0A7F))))
112
113 ;; Step 2 : Move Matra.
114 (generator
115  (0
116   (cond
117    ;; 1          2    3   4      5   6
118    (" ([CRYnH]*)X(YH)?(m)?([ub])?(p)?([Aa])? "
119     | (3 =) (1 = *) (4 =) (2 = =) (5 =) (6 =) |)
120    ("." =))
121   *))
122
123 ;; Step 3 : Drive OTF tables.
124 (generator
125  (0
126   (cond
127    (" ([^ ]*HN) "
128     (1 otf:guru=nukt))
129    (" ([^ ]*) "
130     (1 otf:guru=nukt,vatu,pstf,abvs,blws))
131    ((0x0A71)
132     otf:guru)
133    ("."
134     [ otf:guru=+ ] ))
135   *))
136
137 ;; Local Variables:
138 ;; mode: emacs-lisp
139 ;; End: