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