Update copyright year.
[m17n/m17n-db.git] / FLT / MYMR-MYAZEDI.flt
1 ;; MYMR-MYAZEDI.flt -- Font Layout Table for Myanmar (Zedi font)
2 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008  AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter mymr-myazedi nil
6       (font (nil myazedi_m17n unicode-bmp)))
7
8 ;;; <li> MYMR-MYAZEDI.flt
9 ;;;
10 ;;; For the Myanmar Zedi family fonts to draw Myanmar script.
11 ;;; <ul>
12 ;;; <li> download: http://www.myazedi.com/downloads/MyaZedi_M17N.ttf
13 ;;; </ul>
14
15 ;; 1st stage
16 ;; Extract syllable while detecting Kinzi, substituting subscripts,
17 ;; and removing Halants.
18
19 (category
20  (0x1000 0x107F ?O)                     ; other
21  (0x1000 0x1021 ?C)                     ; consonant except for c, K, n, M
22  (0x1000 0x1003 ?c)                     ; consonant that has subscript form
23  (0x1004        ?K)                     ; consonant NGA
24  (0x1005 0x1008 ?c)
25  (0x100B 0x100C ?c)
26  (0x100F 0x1019 ?c)
27  (0xE014        ?c)
28  (0xE01B        ?c)
29  (0x1014        ?n)                     ; consonant NA
30  (0x101C        ?c)
31  ;; cosonants that can be a Medial
32  (0x101A        ?M)                     ; medial Ya
33  (0x101B        ?M)                     ; medial Ra 
34  (0x101D        ?M)                     ; medial Wa
35  (0x101F        ?M)                     ; medial Ha
36  (0x1021 0x102A ?I)                     ; independent vowel
37  (0x102C 0x1032 ?V)                     ; dependent Vowel
38  (0x1036        ?A)                     ; sign ANUSVARA
39  (0x1037 0x1038 ?S)                     ; other sign
40  (0x1039        ?H)                     ; HALANT (VIRAMA)
41  (0x200C        ?N)                     ; ZWNJ (Zero Width Non Joiner)
42  (0x200D        ?J)                     ; ZWJ (Zero Width Joiner)
43  )
44
45 (generator
46  (0
47   (cond
48    ;; The following regular expression matches a graphme cluster pattern
49    ;; described in Table 10-3 of the Unicode Standard 4.0 except for
50    ;; Kinzi which is encoded by the sequence "U+1004 U+1039 U+200D".
51    ;; 
52    ;;<-1-><---------2--------><--4--><--6---><7-><8->
53    ;;              <---3--->   <5->
54    ("(KHJ)([CcnKMr](H[CcnK])?)((HM)*)(V*A?H?)(N)?(S*)"
55     | < (1 0xE390) (2 consonant) (4 remove-halant *) (6 = *) (7) (8 = *) > |)
56
57    ;; Irregular independent Kinzi
58    ("KHJ"
59     [ 0xE390 ])
60
61    ;; Cluster without Kinzi
62    ("([CcnKMr](H[CcnK])?)((HM)*)(V*A?H?)(N)?(S*)"
63     | < (1 consonant) (3 remove-halant *) (5 = *) (6) (7 = *) > |)
64
65    ;; Fixme: I'm not sure about the syllable pattern for an
66    ;; independent vowel.
67    ("IV*[AS]*"
68     | < = * > |)
69
70    ;; Treat anything else as a single character.
71    ("."
72     [ = ]))
73   *)
74
75  (consonant
76   (cond
77    ((0x100B 0x1039 0x100C) 0xE10C)
78    ((0x100D 0x1039 0x100D) 0xE00D)
79    ((0x100E 0x1039 0x100D) 0xE10D)
80    ((0x100F 0x1039 0x100D) 0xE20D)
81    ((0x101E 0x1039 0x101E) 0xE01E)
82    ("(n)H([cn])" 0xE140 (2 subscript))
83    ("(.)H([cn])" (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][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 = *) 0xE1A1)
147
148    ;; Medial Ra (U+101B)
149    ("([Waf]|.[Ww])bdf"  0xE1BA (1 = *))
150    ("(..?)bdf"          0xE1B9 (1 = *))
151    ("([Waf]|.[Ww])bd"   0xE1B8 (1 = *))
152    ("(..?)bd"           0xE1B7 (1 = *))
153    ("([Waf]|.[Ww])b(f)?(V)"     0xE1B6 (1 = *) (2 0xE1F3) (3 =))
154    ("(..?)b(f)?(V)"             0xE1B5 (1 = *) (2 0xE1F3) (3 =))
155    ;; Single-width consonant + a wide subscript + Medial Ra.
156    ;; To use glyph E1B4, we must shift the single-width consonant to
157    ;; the right.
158    ("([Sd][Ww])b"       0xE1B4 Br>32Bl (1 = *))
159    ("([Waf].|.[Ww])b"   0xE1B4 (1 = *))
160    ("(s|..)b"           0xE1B3 (1 = *))
161    ("([Waf])b(f)?"      0xE1B2 (1 = *) (2 0xE1F3))
162    ("(.)b(f)?"          0xE1B1 (1 = *) (2 0xE1F3))
163    
164    ;; Medial Wa (U+101D)
165    ("(..?)df"           (1 = *) 0xE1D1)
166    ("(..?)d"            (1 = *) 0xE01D)
167
168    ;; Medial Ha (U+101F)
169    ((0x100A 0x101F)     0x100A 0xE1F3)
170    ("(..?)f"            (1 = *) 0xE1F1))))
171
172 ;; 3rd stage
173 ;; Reorder Kinzi and Vowel E.  Handle Kinzi-vowel combination.
174
175 (category
176  (0x1000 0x107F ?O)
177  (0x1000 0x1021 ?C)                     ; Consonants except for c
178  (0x1001 0x1002 ?c)                     ; Consonants affecting the shape of 
179  (0x1004        ?c)                     ;   the following vowel U+102C
180  (0x1012        ?c)
181  (0x1015        ?c)
182  (0x101D        ?c)
183  (0x1008        ?b)
184  (0x100A 0x100D ?b)
185  (0x1020        ?b)
186  (0x1025        ?b)
187  (0x102C        ?A)                     ; Vowel AA
188  (0x102D        ?i)                     ; Vowel I
189  (0x102E        ?I)                     ; Vowel II
190  (0x102F        ?u)                     ; Vowel U
191  (0x1030        ?U)                     ; Vowel UU
192  (0x1031        ?e)                     ; Vowel E
193  (0x1032        ?V)                     ; Vowel AI
194  (0x1036 0x1038 ?D)
195  (0x1039        ?H)
196  (0x200C        ?N)
197  (0x200D        ?J)
198  (0xE000 0xE3FF ?O)
199  (0xE000 0xE01D ?b)
200  (0xE140        ?B)
201  (0xE1A1 0xE1B0 ?b)
202  (0xE1B1 0xE1BA ?B)
203  (0xE1D1 0xE1F1 ?B)
204  (0xE20D        ?b)
205  (0xE390        ?K)                     ; Kinzi
206  )
207
208 (generator
209  (0
210   (cond
211    (" K([CcbB]*)(e)([^ ]*) "
212     | (2 =) (1 = *) (3 kinzi-vowel = *) |)
213    (" K([CcbB]*)([^ ]*) "
214     | (1 = *) (2 kinzi-vowel = *) |)
215    (" ([CcbB]*)(e)([^ ]*) "
216     | (2 =) (1 = *) (3 = *) |)
217    (" ([^ ]*) "
218     = *)
219    ("."
220     =))
221   *)
222
223  (kinzi-vowel
224   (cond
225    ((0x102D) 0xE391)
226    ((0x102E) 0xE391)
227    ((0x1036) 0xE393)
228    0xE390)))
229
230 ;; 4th stage
231 ;; Various glyph substitions.
232
233 (generator
234  (0
235   (cond
236    (" ([^ ]*) "
237     |
238     (1
239      (cond
240       ;; Consonant substituion.
241       ((0x1009 0x1039) 0x1025 0x1039)
242       ((0x1009 0xE005) 0xE109 Br>5Bl 0xE005)
243 ;;       ((0x101B 0x102F) 0xE01B 0x102F)
244 ;;       ((0x101B 0x1030) 0xE01B 0x1030)
245 ;;       ((0x1014 0x102F) 0xE140 0x102F)
246 ;;       ((0x1014 0x1030) 0xE140 0x1030)
247
248 ;;       ;; Sign substituion.
249 ;;       ((0x102F 0x1037) 0x102F 0xE137)
250 ;;       ((0x1030 0x1037) 0x1030 0xE137)
251 ;;       ((0xE01D 0x1037) 0xE01D 0xE137)
252 ;;       ((0xE1A1 0x1036 0x1037) 0xE1A1 0x1036 0xE137)
253 ;;       ((0xE1A1 0x1032 0x1037) 0xE1A1 0x1032 0xE137)
254 ;;       ((0xE01D 0x1032 0x1037) 0xE01D 0x1032 0xE137)
255 ;;       ((0xE01D 0x1036 0x1037) 0xE01D 0x1036 0xE137)
256
257       ;; Vowel substituion.
258       ((0xE1F1 0x102F)  0xE1F2)
259       ((0xE1F1 0x102D 0x102F)   0xE1F2 0x102D)
260       ((0xE1F1 0x102E 0x102F)   0xE1F2 0x102E)
261       ((0xE1F1 0x1032 0x102F)   0xE1F2 0x1032)
262       ("BcK?A"          = = = =)
263       ("cAH"            = 0xE02D)
264       ("cA"             = 0xE02C)
265       ("cKA"            = = Br>Bl 0xE02C)
266       ((0x1012 0xE012 0x102C 0x1039) = = 0xE02D)
267       ((0x1012 0xE01D 0x102C 0x1039) = = 0xE02D)
268       ((0x1012 0xE012 0x102C) = = 0xE02C)
269       ((0x1012 0xE01D 0x102C) = = 0xE02C)
270       ((0x102D 0x1036)  0xE2D1)
271       ("([bB][^u]*)u"   (1 = *) 0xE2F1)
272       ("([bB][^u]*)U"   (1 = *) 0xE2F2)
273       ("." =))
274      *)
275     |)
276    ("."
277     =))
278   *))
279
280 ;; 5th stage
281 ;; Adjust below characters (U+102F, U+1037, etc)
282
283 (category
284  (0x1000 0x107F ?O)
285  (0x200C 0x200D ?O)
286  (0xE000 0xE3FF ?O)
287  (0x1014        ?T)                     ; tall consonant (substituted)
288  (0x101B        ?T)
289  (0x102F 0x1030 ?B)                     ; below position (substitute tall one)
290  (0x1037        ?b)                     ; shift to right
291  (0xE01D        ?B)
292  (0xE1A1        ?B)
293  (0xE1D1        ?B)
294  (0xE1B1 0xE1BA ?L)
295  (0xE1F1 0xE1F2 ?B)
296  (0xE2F1 0xE2F2 ?L)                     ; has lower part
297  )
298
299 (generator
300  (0
301   (cond
302    (" ([^ ]*) "
303     |
304     (1
305      (cond
306       ("(T)(B)([OL])?(b)?"
307        (1 (cond ((0x1014) 0xE140) ((0x101B) 0xE01B)))
308        (2 =)
309        (3 = *)
310        (4 0xE137))
311       ("([TBL])(O*)?(b)"
312        (1 =) (2 = *) (3 0xE137))
313       ("." =))
314      *)
315     |)
316    ("OO*" = *)
317    ("." =))
318   *))
319
320 ;; 6th stage
321 ;; Adjust conbination of normal consonant and wide subconsonant.
322
323 (category
324  (0x1000 0x107F ?O)
325  (0x200C 0x200D ?O)
326  (0xE000 0xE3FF ?O)
327  (0x1001 0x1002 ?n)
328  (0x1004 0x1005 ?n)
329  (0x1007        ?n)
330  (0x100E        ?n)
331  (0x1012 0x1013 ?n)
332  (0x1015 0x1017 ?n)
333  (0x1019        ?n)
334  (0x101D        ?n)
335  (0xE000        ?w)
336  (0xE003        ?w)
337  (0xE006        ?w)
338  (0xE00C        ?w)
339  (0xE00F        ?w)
340  (0xE010 0xE011 ?w)
341  (0xE018        ?w))
342
343 (generator
344  (0
345   (cond
346    (" (n)(w)([^ ]*) "
347     \[ (1 =) (2 Br>17Bl =) (3 = *))
348    (" ([^ ]*) "
349     (1 = *))
350    ("."
351     =))
352   *))
353
354 ;; Copyright (C) 2004, 2005, 2006, 2007
355 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
356 ;;   Registration Number H15PRO112
357
358 ;; This file is part of the m17n database; a sub-part of the m17n
359 ;; library.
360
361 ;; The m17n library is free software; you can redistribute it and/or
362 ;; modify it under the terms of the GNU Lesser General Public License
363 ;; as published by the Free Software Foundation; either version 2.1 of
364 ;; the License, or (at your option) any later version.
365
366 ;; The m17n library is distributed in the hope that it will be useful,
367 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
368 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
369 ;; Lesser General Public License for more details.
370
371 ;; You should have received a copy of the GNU Lesser General Public
372 ;; License along with the m17n library; if not, write to the Free
373 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
374 ;; Boston, MA 02110-1301, USA.
375
376 ;; Local Variables:
377 ;; mode: emacs-lisp
378 ;; coding: utf-8
379 ;; End: