1 ;; MLM-OTF.flt -- Font Layout Table for Malayalam OpenType font
2 ;; Copyright (C) 2003, 2004
3 ;; National Institute of Advanced Industrial Science and Technology (AIST)
4 ;; Registration Number H15PRO112
6 ;; This file is part of the m17n database; a sub-part of the m17n
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.
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.
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
26 ;;; For Malayalam OpenType fonts to draw reformed Malayalam script.
28 ;; The first stage is to extract a syllable and re-order characters.
30 ;; C: consonant (except for BPR)
31 ;; B: consonant that is the subject of "blws" feature
32 ;; P: consonant that is the subject of "pstf" feature
37 ;; t: MATRA (two-part: Mpre+Mpost)
38 ;; A: vowel modifier (post) (ANUSVARA and VISARGA)
39 ;; V: independent vowel
40 ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
41 ;; J: ZWJ (ZERO WIDTH JOINER)
42 ;; E: else (all other independnt characters)
43 (0x0D00 0x0D7F ?E) ; else
44 (0x0D02 0x0D03 ?A) ; ANUSVARA & VISARGA
45 (0x0D05 0x0D14 ?V) ; independent vowel
46 (0x0D15 0x0D39 ?C) ; consonant
48 ;; Accorind to www.microsoft.com/typography/otfntdev/indicot/appen.htm,
49 ;; these must be classified into 'B' category, but at least, it
50 ;; doesn't work with this font
51 ;; http://www.supersoftweb.com/THOOLIUC.TTF
59 (0x0D3E 0x0D43 ?p) ; dependent vowel (Mpost)
60 (0x0D46 0x0D48 ?m) ; dependent vowel (Mpre)
61 (0x0D4A 0x0D4C ?t) ; dependent vowel (two-part)
62 (0x0D4D ?H) ; VIRAMA (HALANT)
63 (0x0D57 ?p) ; dependent vowel (Mpost)
64 (0x0D60 ?V) ; VOCALIC RR
65 (0x0D61 ?V) ; VOCALIC LL
73 ;; The first step is to extract a syllable while moving a Halant
74 ;; following Cbase to the tail and partitioning two-part matras into
79 ;; If [CR]H is followed by ZWNJ/ZWJ, move ZWNJ/ZWJ) to the head so
80 ;; that the later stages find it quickly.
82 < | (2 =) (1 = =) | >)
84 ;; A syllable starting with a consonant and ending with a vowel
85 ;; and/or a vowel modifier.
86 ("(([CBPR]H)*[CBPR])([pmt]A?|A)"
87 < | (1 move-halant) (3 partition = =) | >)
89 ;; A syllable starting with a consonant and ending without a vowel
90 ;; nor a vowel modifier.
91 ("(([CBPR]H)*[CBPR])(H)?"
92 < | (1 move-halant) (3 =) | >)
94 ;; A syllable starting with an independent vowel.
98 ;; Other independent character.
102 ;; Move Halant to the tail if necessary. Insert 0x0D7D before Cbase,
103 ;; 0x0D7E after Cbase, 0x0D7F before the tailing RH (if any). They
104 ;; work as markers in the following stages.
107 ;; In the first two cases, we don't have to move Halant.
108 ("[BPR]$" ; Single consonant.
110 ("(([CBPR]H)*)(C)$" ; Cbase is at tail.
111 (1 = *) 0x0D7D (3 =) 0x0D7E)
112 ;; In the following cases, we must move Halant to the tail.
113 ("(([CBPR]H)*)([C])H(([BR]H)*)(R)$" ; Cbase is at head or middle.
114 (1 = *) 0x0D7D (3 =) 0x0D7E (4 = *) 0x0D7F 0x0D30 0x0D4D)
115 ("(([CBPR]H)*)([C])H(([BR]H)*[BP])$" ; Cbase is at head or middle.
116 (1 = *) 0x0D7D (3 =) 0x0D7E (4 = *) 0x0D4D)
117 ("(.)H(.*)$" ; No Cbase, move the first
118 ; Halant to the tail.
119 0x0D7D 0x0D7E (1 = *) (2 = *) 0x0D4D)))
121 ;; Partition two-part matras into parts.
124 ((0x0D4A) 0x0D46 0x0D3E)
125 ((0x0D4B) 0x0D47 0x0D3E)
126 ;; Unicode suggests this partitioning:
127 ((0x0D4C) 0x0D46 0x0D57)
128 ;; but it is questionable. Perhaps, this substitution is better.
132 ;; The second stage is to move Mpre to the head.
138 (" ([^m ]*)(m)([^ ]*) "
139 | (2 =) (1 = *) (3 = *) |)
145 ;; The third stage is to drive OTF tables.
149 ;; Originally [CBPR]H is followed by ZWNJ. Apply only GPOS
150 ;; features (if any).
154 ;; Originally [CBPR]H is followed by ZWJ. Apply only GSUB haln
155 ;; feature and GPOS features (if any).
159 ;; Syllable starting with a consonant should match this pattern.
160 (" ([^ y]*)y([^ z]*)(z..)?([^ ]*) "
162 (1 otf:mlym=~blwf,~pstf,~blws,~psts,*) ; Prebase part.
163 0x0D7E ; Preserve this marker.
164 (2 otf:mlym=~akhn,~haln,blwf,pstf,vatu,*) ; Postbase part.
165 (3 = otf:mlym=pstf) ; Optional tailing RH.
166 (4 otf:mlym=) ; Optional Mpost.
169 ;; A syllable starting with an independent vowel.
173 ;; Any other independent character. Apply no feature (just CMAP).
178 ;; The last stage is to move Mpre (if any) backward and tailing RH (if
179 ;; any) forward to just before the base consonant.
183 (" (m)?([^xy]*)x([^y]*)y([^ z]*)(z(.))?([^ ]*) "
184 (2 = *) (1 =) (5 (6 =)) (3 = *) (4 = *) (7 = *))
185 (" (m)?([^y]*)y([^ z]*)(z(.))?([^ ]*) "
186 (1 =) (4 (5 =)) (2 = *) (3 = *) (6 = *))