1 ;; MLYM-OTF.flt -- Font Layout Table for Malayalam OpenType font
2 ;; Copyright (C) 2003, 2004, 2005, 2007
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., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
26 ;;; For Malayalam OpenType fonts to draw the reformed Malayalam script.
28 (font layouter mlym-otf nil
29 (font (nil nil unicode-bmp :otf=mlym=blwf)))
32 ;; C: consonant (except for R, B, and P)
34 ;; B: consonant (below)
35 ;; P: consonant (post)
37 ;; m: vowel sign (pre)
38 ;; p: vowel sign (post)
39 ;; A: vowel modifier (post)
40 ;; V: independent vowel
41 ;; N: ZWNJ (ZERO WIDTH NON-JOINER)
42 ;; J: ZWJ (ZERO WIDTH JOINER)
45 (0x0D00 0x0D7F ?X) ; generic
46 (0x0D00 ?Z) ; internal use
47 (0x0D02 0x0D03 ?A) ; SIGN ANUSVARA .. VISARGA
48 (0x0D05 0x0D14 ?V) ; LETTER A .. LETTER AU
49 (0x0D15 0x0D39 ?C) ; LETTER KA .. LETTER HA
50 (0x0D2F ?P) ; LETTER YA
51 (0x0D30 ?R) ; LETTER RA
52 (0x0D32 ?B) ; LETTER LA
53 (0x0D35 ?P) ; LETTER VA
54 (0x0D3E 0x0D43 ?p) ; VOWEL SIGN AA .. VOCALIC R
55 (0x0D46 0x0D48 ?m) ; VOWEL SIGN E .. AI
56 (0x0D4D ?H) ; SIGN VIRAMA
57 (0x0D57 ?p) ; AU LENGTH MARK
58 (0x0D60 0x0D61 ?V) ; LETTER VOCALIC RR .. VOCALIC LL
59 (0x0964 0x0965 ?X) ; DANDA .. DOUBLE DANDA
64 ;; Decompose two-part vowels.
77 ;; Syllable identification and reordering.
78 ;; Put the mark 0x0D00 before the first pre-base consonant and after
79 ;; the base consonant.
83 ;; A syllable with a left vowel sign.
85 ("([CRBP](H[CRBP])*)(m)(p?A?)"
86 < | (3 =) (1 get-rh) 0x0D00 (1 move-h) (4 = *) | >)
88 ;; A syllable with a right vowel sign and/or a vowel modifier.
90 ("([CRBP](H[CRBP])*)(pA?|A)"
91 < | (1 get-rh) 0x0D00 (1 move-h) (3 = *) | >)
93 ;; Explicit Halant / forced chillu form is cut off from the preceders.
94 ("(([CRBP]H)*)([CRBP]H[NJ])"
95 (1 cut-off) (3 < | = * | >))
97 ;; A syllable with no vowel signs/modifiers.
98 ("([CRBP](H[CRBP])*H?)"
99 < | (1 get-rh) 0x0D00 (1 move-h) | >)
101 ;; Starting with an independent vowel.
108 ;; Extract RH that will be moved to the left.
114 ;; Move the halant after the base consonant to the end.
115 ;; Fill the resulting gap with 0x0D00.
116 ;; Remove final RH if any.
119 ;; There is a C and the syllable ends with an R. Remove final RH.
120 ("([CRBPH]*C)H([RBPH]*)R$"
121 (1 = *) 0x0D00 (2 = *))
123 ;; The syllable ends other than R. Move H.
124 ("([CRBPH]*C)(H)([RBPH]+)$"
125 (1 = *) 0x0D00 (3 = *) (2 =))
127 ;; No C and end with R. The first consonant will be the base. Remove RH.
128 ("([RBP])H([RBPH]*)R$"
129 (1 =) 0x0D00 (2 = *))
131 ;; No C and not end with R. Move H.
132 ("([RBP])(H)([RBPH]+)$"
133 (1 =) 0x0D00 (3 = *) (2 =))
135 ;; Otherwise, no need to move H.
139 ;; If there are some letters make them a separate syllable.
146 ;; Apply GSUB features.
147 ;; According to Microsoft Typography
148 ;; <http://www.microsoft.com/typography/otfntdev/malayot/features.htm>
149 ;; 'chillu' are generated with the 'haln' feature. However, some
150 ;; fonts generate them with 'half'.
154 ;; Ordinary syllable. We must avoid applying 'blwf' and 'pstf' to
155 ;; the first consonant. Also 'haln' and 'half' must be avoided
156 ;; because chillu does not appear at the beginning of a word. Thus
157 ;; we apply only 'akhn' here and postpone applying other features
158 ;; to the next stage.
160 (" (m?(RH)?Z)([CRBPH]+)(Z)([RBPHpA]*) "
161 | (1 = *) (3 otf:mlym=akhn+) (4 =)
162 (5 otf:mlym=blwf,pstf+) |)
168 ;; Forced chillu form.
170 | (1 otf:mlym=haln,half+) (2 =) |)
172 ;; Sequence that was cut off from a forced form. Again we apply
175 | (1 otf:mlym=akhn+) |)
180 ;; Apply postoponed GSUB features to ordinary syllables.
184 ;; Ordinary syllable.
186 (" (m?(RH)?Z[^Z])([^Z]*)(Z[^ ]*) "
187 | (1 = *) (3 otf:mlym=blwf,half,pstf,haln+) (4 = *) |)
189 ;; Explicit Halant / Forced chillu must not change to others.
195 | (1 =) (2 otf:mlym=blwf,half,pstf,haln+) |)
200 ;; Second reordering. If there are glyphs before the base, move left
201 ;; vowel sign and RH to the left of the base.
206 (" (m)?(RH)?Z([^Z]*)([^Z])Z([^ ]*) "
207 | (3 = *) (1 =) (2 otf:mlym=pstf+) (4 =) (5 = *) |)
212 ;; Apply substitutions and GPOS features.
217 (1 otf:mlym=pres,abvs,blws,psts+abvm,blwm,dist))