Fix forced-*-form patterns.
[m17n/m17n-db.git] / MYANMAR-ZEDI.flt
1 ;; MYANMAR-ZEDI.flt -- Font Layout Table for Myanmar (Zedi font)
2 ;; Copyright (C) 2004
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., 59 Temple Place, Suite 330, Boston, MA
22 ;; 02111-1307, USA.
23
24 ;;; <li> MYANMAR-ZEDI.flt
25 ;;;
26 ;;; For the Myanmar Zedi family fonts to draw Myanmar script.
27 ;;; <ul>
28 ;;; <li> infopage: http://www.myazedi.com/downloads/MyaZedi_M17N.ttf
29 ;;; </ul>
30
31 ;; 1st stage
32 ;; Extract syllable while detecting Kinzi, substituting subscripts,
33 ;; and removing Halants.
34
35 (category
36  (0x1000 0x107F ?O)                     ; other
37  (0x1000 0x1021 ?C)                     ; consonant except for c and K
38  (0x1000 0x1003 ?c)                     ; consonant that has subscript form
39  (0x1004        ?K)                     ; consonant NGA
40  (0x1005 0x1007 ?c)
41  (0x100B 0x100C ?c)
42  (0x100F 0x1019 ?c)
43  (0x1014        ?n)                     ; consonant NA
44  (0x101C        ?c)
45  (0x101A 0x101B ?M)                     ; cosonant that may be used as Medial
46  (0x101D        ?M)
47  (0x101F        ?M)
48  (0x1021 0x102A ?I)                     ; independent vowel
49  (0x102C 0x1032 ?V)                     ; dependent Vowel
50  (0x1036        ?A)                     ; sign ANUSVARA
51  (0x1037 0x1038 ?S)                     ; other sign
52  (0x1039        ?H)                     ; HALANT (VIRAMA)
53  (0x200C        ?N)                     ; ZWNJ (Zero Width Non Joiner)
54  )
55
56 (generator
57  (0
58   (cond
59    ;; The following regular expression matches a syllable pattern
60    ;; described in Table 10-3 of the Unicode Standard 4.0 .
61    ;;<1-> <--------2--------><--4--><--6--->  <7->
62    ;;             <---3--->   <5->
63    ("(KH)?([CcnKM](H[CcnK])?)((HM)*)(V*A?H?)N?(S*)"
64     | < (1 0xE390) (2 consonant) (4 remove-halant *) (6 = *) (7 = *) > |)
65    ;; Fixme: I'm not sure about the syllable pattern for an
66    ;; independent vowel.
67    ("IV*[AS]*"
68     | < = * > |)
69    ;; Treat anything else as a single character.
70    ("."
71     [ = ]))
72   *)
73
74  (consonant
75   (cond
76    ((0x100B 0x1039 0x100C) 0xE10C)
77    ((0x100D 0x1039 0x100D) 0xE00D)
78    ((0x100E 0x1039 0x100D) 0xE10D)
79    ((0x100F 0x1039 0x100D) 0xE20D)
80    ((0x1014 0x1039 0x1010) 0xE140 0xE010)
81    ((0x101E 0x1039 0x101E) 0xE01E)
82    ("(n)H(c)" 0xE140 (2 subscript))
83    ("(.)H(c)" (1 =) (2 subscript))
84    ("(.)H(.)" (1 =) (2 =))
85    ("." =)))
86
87  (subscript
88   (cond ((range 0x1000 0x101c) 0xE000)))
89
90  (remove-halant
91   (cond
92    ((0x1039))
93    ("." =))))
94
95 ;; 2nd stage
96 ;; Handle medials.
97
98 (category
99  (0x1000 0x107F ?O)                     ; other
100  (0x1000 0x1021 ?W)                     ; wide consonant
101  (0x1001 0x1002 ?S)                     ; single-width consonant
102  (0x1004 0x1005 ?S)
103  (0x1007 0x1008 ?S)
104  (0x100B 0x100E ?S)
105  (0x1012 0x1017 ?S)
106  (0x1019        ?S)
107  (0x101A        ?a)                     ; medial Ya
108  (0x101B        ?b)                     ; medial Ra
109  (0x101D        ?d)                     ; medial Wa
110  (0x101F        ?f)                     ; medial Ha
111  (0x1020        ?S)
112  (0x102D 0x102E ?V)                     ; dependent vowel (upper)
113  (0x1032        ?V)
114  (0x200C        ?N)                     ; ZWNJ
115  (0xE000 0xE3FF ?O)
116  (0xE000 0xE01E ?w)                     ; wide subscript
117  (0xE001 0xE002 ?s)                     ; single-width subscript
118  (0xE005        ?s)
119  (0xE007        ?s)
120  (0xE00B        ?s)
121  (0xE012 0xE017 ?s)
122  (0xE019        ?s)
123  (0xE10C 0xE10D ?s)
124  (0xE140        ?s)
125  (0xE20D        ?w)
126  (0xE390        ?K)                     ; Kinzi
127  )
128
129 (generator
130  (0
131   (cond
132    (" (K)?([WSabdfws][WSKws]?[abdf]*[^ ]*) "
133     | (1 =) (2 medial = *) |)
134    (" ([^ ]*) "
135     = *)
136    ("."
137     =))
138   *)
139
140  (medial
141   (cond
142    ;; Medial Ya (U+101A)
143    ("(..?)adf"  (1 = *) 0xE1A2)
144    ("(..?)ad"   (1 = *) 0xE1A4)
145    ("(..?)af"   (1 = *) 0xE1A3)
146    ("(..?)a"    (1 = *) 0xE1A3)
147
148    ;; Medial Ra (U+101B)
149    ;; Fixme: Don't work well with a single-width consonant and a wide
150    ;; subscript sequence,
151    ("([Waf]|.[Ww])bdf"  0xE1BA (1 = *))
152    ("(..?)bdf"          0xE1B9 (1 = *))
153    ("([Waf]|.[Ww])bd"   0xE1B8 (1 = *))
154    ("(..?)bd"           0xE1B7 (1 = *))
155    ("([Waf]|.[Ww])b(V)" 0xE1B6 (1 = *) (2 =))
156    ("(..?)b(V)"         0xE1B5 (1 = *) (2 =))
157    ("([Waf].|.[Ww])b"   0xE1B4 (1 = *))
158    ("(s|..)b"           0xE1B3 (1 = *))
159    ("([Waf])b"          0xE1B2 (1 = *))
160    ("(.)b"              0xE1B1 (1 = *))
161    
162    ;; Medial Wa (U+101D)
163    ("(..?)df"   (1 = *) 0xE1D1)
164    ("(..?)d"    (1 = *) 0xE01D)
165
166    ;; Medial Ha (U+101F)
167    ((0x100A 0x101F)     0x100A 0xE1F3)
168    ("(..?)f"    (1 = *) 0xE1F1))))
169
170 ;; 3rd stage
171 ;; Reorder Kinzi and Vowel E.  Handle Kinzi-vowel combination.
172
173 (category
174  (0x1000 0x107F ?O)
175  (0x1000 0x1021 ?C)
176  (0x1001 0x1002 ?c)
177  (0x1004        ?c)
178  (0x1013        ?c)
179  (0x1015        ?c)
180  (0x101D        ?c)
181  (0x1008        ?b)
182  (0x100A 0x100D ?b)
183  (0x1020        ?b)
184  (0x1025        ?b)
185  (0x102C        ?A)                     ; Vowel AA
186  (0x102D        ?i)                     ; Vowel I
187  (0x102E        ?I)                     ; Vowel II
188  (0x102F        ?u)                     ; Vowel U
189  (0x1030        ?U)                     ; Vowel UU
190  (0x1031        ?e)                     ; Vowel E
191  (0x1032        ?V)                     ; Vowel AI
192  (0x1036 0x1038 ?D)
193  (0x1039        ?H)
194  (0x200C        ?N)
195  (0xE000 0xE3FF ?O)
196  (0xE000 0xE01D ?b)
197  (0xE1A1 0xE1B8 ?b)
198  (0xE390        ?K)                     ; Kinzi
199 )
200
201 (generator
202  (0
203   (cond
204    (" K([Ccb]*)(e)([^ ]*) "
205     | (2 =) (1 = *) (3 kinzi-vowel = *) |)
206    (" K([Ccb]*)([^ ]*) "
207     | (1 = *) (2 kinzi-vowel = *) |)
208    (" ([Ccb]*)(e)([^ ]*) "
209     | (2 =) (1 = *) (3 = *) |)
210    (" ([^ ]*) "
211     = *)
212    ("."
213     =))
214   *)
215
216  (kinzi-vowel
217   (cond
218    ((0x102D) 0xE391)
219    ((0x102E) 0xE391)
220    ((0x1036) 0xE393)
221    0xE390)))
222
223 ;; 4th stage
224 ;; Various glyph substitions.
225
226 (generator
227  (0
228   (cond
229    (" ([^ ]*) "
230     (1
231      (cond
232       ;; Consonant substituion.
233       ((0x1009 0x1039) 0xE009 0x1039)
234       ((0x1009 0xE005) 0xE109 0xE005)
235       ((0x101B 0x102F) 0xE01B 0x102F)
236
237       ;; Sign substituion.
238       ((0x1014 0x1037) 0x1014 0xE037)
239       ((0x101B 0x1037) 0x101B 0xE137)
240
241       ;; Vowel substituion.
242       ("(c)AH"  (1 =) 0xE02D)
243       ("(c)A"   (1 =) 0xE02C)
244       ((0x102D 0x1036) 0xE2D1)
245       ("(b)u"   (1 =) 0xE2F1)
246       ("(b)U"   (1 =) 0xE2F2)
247       ("." =))
248      *))
249    ("."
250     =))
251   *))
252
253 ;; Local Variables:
254 ;; mode: lisp
255 ;; coding: utf-8
256 ;; End: