New file.
[m17n/m17n-db.git] / GUJ-OTF.flt
1 ;; GUJ-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> GUJ-OTF.flt
25 ;;;
26 ;;; For Gujarati OpenType fonts to draw Gujarati.
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  (0x0AFD        ?Z)                     ; internal use
66  (0x0AFE        ?Y)                     ; internal use
67  (0x0AFF        ?X)                     ; internal use
68  )
69
70 ;; Step 1 : Syllable identification, Reph and base consonant movements.
71 (generator
72  (0
73   (cond
74    ;; A syllable ending with a vowel sign and/or a vowel modifier.
75    ("(([CR]n?H)*[CR]n?)([mubp][Aa]?|[Aa])"
76     < | (1 move-reph-vattu) (3 = *) | >)
77
78    ;; Forced Halant or half form.
79    ("(([CR]n?H)*[CR]n?)(H[NJ])"
80     < | (1 move-reph-vattu) (3 = =) | >)
81
82    ;; A syllable without a vowel sign nor a vowel modifier.
83    ("([CR]n?H)*[CR]n?H?"
84     < | move-reph-vattu | >)
85
86    ;; A syllable starting with an independent vowel.
87    ("V[Aa]?"
88     < |  = * | >)
89
90    ("." =))
91   *)
92
93  ;; Move the leading RH and the Halant on the base consonant to
94  ;; appropriate positions.
95  ;; 0x0AFF indicates the destination of below-, above-, post Matras.
96  (move-reph-vattu
97   (cond
98    ;; Ending with Halnt.  Immitate a forced Halant form.
99    ("(.*)(H)$"
100     (1 move-reph-vattu) (2 =) 0x200C)
101
102    ;; Both Reph and Vattu.
103    ;;1   23                4  5
104    ("(RH)(([CR]n?H)*[CR]n?)(H)(R)$"
105     (2 = *) (5 =) (4 =) 0x0AFF (1 = =))
106
107    ;; A special case of above.
108    ("(RH)(R)$"
109     (2 =) 0x0AFF (1 = =))
110
111    ;; Reph but no Vattu.
112    ("(RH)(([CR]n?H)*Cn?)$"
113     (2 = *) 0x0AFF (1 = =))
114
115    ;; No Reph but Vattu.
116    ("(Cn?(H[CR]n?)*)(H)(R)$"
117     (1 = *) (4 =) (3 =) 0x0AFF)
118
119    ;; Neither Reph nor Vattu.
120    (".*"
121     = * 0x0AFF))))
122
123 ;; Step 2 : Matra movements and OTF forms.
124 (generator
125  (0
126   (cond
127    ;; 1        2    3   4       5
128    (" ([^X ]*)X(RH)?(m)?([bup])?([Aa])? "
129     | (3 =) (1 otf:gujr=~rphf,*) (4 =) (2 otf:gujr=rphf) (5 =) |)
130
131    (" ([^X ]*)X(RH)?(HJ) "
132     | (1 = *) (2 otf:gujr=rphf) (3 = =) |)
133
134    (" ([^X ]*)X(RH)?(H)N "
135     | (1 otf:gujr=~rphf,*) (2 otf:gujr=rphf) (3 =) |)
136
137    ("." =))
138   *))
139
140 ;; Step 3 : OTF substitutions and positionings.
141 (generator
142  (0
143   (cond
144    (" (.*)J "
145     (1 otf:gujr=~rphf,*))
146    (" ([^ ]*) "
147     (1 otf:gujr=~rphf,~blwf,~half,~haln,*))
148    ("."
149     [ otf:gujr=+ ]))
150   *))
151
152 ;; Local Variables:
153 ;; mode: emacs-lisp
154 ;; End: