*** empty log message ***
[m17n/m17n-db.git] / GUJR-OTF.flt
1 ;; GUJR-OTF.flt -- Font Layout Table for Gujarati 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> GUJR-OTF.flt
25 ;;;
26 ;;; For Gujarati OpenType fonts to draw the Gujarati script.
27 ;;; Tested with padmaa-Medium-1.5.ttf <http://www.indictrans.org/>
28
29 (category
30  ;; C: general consonant
31  ;; R: RA
32  ;; V: independent vowel
33  ;; H: HALANT
34  ;; m: MATRA (pre)
35  ;; u: MATRA (above)
36  ;; b: MATRA (below)
37  ;; p: MATRA (post)
38  ;; A: vowel modifier (above)
39  ;; a: vowel modifier (post)
40  ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
41  ;; J: ZWJ (ZERO WIDTH JOINER)
42  ;; E: ELSE
43  ;;
44  (0x200C        ?N)                     ; ZWNJ
45  (0x200D        ?J)                     ; ZWJ
46  (0x0964        ?E)                     ; DANDA
47  (0x0965        ?E)                     ; DOUBLE DANDA
48  (0x0A80 0x0AFF ?E)                     ; ELSE
49  (0x0A81        ?A)                     ; SIGN CANDRABINDU
50  (0x0A82        ?A)                     ; SIGN ANUSVARA
51  (0x0A83        ?a)                     ; SIGN VISARGA
52  (0x0A85 0x0A94 ?V)                     ; LETTER AA .. LETTER AU
53  (0x0A95 0x0AB9 ?C)                     ; LETTER KA .. LETTER HA
54  (0x0AB0        ?R)                     ; LETTER RA
55  (0x0ABC        ?n)                     ; SIGN NUKTA
56  (0x0ABE        ?p)                     ; VOWEL SIGN AA (post)
57  (0x0ABF        ?m)                     ; VOWEL SIGN I (pre)
58  (0x0AC0        ?p)                     ; VOWEL SIGN II (post)
59  (0x0AC1 0x0AC4 ?b)                     ; VOWEL SIGN U, UU, R, RR (below)
60  (0x0AC5 0x0AC8 ?u)                     ; VOWEL SIGN CANDRA E, E, AI (above)
61  (0x0AC9 0x0ACC ?p)                     ; VOWEL SIGN CANDRA O, O, AU (post)
62  (0x0ACD        ?H)                     ; SIGN VIRAMA (HALANT)
63  (0x0AE0 0x0AE1 ?V)                     ; LETTER VOCALIC RR, LL
64  (0x0AE2 0x0AE3 ?b)                     ; VOWEL SIGN VOCALIC RR, LL (below)
65  (0x0AFF        ?X)                     ; internal use
66  )
67
68 ;; Step 1 : Syllable identification, Reph and base consonant movements.
69 (generator
70  (0
71   (cond
72    ;; A syllable ending with a vowel sign and/or a vowel modifier.
73    ("(([CR]n?H)*[CR]n?)([mubp][Aa]?|[Aa])"
74     < | (1 move-reph-vattu) (3 = *) | >)
75
76    ;; Forced Halant or half form.
77    ("(([CR]n?H)*[CR]n?)(H[NJ])"
78     < | (1 move-reph-vattu) (3 = =) | >)
79
80    ;; A syllable without a vowel sign nor a vowel modifier.
81    ("([CR]n?H)*[CR]n?H?"
82     < | move-reph-vattu | >)
83
84    ;; A syllable starting with an independent vowel.
85    ("V[Aa]?"
86     < |  = * | >)
87
88    ("." =))
89   *)
90
91  ;; Move the leading RH and the Halant on the base consonant to
92  ;; appropriate positions.
93  ;; 0x0AFF indicates the destination of below-, above-, post Matras.
94  (move-reph-vattu
95   (cond
96    ;; Ending with Halnt.  Immitate a forced Halant form.
97    ("(.*)(H)$"
98     (1 move-reph-vattu) (2 =) 0x200C)
99
100    ;; Both Reph and Vattu.
101    ;;1   23                4  5
102    ("(RH)(([CR]n?H)*[CR]n?)(H)(R)$"
103     (2 = *) (5 =) (4 =) 0x0AFF (1 = =))
104
105    ;; A special case of above.
106    ("(RH)(R)$"
107     (2 =) 0x0AFF (1 = =))
108
109    ;; Reph but no Vattu.
110    ("(RH)(([CR]n?H)*Cn?)$"
111     (2 = *) 0x0AFF (1 = =))
112
113    ;; No Reph but Vattu.
114    ("(Cn?(H[CR]n?)*)(H)(R)$"
115     (1 = *) (4 =) (3 =) 0x0AFF)
116
117    ;; Neither Reph nor Vattu.
118    (".*"
119     = * 0x0AFF))))
120
121 ;; Step 2 : Matra movements and OTF forms.
122 (generator
123  (0
124   (cond
125    ;; 1    2        3    4   5       6
126    (" (RH)?([^X ]*)X(RH)?(m)?([bup])?([Aa])? "
127     |
128     (4 =)
129     (1 otf:gujr=~rphf,~blwf,*)
130     (2 otf:gujr=~rphf,*)
131     (5 =)
132     (3 otf:gujr=rphf)
133     (6 =)
134     |)
135
136    (" (RH)?([^X ]*)X(RH)?(HJ) "
137     |
138     (1 = =)
139     (2 otf:gujr=~rphf)
140     (3 otf:gujr=rphf)
141     (4 = =)
142     |)
143
144    (" (RH)?([^X ]*)X(RH)?(H)N "
145     |
146     (1 otf:gujr=~rphf,~blwf,*)
147     (2 otf:gujr=~rphf,*)
148     (3 otf:gujr=rphf)
149     (4 =)
150     |)
151
152    ("." =))
153   *))
154
155 ;; Step 3 : OTF substitutions and positionings.
156 (generator
157  (0
158   (cond
159    (" (.*)J "
160     (1 otf:gujr=~rphf,~blwf,*))
161    (" ([^ ]*) "
162     (1 otf:gujr=~rphf,~blwf,~half,~haln,*))
163    ("."
164     [ otf:gujr=+ ]))
165   *))
166
167 ;; Local Variables:
168 ;; mode: emacs-lisp
169 ;; End: