Big change for supporting backspace well.
[m17n/m17n-db.git] / TELU-OTF.flt
1 ;; TELU-OTF.flt -- Font Layout Table for Telugu 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> TELU-OTF.flt
25 ;;;
26 ;;; For Telugu OpenType fonts to draw Telugu.
27 ;;; Designed for Pothana2000.ttf <http://www.kavya-nandanam.com/>
28
29 (category
30  ;; C: general consonant
31  ;; R: no below-base consonat (RRA, NNNA, LLLA)
32  ;; H: HALANT
33  ;; u: MATRA (above)
34  ;; b: MATRA (below)
35  ;; p: MATRA (post)
36  ;; t: MATRA (two-part)
37  ;; a: vowel modifier (post)
38  ;; V: independent vowel
39  ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
40  ;; J: ZWJ (ZERO WIDTH JOINER)
41  ;; E: ELSE
42  ;;
43  (0x200C        ?N)                     ; ZWNJ
44  (0x200D        ?J)                     ; ZWJ
45  (0x0964        ?E)                     ; DANDA
46  (0x0965        ?E)                     ; DOUBLE DANDA
47  (0x0C00 0x0C7F ?E)                     ; ELSE
48  (0x0C01 0x0C03 ?a)                     ; post signs
49  (0x0C05 0x0C14 ?V)                     ; LETTER A .. LETTER AU
50  (0x0C15 0x0C39 ?C)                     ; LETTER KA .. LETTER HA
51  (0x0C29        ?R)                     ; LETTER NNNA
52  (0x0C31        ?R)                     ; LETTER RRA
53  (0x0C34        ?R)                     ; LETTER LLLA
54  (0x0C3E 0x0C40 ?u)                     ; VOWEL SIGN AA, I, II (above)
55  (0x0C41 0x0C44 ?p)                     ; VOWEL SIGN U, UU, R, RR (post)
56  (0x0C46 0x0C47 ?u)                     ; VOWEL SIGN E, EE (above)
57  (0x0C48        ?t)                     ; VOWEL SIGN AI (two-part)
58  (0x0C4A 0x0C4C ?u)                     ; VOWEL SIGN O, OO, AU (above)
59  (0x0C4D        ?H)                     ; SIGN VIRAMA (HALANT)
60  (0x0C55        ?u)                     ; LENGTH MARK (above)
61  (0x0C56        ?b)                     ; AI LENGTH MARK (below)
62  (0x0C60 0x0C61 ?V)                     ; LETTER VOCALIC RR, LL
63  (0x0C7E        ?Y)                     ; internal use
64  (0x0C7F        ?X)                     ; internal use
65  )
66
67 ;; Step 1 : Syllable identification and Halant movement.
68 (generator
69  (0
70   (cond
71    ;; A syllable containing a two-part vowel sign.
72    ("([CR](HC)*)(t)(a)?"
73     < | (1 move-base-Halant) (3 0x0C46 0x0C56) (4 =) | >)
74
75    ;; A syllable ending with vowel signs and/or a vowel modifier.
76    ("([CR](HC)*)([ubp]+a?|a)"
77     < | (1 move-base-Halant) (3 = *) | >)
78
79    ;; Forced Halant form
80    ("((RH)?(CH)*)(CH)N"
81     (1 < | move-base-Halant | >)
82     (4 < | move-base-Halant | >))
83
84    ;; Forced Below form
85    ("((RH)?(CH)*)(CH)J"
86     (1 < | move-base-Halant >)
87     (4 < | otf:telu=blwf | >))
88
89    ;; A syllable without a vowel sign nor a vowel modifier.
90    ("[CR](HC)*H?"
91     < | move-base-Halant | >)
92
93    ;; A syllable starting with an independent vowel.
94    ("Va?"
95     < | = * | > )
96
97    ("." =))
98   *)
99
100  ;; Move Halant on the base consonant to the tail if the syllable ends
101  ;; with a consonant.
102  ;; A leading 0x0C7F means Halant movement.
103  ;; A leading 0x0C7E means a syllable ending with a Halant.
104  (move-base-Halant
105   (cond
106    (".*H$"
107     0x0C7E = *)
108    ("(.)(H)(.*)"
109     0x0C7F (1 =) (3 = *) (2 =))
110    (".*"
111     = *))))
112
113 ;; Step 2 : Move Matra if applicable.
114 ;; The base consonant in a Halant-ending syllable is changed into Halant form.
115 (generator
116  (0
117   (cond
118    ;;  1  2      3   4   5   6
119    (" X(.)([CH]*)(u)?(b)?(p)?(a)? "
120     | (1 =) (3 =) (4 =) (5 =) (2 = *) (6 =) |)
121    (" Y(..)([^ ]*) "
122     | (1 otf:telu=haln) (2 = *) |)
123    ("." =))
124   *))
125
126 ;; Step 3 : Drive OTF tables.
127 (generator
128  (0
129   (cond
130    (" ([^ ]*) "
131     (1 otf:telu))
132    ("."
133     [ otf:telu=+ ]))
134   *))
135
136 ;; Local Variables:
137 ;; mode: emacs-lisp
138 ;; End: