(state:state-LVT-or-LVTL): Add backspace branch.
[m17n/m17n-db.git] / FLT / TAML-OTF.flt
1 ;; TAML-OTF.flt -- Font Layout Table for Tamil OpenType fonts
2 ;; Copyright (C) 2004, 2006, 2007, 2010 AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter taml-otf nil
6       (version "1.6.0")
7       (font (nil nil unicode-bmp :otf=taml)))
8
9 ;;; <li> TAML-OTF.flt
10 ;;;
11 ;;; For Tamil OpenType fonts to draw the Tamil script.
12
13 (category
14  ;; X: generic
15  ;; a: ANUSVARA
16  ;; V: independent vowel
17  ;; C: consonant
18  ;; H: HALANT
19  ;; m: vowel sign (pre)
20  ;; p: vowel sign (others)
21  (0x0B80 0x0BFF ?X)                     ; generic
22  (0x0B82        ?a)                     ; SIGN ANUSVARA
23  (0x0B85 0x0B94 ?V)                     ; LETTER A .. AU
24  (0x0B95 0x0BB9 ?C)                     ; LETTER KA .. HA
25  (0x0BBE 0x0BC2 ?p)                     ; VOWEL SIGN AA .. I
26  (0x0BC6 0x0BC8 ?m)                     ; VOWEL SIGN E .. AI
27  (0x0BCD        ?H)                     ; SIGN VIRAMA
28  (0x0BD7        ?p)                     ; AU LENGTH MARK
29
30  (0x200C        ?N)                     ; ZWNJ
31  (0x200D        ?J)                     ; ZWJ
32  (0x25CC        ?X)                     ; DOTTED CIRCLE
33  )
34
35 ;; Stage 0
36 ;; Preprocessing
37 (generator
38  (0
39   (cond
40    ;; Decompose two-part vowel signs.
41    ((0x0BCA)
42     0x0BC6 0x0BBE)
43    ((0x0BCB)
44     0x0BC7 0x0BBE)
45    ((0x0BCC)
46     0x0BC6 0x0BD7)
47
48    ;; A variation of AU.
49    ((0x0B92 0x0BD7)
50     0x0B94)
51
52    ;; The SHRII ligature and its old definition
53    ((0x0BB6 0x0BCD 0x0BB0 0x0BC0)
54     (0 :otf=taml=akhn,half,pres,abvs,blws,psts,haln+))
55    ((0x0BB8 0x0BCD 0x0BB0 0x0BC0)
56     (0 :otf=taml=akhn,half,pres,abvs,blws,psts,haln+))
57
58    ("." =))
59   *))
60
61 ;; Stage 1
62 ;; Syllable identification
63 (generator
64  (0
65   (cond
66    ;; Consonant-based syllables
67    ;;1 23            4
68    ("(C((J?H|HJ?)C)*)(H[NJ]?|m?p?a?)"
69     < |
70     (cond
71      (".+HJ$" :otf=taml=nukt,akhn+)
72      ("(.+)(H)N?$" (1 :otf=taml=nukt,akhn+) (2 =) 0x200C)
73      (".+" :otf=taml=nukt,akhn+))
74     | >)
75
76    ;; Syllables with an independent vowel
77    ("Vm?p?a?"
78     < | = * | >)
79
80    ;; Two-part vowel signs
81    ((0x0BC6 0x0BBE)
82     (cond
83      ((font-facility 0x25CC) < = 0x25CC = >)
84      (".+" [ 0x0BCA ])))
85    ((0x0BC7 0x0BBE)
86     (cond
87      ((font-facility 0x25CC) < = 0x25CC = >)
88      (".+" [ 0x0BCB ])))
89    ((0x0BC6 0x0BD7)
90     (cond
91      ((font-facility 0x25CC) < = 0x25CC = >)
92      (".+" [ 0x0BCC ])))
93
94    ;; Combining marks are displayed with a DOTTED CIRCLE.
95    ("m"
96     (cond
97      ((font-facility 0x25CC) < = 0x25CC >)
98      ("." [ = ])))
99    ("[Hpa]"
100     (cond
101      ((font-facility 0x25CC) < 0x25CC = >)
102      ("." [ = ])))
103
104    ("." =))
105   *))
106
107 ;; Stage 2
108 ;; Move pre-base matra after the last halant, or to the beginning
109 (generator
110  (0
111   (cond
112    ;; 1         2       3  4
113    (" ([^ ]+HJ?)([^H ]+)(m)([^ ]*) "
114     | (1 = *) (3 =) (2 = *) (4 = *) |)
115
116    ;; 1      2  3
117    (" ([^ ]+)(m)([^ ]*) "
118     | (2 =) (1 = *) (3 = *) |)
119
120    ("." =))
121   *))
122
123 ;; Stage 3
124 ;; Presentation forms
125 (generator
126  (0
127   (cond
128    (" ([^ ]+) "
129     | (1 :otf=taml=pres,abvs,blws,psts,haln+) |)
130
131    ("." =))
132   *))
133
134 ;; Stage 4
135 ;; Remove ZWNJ/ZWJ
136 (generator
137  (0
138   (cond
139    ("[NJ]")
140
141    ("." =))
142   *))
143
144 ;; Stage 5
145 ;; GPOS processing
146 (generator
147  (0
148   (cond
149    (" ([^ ]+) "
150     (1 :otf=taml=+abvm,blwm,dist))
151
152    ("." =))
153   *))
154
155 ;; Copyright (C) 2004, 2006, 2007, 2010
156 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
157 ;;   Registration Number H15PRO112
158
159 ;; This file is part of the m17n database; a sub-part of the m17n
160 ;; library.
161
162 ;; The m17n library is free software; you can redistribute it and/or
163 ;; modify it under the terms of the GNU Lesser General Public License
164 ;; as published by the Free Software Foundation; either version 2.1 of
165 ;; the License, or (at your option) any later version.
166
167 ;; The m17n library is distributed in the hope that it will be useful,
168 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
169 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
170 ;; Lesser General Public License for more details.
171
172 ;; You should have received a copy of the GNU Lesser General Public
173 ;; License along with the m17n library; if not, write to the Free
174 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
175 ;; Boston, MA 02110-1301, USA.
176
177 ;; Local Variables:
178 ;; mode: emacs-lisp
179 ;; End: