New file.
[m17n/m17n-db.git] / SINH-OTF.flt
1 ;; SINH-OTF.flt -- Font Layout Table for Sinhala OpenType fonts
2 ;; Copyright (C) 2004, 2005
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> SINH-OTF.flt
25 ;;;
26 ;;; For Sinhala OpenType fonts to draw Sinhala.
27 ;;; A Font is available from <http://sinhala.linux.lk/>.
28
29 (category
30  ;; V : independent vowels
31  ;; C : consonants
32  ;; R : RA
33  ;; H : AL-LAKUNA (virama)
34  ;; m : pre-consonant vowel signs
35  ;; b : below-consonant vowel signs
36  ;; u : above-consonant vowel signs
37  ;; p : post-consonant vowel signs
38  ;; q : AELA-PILLA
39  ;; r : GAYANUKITTA
40  ;; s : KOMBUVA HAA AELA-PILLA
41  ;; t : two-part vowel sign
42  ;; a : AVUSVARAYA & VISARGAYA
43  ;; E : else
44  ;; J : ZERO WIDTH JOINER
45  (0x0D80 0x0DFF ?E)
46  (0x0D82 0x0D83 ?a)
47  (0x0D85 0x0D96 ?V)
48  (0x0D96 0x0DC6 ?C)
49  (0x0DBB        ?R)
50  (0x0DCA        ?H)
51  (0x0DCF        ?q)
52  (0x0DD0 0x0DD1 ?p)
53  (0x0DD2 0x0DD3 ?u)
54  (0x0DD4 0x0DD6 ?b)
55  (0x0DD8        ?p)
56  (0x0DD9        ?m)
57  (0x0DDA        ?t)
58  (0x0DDB        ?M)
59  (0x0DDC        ?s)
60  (0x0DDD 0x0DDE ?t)
61  (0x0DDF        ?r)
62  (0x0DF2 0x0DF3 ?p)
63  (0x200D        ?J)
64  )
65
66 ;; Step 0 : Syllable identification
67 (generator
68
69  (0
70   (cond
71    ;; A syllable containing a completely decomposed two-part vowel sign.
72    ("(C(HJ[CR])*)(m(H|qH?|r)a?)"
73     < | (1 otf:sinh=akhn,vatu,pres) (3 = *) | >)
74
75    ;; A syllable containing KOMBUVA HAA AELA-PILLA.
76    ("(C(HJ[CR])*)(s)(H)?(a)?"
77     < | (1 otf:sinh=akhn,vatu,pres) (3 two-part) (4 =) (5 =) | >)
78
79    ;; A syllable with a two-part vowel sign.
80    ("(C(HJ[CR])*)(t)(a)?"
81     < | (1 otf:sinh=akhn,vatu,pres) (3 two-part) (4 =) | >)
82
83    ;; A syllable with a vowel sign and/or a various sign.
84    ("(C(HJ[CR])*)([mMbupqr]a?|a)"
85     < | (1 otf:sinh=akhn,vatu,pres) (3 = *) | >)
86
87    ;; No signs.
88    ("C(HJ[CR])*H?"
89     < | otf:sinh=akhn,vatu,pres | >)
90
91    ;; Suppress repaya explicitly.
92    ("Rm(H|qH?|r)a?"
93     < | = * | >)
94    ("(R)(s)(H)?(a)?"
95     < | (1 =) (2 two-part) (3 =) (4 =) | >)
96    ("(R)(t)(a)?"
97     < | (1 =) (2 two-part) (3 =) | >)
98    ("R([mMbupqr]a?|a)"
99     < | = * | >)
100    ("RHJ?"
101     < | = = | >)
102
103    ;; Independent vowels.
104    ("Va?"
105     < | = * | >)
106
107    ("." =))
108   *)
109
110  ;; Split two-part dependent vowel signs for canonicalisation.
111  (two-part
112   (cond
113    ((0x0DDA)    0x0DD9 0x0DCA)
114    ((0x0DDC)    0x0DD9 0x0DCF)
115    ((0x0DDD)    0x0DD9 0x0DCF 0x0DCA)
116    ((0x0DDE)    0x0DD9 0x0DDF)))
117  )
118
119 ;; Step 1 : Move pre-consonant signs.
120 (generator
121  (0
122   (cond
123    ;; 1             2     3   4   5   6   7   8   9
124    (" ([^ mMbupqr]+)(m|M)?(b)?(u)?(p)?(q)?(r)?(H)?(a)? "
125     | (2 =) (1 = *) (3 =) (4 =) (5 =) (6 =) (7 =) (8 =) (9 =) |)
126    ("." =))
127   *))
128
129 ;; Step 2 : OTF substitutions.
130 (generator
131  (0
132   (cond
133    (" ([^ ]*) "
134     (1 otf:sinh))
135    ("."
136     [ otf:sinh=+ ]))
137   *))
138
139 ;; Local Variables:
140 ;; mode: emacs-lisp
141 ;; End: