Moved from the parent directory. Add layouter information.
[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
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., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, 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 (font layouter mymr-myazedi nil
32       (font (nil myazedi_m17n unicode-bmp)))
33
34 ;; 1st stage
35 ;; Extract syllable while detecting Kinzi, substituting subscripts,
36 ;; and removing Halants.
37
38 (category
39  (0x1000 0x107F ?O)                     ; other
40  (0x1000 0x1021 ?C)                     ; consonant except for c, K, n, M
41  (0x1000 0x1003 ?c)                     ; consonant that has subscript form
42  (0x1004        ?K)                     ; consonant NGA
43  (0x1005 0x1008 ?c)
44  (0x100B 0x100C ?c)
45  (0x100F 0x1019 ?c)
46  (0xE014        ?c)
47  (0xE01B        ?c)
48  (0x1014        ?n)                     ; consonant NA
49  (0x101C        ?c)
50  ;; cosonants that can be a Medial
51  (0x101A        ?M)                     ; medial Ya
52  (0x101B        ?M)                     ; medial Ra 
53  (0x101D        ?M)                     ; medial Wa
54  (0x101F        ?M)                     ; medial Ha
55  (0x1021 0x102A ?I)                     ; independent vowel
56  (0x102C 0x1032 ?V)                     ; dependent Vowel
57  (0x1036        ?A)                     ; sign ANUSVARA
58  (0x1037 0x1038 ?S)                     ; other sign
59  (0x1039        ?H)                     ; HALANT (VIRAMA)
60  (0x200C        ?N)                     ; ZWNJ (Zero Width Non Joiner)
61  (0x200D        ?J)                     ; ZWJ (Zero Width Joiner)
62  )
63
64 (generator
65  (0
66   (cond
67    ;; The following regular expression matches a graphme cluster pattern
68    ;; described in Table 10-3 of the Unicode Standard 4.0 except for
69    ;; Kinzi which is encoded by the sequence "U+1004 U+1039 U+200D".
70    ;; 
71    ;;<-1-><---------2--------><--4--><--6--->  <7->
72    ;;              <---3--->   <5->
73    ("(KHJ)([CcnKMr](H[CcnK])?)((HM)*)(V*A?H?)N?(S*)"
74     | < (1 0xE390) (2 consonant) (4 remove-halant *) (6 = *) (7 = *) > |)
75
76    ;; Irregular independent Kinzi
77    ("KHJ"
78     [ 0xE390 ])
79
80    ;; Cluster without Kinzi
81    ("([CcnKMr](H[CcnK])?)((HM)*)(V*A?H?)N?(S*)"
82     | < (1 consonant) (3 remove-halant *) (5 = *) (6 = *) > |)
83
84    ;; Fixme: I'm not sure about the syllable pattern for an
85    ;; independent vowel.
86    ("IV*[AS]*"
87     | < = * > |)
88
89    ;; Treat anything else as a single character.
90    ("."
91     [ = ]))
92   *)
93
94  (consonant
95   (cond
96    ((0x100B 0x1039 0x100C) 0xE10C)
97    ((0x100D 0x1039 0x100D) 0xE00D)
98    ((0x100E 0x1039 0x100D) 0xE10D)
99    ((0x100F 0x1039 0x100D) 0xE20D)
100    ((0x101E 0x1039 0x101E) 0xE01E)
101    ("(n)H([cn])" 0xE140 (2 subscript))
102    ("(.)H([cn])" (1 =) (2 subscript))
103    ("(.)H(.)" (1 =) (2 =))
104    ("." =)))
105
106  (subscript
107   (cond ((range 0x1000 0x101C) 0xE000)))
108
109  (remove-halant
110   (cond
111    ((0x1039))
112    ("." =))))
113
114 ;; 2nd stage
115 ;; Handle medials.
116
117 (category
118  (0x1000 0x107F ?O)                     ; other
119  (0x1000 0x1021 ?W)                     ; wide consonant
120  (0x1001 0x1002 ?S)                     ; single-width consonant
121  (0x1004 0x1005 ?S)
122  (0x1007 0x1008 ?S)
123  (0x100B 0x100E ?S)
124  (0x1012 0x1017 ?S)
125  (0x1019        ?S)
126  (0x101A        ?a)                     ; medial Ya
127  (0x101B        ?b)                     ; medial Ra
128  (0x101D        ?d)                     ; medial Wa
129  (0x101F        ?f)                     ; medial Ha
130  (0x1020        ?S)
131  (0x102D 0x102E ?V)                     ; dependent vowel (upper)
132  (0x1032        ?V)
133  (0x200C        ?N)                     ; ZWNJ
134  (0xE000 0xE3FF ?O)
135  (0xE000 0xE01E ?w)                     ; wide subscript
136  (0xE001 0xE002 ?s)                     ; single-width subscript
137  (0xE005        ?s)
138  (0xE007        ?s)
139  (0xE00B        ?s)
140  (0xE012 0xE017 ?s)
141  (0xE019        ?s)
142  (0xE10C 0xE10D ?s)
143  (0xE140        ?s)
144  (0xE20D        ?w)
145  (0xE390        ?K)                     ; Kinzi
146  )
147
148 (generator
149  (0
150   (cond
151    (" (K)?([WSabdfws][WSKws]?[abdf][abdf]*[^ ]*) "
152     | (1 =) (2 medial = *) |)
153    (" ([^ ]*) "
154     = *)
155    ("."
156     =))
157   *)
158
159  (medial
160   (cond
161    ;; Medial Ya (U+101A)
162    ("(..?)adf"  (1 = *) 0xE1A2)
163    ("(..?)ad"   (1 = *) 0xE1A4)
164    ("(..?)af"   (1 = *) 0xE1A3)
165    ("(..?)a"    (1 = *) 0xE1A1)
166
167    ;; Medial Ra (U+101B)
168    ("([Waf]|.[Ww])bdf"  0xE1BA (1 = *))
169    ("(..?)bdf"          0xE1B9 (1 = *))
170    ("([Waf]|.[Ww])bd"   0xE1B8 (1 = *))
171    ("(..?)bd"           0xE1B7 (1 = *))
172    ("([Waf]|.[Ww])b(f)?(V)"     0xE1B6 (1 = *) (2 0xE1F3) (3 =))
173    ("(..?)b(f)?(V)"             0xE1B5 (1 = *) (2 0xE1F3) (3 =))
174    ;; Single-width consonant + a wide subscript + Medial Ra.
175    ;; To use glyph E1B4, we must shift the single-width consonant to
176    ;; the right.
177    ("([Sd][Ww])b"       0xE1B4 Br>32Bl (1 = *))
178    ("([Waf].|.[Ww])b"   0xE1B4 (1 = *))
179    ("(s|..)b"           0xE1B3 (1 = *))
180    ("([Waf])b(f)?"      0xE1B2 (1 = *) (2 0xE1F3))
181    ("(.)b(f)?"          0xE1B1 (1 = *) (2 0xE1F3))
182    
183    ;; Medial Wa (U+101D)
184    ("(..?)df"           (1 = *) 0xE1D1)
185    ("(..?)d"            (1 = *) 0xE01D)
186
187    ;; Medial Ha (U+101F)
188    ((0x100A 0x101F)     0x100A 0xE1F3)
189    ("(..?)f"            (1 = *) 0xE1F1))))
190
191 ;; 3rd stage
192 ;; Reorder Kinzi and Vowel E.  Handle Kinzi-vowel combination.
193
194 (category
195  (0x1000 0x107F ?O)
196  (0x1000 0x1021 ?C)                     ; Consonants except for c
197  (0x1001 0x1002 ?c)                     ; Consonants affecting the shape of 
198  (0x1004        ?c)                     ;   the following vowel U+102C
199  (0x1012        ?c)
200  (0x1015        ?c)
201  (0x101D        ?c)
202  (0x1008        ?b)
203  (0x100A 0x100D ?b)
204  (0x1020        ?b)
205  (0x1025        ?b)
206  (0x102C        ?A)                     ; Vowel AA
207  (0x102D        ?i)                     ; Vowel I
208  (0x102E        ?I)                     ; Vowel II
209  (0x102F        ?u)                     ; Vowel U
210  (0x1030        ?U)                     ; Vowel UU
211  (0x1031        ?e)                     ; Vowel E
212  (0x1032        ?V)                     ; Vowel AI
213  (0x1036 0x1038 ?D)
214  (0x1039        ?H)
215  (0x200C        ?N)
216  (0x200D        ?J)
217  (0xE000 0xE3FF ?O)
218  (0xE000 0xE01D ?b)
219  (0xE140        ?B)
220  (0xE1A1 0xE1B0 ?b)
221  (0xE1B1 0xE1BA ?B)
222  (0xE1D1 0xE1F1 ?B)
223  (0xE20D        ?b)
224  (0xE390        ?K)                     ; Kinzi
225  )
226
227 (generator
228  (0
229   (cond
230    (" K([CcbB]*)(e)([^ ]*) "
231     | (2 =) (1 = *) (3 kinzi-vowel = *) |)
232    (" K([CcbB]*)([^ ]*) "
233     | (1 = *) (2 kinzi-vowel = *) |)
234    (" ([CcbB]*)(e)([^ ]*) "
235     | (2 =) (1 = *) (3 = *) |)
236    (" ([^ ]*) "
237     = *)
238    ("."
239     =))
240   *)
241
242  (kinzi-vowel
243   (cond
244    ((0x102D) 0xE391)
245    ((0x102E) 0xE391)
246    ((0x1036) 0xE393)
247    0xE390)))
248
249 ;; 4th stage
250 ;; Various glyph substitions.
251
252 (generator
253  (0
254   (cond
255    (" ([^ ]*) "
256     |
257     (1
258      (cond
259       ;; Consonant substituion.
260       ((0x1009 0x1039) 0x1025 0x1039)
261       ((0x1009 0xE005) 0xE109 Br>5Bl 0xE005)
262 ;;       ((0x101B 0x102F) 0xE01B 0x102F)
263 ;;       ((0x101B 0x1030) 0xE01B 0x1030)
264 ;;       ((0x1014 0x102F) 0xE140 0x102F)
265 ;;       ((0x1014 0x1030) 0xE140 0x1030)
266
267 ;;       ;; Sign substituion.
268 ;;       ((0x102F 0x1037) 0x102F 0xE137)
269 ;;       ((0x1030 0x1037) 0x1030 0xE137)
270 ;;       ((0xE01D 0x1037) 0xE01D 0xE137)
271 ;;       ((0xE1A1 0x1036 0x1037) 0xE1A1 0x1036 0xE137)
272 ;;       ((0xE1A1 0x1032 0x1037) 0xE1A1 0x1032 0xE137)
273 ;;       ((0xE01D 0x1032 0x1037) 0xE01D 0x1032 0xE137)
274 ;;       ((0xE01D 0x1036 0x1037) 0xE01D 0x1036 0xE137)
275
276       ;; Vowel substituion.
277       ((0xE1F1 0x102F)  0xE1F2)
278       ((0xE1F1 0x102D 0x102F)   0xE1F2 0x102D)
279       ((0xE1F1 0x102E 0x102F)   0xE1F2 0x102E)
280       ((0xE1F1 0x1032 0x102F)   0xE1F2 0x1032)
281       ("BcK?A"          = = = =)
282       ("cAH"            = 0xE02D)
283       ("cA"             = 0xE02C)
284       ("cKA"            = = Br>Bl 0xE02C)
285       ((0x1012 0xE012 0x102C 0x1039) = = 0xE02D)
286       ((0x1012 0xE01D 0x102C 0x1039) = = 0xE02D)
287       ((0x1012 0xE012 0x102C) = = 0xE02C)
288       ((0x1012 0xE01D 0x102C) = = 0xE02C)
289       ((0x102D 0x1036)  0xE2D1)
290       ("([bB][^u]*)u"   (1 = *) 0xE2F1)
291       ("([bB][^u]*)U"   (1 = *) 0xE2F2)
292       ("." =))
293      *)
294     |)
295    ("."
296     =))
297   *))
298
299 ;; 5th stage
300 ;; Adjust below characters (U+102F, U+1037, etc)
301
302 (category
303  (0x1000 0x107F ?O)
304  (0x200C 0x200D ?O)
305  (0xE000 0xE3FF ?O)
306  (0x1014        ?T)                     ; tall consonant (substituted)
307  (0x101B        ?T)
308  (0x102F 0x1030 ?B)                     ; below position (substitute tall one)
309  (0x1037        ?b)                     ; shift to right
310  (0xE01D        ?B)
311  (0xE1A1        ?B)
312  (0xE1D1        ?B)
313  (0xE1B1 0xE1BA ?L)
314  (0xE1F1 0xE1F2 ?B)
315  (0xE2F1 0xE2F2 ?L)                     ; has lower part
316  )
317
318 (generator
319  (0
320   (cond
321    (" ([^ ]*) "
322     |
323     (1
324      (cond
325       ("(T)(B)([OL])?(b)?"
326        (1 (cond ((0x1014) 0xE140) ((0x101B) 0xE01B)))
327        (2 =)
328        (3 = *)
329        (4 0xE137))
330       ("([TBL])(O*)?(b)"
331        (1 =) (2 = *) (3 0xE137))
332       ("." =))
333      *)
334     |)
335    ("OO*" = *)
336    ("." =))
337   *))
338
339 ;; 6th stage
340 ;; Adjust conbination of normal consonant and wide subconsonant.
341
342 (category
343  (0x1000 0x107F ?O)
344  (0x200C 0x200D ?O)
345  (0xE000 0xE3FF ?O)
346  (0x1001 0x1002 ?n)
347  (0x1004 0x1005 ?n)
348  (0x1007        ?n)
349  (0x100E        ?n)
350  (0x1012 0x1013 ?n)
351  (0x1015 0x1017 ?n)
352  (0x1019        ?n)
353  (0x101D        ?n)
354  (0xE000        ?w)
355  (0xE003        ?w)
356  (0xE006        ?w)
357  (0xE00C        ?w)
358  (0xE00F        ?w)
359  (0xE010 0xE011 ?w)
360  (0xE018        ?w))
361
362 (generator
363  (0
364   (cond
365    (" (n)(w)([^ ]*) "
366     \[ (1 =) (2 Br>17Bl =) (3 = *))
367    (" ([^ ]*) "
368     (1 = *))
369    ("."
370     =))
371   *))
372
373 ;; Local Variables:
374 ;; mode: emacs-lisp
375 ;; coding: utf-8
376 ;; End: