1 ;; MLYM-OTF.flt -- Font Layout Table for Malayalam OpenType font
2 ;; Copyright (C) 2003, 2004, 2005
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 the 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
68 (0x0D7D ?x) ; marker inserted before base-C
69 (0x0D7E ?y) ; marker inserted after base-C
70 (0x0D7F ?z) ; marker inserted before last Ra
73 ;; The 1st stage 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 ("(RH)?(.)H(.*)$" ; No Cbase, move the first
118 ; Halant to the tail.
119 (1 = *) 0x0D7D (2 = ) 0x0D7E (3 = *) 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 2nd stage is to apply GSUB for prebase part.
136 ;; Originally [CBPR]H is followed by ZWNJ. Apply no feature (just
141 ;; Originally [CBPR]H is followed by ZWJ. Apply only GSUB haln
146 ;; Syllable starting with a consonant should match this pattern.
147 (" ([^ y]*)y([^ z]*)(z..)?([^ ]*) "
149 (1 otf:mlym=~blwf,~pstf,~blws,~psts,*+) ; Prebase part.
150 0x0D7E ; Preserve this marker.
151 (2 = *) ; Postbase part.
152 (3 = *) ; Optional tailing RH.
153 (4 = *) ; Optional Mpost.
156 ;; A syllable starting with an independent vowel.
160 ;; Any other independent character. Apply no feature (just cmap).
165 ;; The 3rd stage is to move Mpre (if any) and tailing RH (if any)
166 ;; forward to just before the base consonant.
170 (" ([^x]*)(.)xy([^ zm]*)(z(..))?(m)?([^ ]*) "
171 | (1 = *) (4 (5 otf:mlym=pstf+)) (6 =) 0x0D7D (2 =) (3 = *) (7 = *) |)
172 (" ([^x]*)x(.)y([^ zm]*)(z(..))?(m)?([^ ]*) "
173 | (1 = *) (4 (5 otf:mlym=pstf+)) (6 =) 0x0D7D (2 =) (3 = *) (7 = *) |)
174 (" xy([^ m]*)(m)?([^ ]*) "
175 | (2 =) 0x0D7D (1 = *) (3 = *) |)
181 ;; The 4th stage is to apply GSUB to postbase part.
186 | (1 = *) (2 otf:mlym=haln) |)
188 | (1 = *) (2 otf:mlym=~akhn,~haln,blwf,pstf,vatu,*+) |)
194 ;; The 5th (last) stage is to apply GPOS features.
198 (" ([^ ]*) " (1 otf:mlym=))