Add pres in step 5 for workaround.
[m17n/m17n-db.git] / MYMR-MYAZEDI.flt
1 ;; MYMR-MYAZEDI.flt -- Font Layout Table for Myanmar (Zedi font)
2 ;; Copyright (C) 2004, 2005
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> MYMR-MYAZEDI.flt
25 ;;;
26 ;;; For the Myanmar Zedi family fonts to draw Myanmar script.
27 ;;; <ul>
28 ;;; <li> download: 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, K, n, M
38  (0x1000 0x1003 ?c)                     ; consonant that has subscript form
39  (0x1004        ?K)                     ; consonant NGA
40  (0x1005 0x1008 ?c)
41  (0x100B 0x100C ?c)
42  (0x100F 0x1019 ?c)
43  (0xE014        ?c)
44  (0xE01B        ?c)
45  (0x1014        ?n)                     ; consonant NA
46  (0x101C        ?c)
47  ;; cosonants that can be a Medial
48  (0x101A        ?M)                     ; medial Ya
49  (0x101B        ?M)                     ; medial Ra 
50  (0x101D        ?M)                     ; medial Wa
51  (0x101F        ?M)                     ; medial Ha
52  (0x1021 0x102A ?I)                     ; independent vowel
53  (0x102C 0x1032 ?V)                     ; dependent Vowel
54  (0x1036        ?A)                     ; sign ANUSVARA
55  (0x1037 0x1038 ?S)                     ; other sign
56  (0x1039        ?H)                     ; HALANT (VIRAMA)
57  (0x200C        ?N)                     ; ZWNJ (Zero Width Non Joiner)
58  (0x200D        ?J)                     ; ZWJ (Zero Width Joiner)
59  )
60
61 (generator
62  (0
63   (cond
64    ;; The following regular expression matches a graphme cluster pattern
65    ;; described in Table 10-3 of the Unicode Standard 4.0 except for
66    ;; Kinzi which is encoded by the sequence "U+1004 U+1039 U+200D".
67    ;; 
68    ;;<-1-> <---------2--------><--4--><--6--->  <7->
69    ;;               <---3--->   <5->
70    ("(KHJ)([CcnKMr](H[CcnK])?)((HM)*)(V*A?H?)N?(S*)"
71     | < (1 0xE390) (2 consonant) (4 remove-halant *) (6 = *) (7 = *) > |)
72
73    ;; Irregular independent Kinzi
74    ("KHJ"
75     [ 0xE390 ])
76
77    ;; Cluster without Kinzi
78    ("([CcnKMr](H[CcnK])?)((HM)*)(V*A?H?)N?(S*)"
79     | < (1 consonant) (3 remove-halant *) (5 = *) (6 = *) > |)
80
81    ;; Fixme: I'm not sure about the syllable pattern for an
82    ;; independent vowel.
83    ("IV*[AS]*"
84     | < = * > |)
85
86    ;; Treat anything else as a single character.
87    ("."
88     [ = ]))
89   *)
90
91  (consonant
92   (cond
93    ((0x100B 0x1039 0x100C) 0xE10C)
94    ((0x100D 0x1039 0x100D) 0xE00D)
95    ((0x100E 0x1039 0x100D) 0xE10D)
96    ((0x100F 0x1039 0x100D) 0xE20D)
97    ((0x101E 0x1039 0x101E) 0xE01E)
98    ("(n)H([cn])" 0xE140 (2 subscript))
99    ("(.)H([cn])" (1 =) (2 subscript))
100    ("(.)H(.)" (1 =) (2 =))
101    ("." =)))
102
103  (subscript
104   (cond ((range 0x1000 0x101C) 0xE000)))
105
106  (remove-halant
107   (cond
108    ((0x1039))
109    ("." =))))
110
111 ;; 2nd stage
112 ;; Handle medials.
113
114 (category
115  (0x1000 0x107F ?O)                     ; other
116  (0x1000 0x1021 ?W)                     ; wide consonant
117  (0x1001 0x1002 ?S)                     ; single-width consonant
118  (0x1004 0x1005 ?S)
119  (0x1007 0x1008 ?S)
120  (0x100B 0x100E ?S)
121  (0x1012 0x1017 ?S)
122  (0x1019        ?S)
123  (0x101A        ?a)                     ; medial Ya
124  (0x101B        ?b)                     ; medial Ra
125  (0x101D        ?d)                     ; medial Wa
126  (0x101F        ?f)                     ; medial Ha
127  (0x1020        ?S)
128  (0x102D 0x102E ?V)                     ; dependent vowel (upper)
129  (0x1032        ?V)
130  (0x200C        ?N)                     ; ZWNJ
131  (0xE000 0xE3FF ?O)
132  (0xE000 0xE01E ?w)                     ; wide subscript
133  (0xE001 0xE002 ?s)                     ; single-width subscript
134  (0xE005        ?s)
135  (0xE007        ?s)
136  (0xE00B        ?s)
137  (0xE012 0xE017 ?s)
138  (0xE019        ?s)
139  (0xE10C 0xE10D ?s)
140  (0xE140        ?s)
141  (0xE20D        ?w)
142  (0xE390        ?K)                     ; Kinzi
143  )
144
145 (generator
146  (0
147   (cond
148    (" (K)?([WSabdfws][WSKws]?[abdf][abdf]*[^ ]*) "
149     | (1 =) (2 medial = *) |)
150    (" ([^ ]*) "
151     = *)
152    ("."
153     =))
154   *)
155
156  (medial
157   (cond
158    ;; Medial Ya (U+101A)
159    ("(..?)adf"  (1 = *) 0xE1A2)
160    ("(..?)ad"   (1 = *) 0xE1A4)
161    ("(..?)af"   (1 = *) 0xE1A3)
162    ("(..?)a"    (1 = *) 0xE1A1)
163
164    ;; Medial Ra (U+101B)
165    ("([Waf]|.[Ww])bdf"  0xE1BA (1 = *))
166    ("(..?)bdf"          0xE1B9 (1 = *))
167    ("([Waf]|.[Ww])bd"   0xE1B8 (1 = *))
168    ("(..?)bd"           0xE1B7 (1 = *))
169    ("([Waf]|.[Ww])b(f)?(V)"     0xE1B6 (1 = *) (2 0xE1F3) (3 =))
170    ("(..?)b(f)?(V)"             0xE1B5 (1 = *) (2 0xE1F3) (3 =))
171    ;; Single-width consonant + a wide subscript + Medial Ra.
172    ;; To use glyph E1B4, we must shift the single-width consonant to
173    ;; the right.
174    ("([Sd][Ww])b"       0xE1B4 Br>32Bl (1 = *))
175    ("([Waf].|.[Ww])b"   0xE1B4 (1 = *))
176    ("(s|..)b"           0xE1B3 (1 = *))
177    ("([Waf])b(f)?"      0xE1B2 (1 = *) (2 0xE1F3))
178    ("(.)b(f)?"          0xE1B1 (1 = *) (2 0xE1F3))
179    
180    ;; Medial Wa (U+101D)
181    ("(..?)df"           (1 = *) 0xE1D1)
182    ("(..?)d"            (1 = *) 0xE01D)
183
184    ;; Medial Ha (U+101F)
185    ((0x100A 0x101F)     0x100A 0xE1F3)
186    ("(..?)f"            (1 = *) 0xE1F1))))
187
188 ;; 3rd stage
189 ;; Reorder Kinzi and Vowel E.  Handle Kinzi-vowel combination.
190
191 (category
192  (0x1000 0x107F ?O)
193  (0x1000 0x1021 ?C)                     ; Consonants except for c
194  (0x1001 0x1002 ?c)                     ; Consonants affecting the shape of 
195  (0x1004        ?c)                     ;   the following vowel U+102C
196  (0x1012        ?c)
197  (0x1015        ?c)
198  (0x101D        ?c)
199  (0x1008        ?b)
200  (0x100A 0x100D ?b)
201  (0x1020        ?b)
202  (0x1025        ?b)
203  (0x102C        ?A)                     ; Vowel AA
204  (0x102D        ?i)                     ; Vowel I
205  (0x102E        ?I)                     ; Vowel II
206  (0x102F        ?u)                     ; Vowel U
207  (0x1030        ?U)                     ; Vowel UU
208  (0x1031        ?e)                     ; Vowel E
209  (0x1032        ?V)                     ; Vowel AI
210  (0x1036 0x1038 ?D)
211  (0x1039        ?H)
212  (0x200C        ?N)
213  (0x200D        ?J)
214  (0xE000 0xE3FF ?O)
215  (0xE000 0xE01D ?b)
216  (0xE140        ?B)
217  (0xE1A1 0xE1B0 ?b)
218  (0xE1B1 0xE1BA ?B)
219  (0xE1D1 0xE1F1 ?B)
220  (0xE390        ?K)                     ; Kinzi
221  )
222
223 (generator
224  (0
225   (cond
226    (" K([CcbB]*)(e)([^ ]*) "
227     | (2 =) (1 = *) (3 kinzi-vowel = *) |)
228    (" K([CcbB]*)([^ ]*) "
229     | (1 = *) (2 kinzi-vowel = *) |)
230    (" ([CcbB]*)(e)([^ ]*) "
231     | (2 =) (1 = *) (3 = *) |)
232    (" ([^ ]*) "
233     = *)
234    ("."
235     =))
236   *)
237
238  (kinzi-vowel
239   (cond
240    ((0x102D) 0xE391)
241    ((0x102E) 0xE391)
242    ((0x1036) 0xE393)
243    0xE390)))
244
245 ;; 4th stage
246 ;; Various glyph substitions.
247
248 (generator
249  (0
250   (cond
251    (" ([^ ]*) "
252     |
253     (1
254      (cond
255       ;; Consonant substituion.
256       ((0x1009 0x1039) 0xE009 0x1039)
257       ((0x1009 0xE005) 0xE109 Br>5Bl 0xE005)
258       ((0x101B 0x102F) 0xE01B 0x102F)
259       ((0x101B 0x1030) 0xE01B 0x1030)
260       ((0x1014 0x102F) 0xE140 0x102F)
261       ((0x1014 0x1030) 0xE140 0x1030)
262
263       ;; Sign substituion.              ;
264       ((0x102F 0x1037) 0x102F 0xE137)
265       ((0x1030 0x1037) 0x1030 0xE137)
266       ((0xE01D 0x1037) 0xE01D 0xE137)
267       ((0xE1A1 0x1036 0x1037) 0xE1A1 0x1036 0xE137)
268       ((0xE1A1 0x1032 0x1037) 0xE1A1 0x1032 0xE137)
269       ((0xE01D 0x1032 0x1037) 0xE01D 0x1032 0xE137)
270       ((0xE01D 0x1036 0x1037) 0xE01D 0x1036 0xE137)
271
272       ;; Vowel substituion.             ;
273       ((0xE1F1 0x102F)  0xE1F2)
274       ((0xE1F1 0x102D 0x102F)   0xE1F2 0x102D)
275       ((0xE1F1 0x102E 0x102F)   0xE1F2 0x102E)
276       ("BcK?A"          = = = =)
277       ("cAH"            = 0xE02D)
278       ("cA"             = 0xE02C)
279       ("cKA"            = = Br>Bl 0xE02C)
280       ((0x1012 0xE012 0x102C 0x1039) = = 0xE02D)
281       ((0x1012 0xE01D 0x102C 0x1039) = = 0xE02D)
282       ((0x1012 0xE012 0x102C) = = 0xE02C)
283       ((0x1012 0xE01D 0x102C) = = 0xE02C)
284       ((0x102D 0x1036)  0xE2D1)
285       ("([bB][^u]*)u"   (1 = *) 0xE2F1)
286       ("([bB][^u]*)U"   (1 = *) 0xE2F2)
287       ("." =))
288      *)
289     |)
290    ((0x200C)    0x4E tc.cc 0x48)
291    ("."
292     =))
293   *))
294
295 (category
296  (0x1000 0x107F ?O)
297  (0xE000 0xE3FF ?O)
298  (0x1014        ?T)                     ; Tall consonant
299  (0x101B        ?T)
300  (0x102F        ?B)                     ; Below position
301  (0xE01D        ?B)
302  (0xE1A1        ?B)
303  (0xE1D1        ?B)
304  (0xE1F1 0xE1F2 ?B)
305  )
306
307 (generator
308  (0
309   (cond
310    (" ([^ ]*) "
311     (1
312      (cond
313       ("(T)(B)"
314        (1 (cond ((0x1014) 0xE140) ((0x101B) 0xE01B)))
315        (2 =))
316       ("." =))
317      *))
318    ("." =))
319   *))
320
321 ;; Local Variables:
322 ;; mode: lisp
323 ;; coding: utf-8
324 ;; End: