1 ;; KHMR-OTF.flt -- Font Layout Table for Khmer OpenType fonts
2 ;; Copyright (C) 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 Khmer OpenType fonts to draw Khmer.
27 ;;; A Font is available from
28 ;;; <http://www.khmeros.info/drupal/?q=en/download/fonts>.
30 (font layouter khmr-otf nil
31 (font (nil nil unicode-bmp :otf=khmr=pres)))
34 (0x1780 0x17FF ?E) ; E: else
36 (0x1780 0x17B3 ?C) ; C: consonant & independent vowel
38 (0x17B6 ?p) ; p: vowel sign (post)
39 (0x17B7 0x17BA ?a) ; a: vowel sign (above)
40 (0x17BB 0x17BD ?b) ; b: vowel sign (below)
41 (0x17BE ?A) ; A: vowel sign (two-part, above)
42 (0x17BF 0x17C0 ?P) ; P: vowel sign (two-part, post)
43 (0x17C1 0x17C3 ?m) ; m: vowel sign (pre)
45 (0x17C6 ?s) ; s: sign (above)
46 (0x17C7 0x17C8 ?S) ; S: sign (post)
47 (0x17C9 0x17CA ?c) ; c: consonant shifter
49 (0x17CC ?r) ; r: ROBAT
50 (0x17D2 ?H) ; H: COENG
53 (0x200C ?N) ; N: ZERO WIDTH NON-JOINER
54 (0x200D ?J) ; J: ZERO WIDTH JOINER
57 ;; Generic syllable pattern is as follows.
58 ;; [CR](r|N?c)?(HCr?)*(HR)?(HCr?)*[NJ]?(m|b|a|A|p|P)?s*S?(H[CR])?
61 ;; Move m to the beginning.
63 ;; Exchange the order of pP and s.
64 ;; Move HR before the base.
72 ("([CR](r|N?c)?(HCr?)*)(HR(r)?)?((HCr?)*[NJ]?)(m)(s*S?(H[CR])?)"
73 < | (8 =) (4 = =) (1 = *) (5 =) (6 = *) (9 = *) | > )
75 ;; two-part above vowel sign
77 ("([CR](r|N?c)?(HCr?)*)(HR(r)?)?((HCr?)*[NJ]?As*S?(H[CR])?)"
78 < | 0x17C1 (4 = =) (1 = *) (5 =) (6 = *) | > )
81 ;;1 2 3 4 5 67 8 9 10 11
82 ("([CR](r|N?c)?(HCr?)*)(HR(r)?)?((HCr?)*[NJ]?)(p)(s*)(S?(H[CR])?)"
83 < | (4 = =) (1 = *) (5 =) (6 = *) (9 = *) (8 =) (10 = *) | > )
85 ;; two-part post vowel sign
86 ;;1 2 3 4 5 67 8 9 10 11
87 ("([CR](r|N?c)?(HCr?)*)(HR(r)?)?((HCr?)*[NJ]?)(P)(s*)(S?(H[CR])?)"
88 < | 0x17C1 (4 = =) (1 = *) (5 =) (6 = *) (9 = *) (8 =) (10 = *) | > )
90 ;; other vowel signs or no vowel sign
92 ("([CR](r|N?c)?(HCr?)*)(HR(r)?)?((HCr?)*[NJ]?[b|a]?s*S?(H[CR])?)"
93 < | (4 = =) (1 = *) (5 =) (6 = *) | > )
98 ;; Now a syllable looks like below.
99 ;; m?(HR)?[CR](r|N?c)?(HCr?)*[NJ]?(b|a|A)?s*(p|P)?S?(H[CR])?
102 ;; Set the form of consonant shifter.
107 ;; shifter + above vowel sign without ZWNJ
108 ;; Shifter take blwf. HR takes pref. HC's take blwf or pstf.
110 (" (m)?(HR)?([CR]c(HCr?)*(N|J)?(a|A))(s*S?)(H[CR])? "
114 (3 otf:khmr=blwf,abvf,pstf+)
116 (8 otf:khmr=blwf,pstf+)
119 ;; shifter + ZWNJ + above vowel sign, or, shifter without above vowel sign
120 ;; Shifter stays above. HR takes pref. HC's take blwf or pstf.
121 ;; 1 2 3 45 6 7 8 9 10 11
122 (" (m)?(HR)?([CR]N?c)((HCr?)*)([NJ]?[ba]?)(A)?(s*p?)(P)?(S)?(H[CR])? "
127 (4 otf:khmr=blwf,pstf+)
133 (11 otf:khmr=blwf,pstf+)
137 ;; 1 2 3 45 6 7 8 9 10 11
138 (" (m)?(HR)?([CR]r?)((HCr?)*)([NJ]?[ba]?)(A)?(s*p?)(P)?(S)?(H[CR])? "
143 (4 otf:khmr=blwf,pstf+)
149 (11 otf:khmr=blwf,pstf+)
155 ;; Now a syllable looks like below. ~ characters are OTF feature applied.
156 ;; m?(HR)?[CR](r|c)?(HCr?)*[NJ]?(b|a|A)?s*(p|P)?S?(H[CR])?
157 ;; ~~ ~~ ~ ~~~~ ~ ~ ~~~~~
160 ;; Concatenate adjacent Khmer syllables.
161 ;; Remove J. Retain N to prevent ligature.
172 ;; Apply other OTF features.
178 (1 otf:khmr=pres,blws,abvs,psts,clig))
184 ;; Remove N to clean up.