*** empty log message ***
[m17n/m17n-db.git] / MYMR-MYAZEDI.flt
1 ;; MYMR-MYAZEDI.flt -- Font Layout Table for Myanmar (Zedi font)
2 ;; Copyright (C) 2004, 2005, 2006
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  (0xE20D        ?b)
221  (0xE390        ?K)                     ; Kinzi
222  )
223
224 (generator
225  (0
226   (cond
227    (" K([CcbB]*)(e)([^ ]*) "
228     | (2 =) (1 = *) (3 kinzi-vowel = *) |)
229    (" K([CcbB]*)([^ ]*) "
230     | (1 = *) (2 kinzi-vowel = *) |)
231    (" ([CcbB]*)(e)([^ ]*) "
232     | (2 =) (1 = *) (3 = *) |)
233    (" ([^ ]*) "
234     = *)
235    ("."
236     =))
237   *)
238
239  (kinzi-vowel
240   (cond
241    ((0x102D) 0xE391)
242    ((0x102E) 0xE391)
243    ((0x1036) 0xE393)
244    0xE390)))
245
246 ;; 4th stage
247 ;; Various glyph substitions.
248
249 (generator
250  (0
251   (cond
252    (" ([^ ]*) "
253     |
254     (1
255      (cond
256       ;; Consonant substituion.
257       ((0x1009 0x1039) 0x1025 0x1039)
258       ((0x1009 0xE005) 0xE109 Br>5Bl 0xE005)
259 ;;       ((0x101B 0x102F) 0xE01B 0x102F)
260 ;;       ((0x101B 0x1030) 0xE01B 0x1030)
261 ;;       ((0x1014 0x102F) 0xE140 0x102F)
262 ;;       ((0x1014 0x1030) 0xE140 0x1030)
263
264 ;;       ;; Sign substituion.
265 ;;       ((0x102F 0x1037) 0x102F 0xE137)
266 ;;       ((0x1030 0x1037) 0x1030 0xE137)
267 ;;       ((0xE01D 0x1037) 0xE01D 0xE137)
268 ;;       ((0xE1A1 0x1036 0x1037) 0xE1A1 0x1036 0xE137)
269 ;;       ((0xE1A1 0x1032 0x1037) 0xE1A1 0x1032 0xE137)
270 ;;       ((0xE01D 0x1032 0x1037) 0xE01D 0x1032 0xE137)
271 ;;       ((0xE01D 0x1036 0x1037) 0xE01D 0x1036 0xE137)
272
273       ;; Vowel substituion.
274       ((0xE1F1 0x102F)  0xE1F2)
275       ((0xE1F1 0x102D 0x102F)   0xE1F2 0x102D)
276       ((0xE1F1 0x102E 0x102F)   0xE1F2 0x102E)
277       ((0xE1F1 0x1032 0x102F)   0xE1F2 0x1032)
278       ("BcK?A"          = = = =)
279       ("cAH"            = 0xE02D)
280       ("cA"             = 0xE02C)
281       ("cKA"            = = Br>Bl 0xE02C)
282       ((0x1012 0xE012 0x102C 0x1039) = = 0xE02D)
283       ((0x1012 0xE01D 0x102C 0x1039) = = 0xE02D)
284       ((0x1012 0xE012 0x102C) = = 0xE02C)
285       ((0x1012 0xE01D 0x102C) = = 0xE02C)
286       ((0x102D 0x1036)  0xE2D1)
287       ("([bB][^u]*)u"   (1 = *) 0xE2F1)
288       ("([bB][^u]*)U"   (1 = *) 0xE2F2)
289       ("." =))
290      *)
291     |)
292    ("."
293     =))
294   *))
295
296 ;; 5th stage
297 ;; Adjust below characters (U+102F, U+1037, etc)
298
299 (category
300  (0x1000 0x107F ?O)
301  (0x200C 0x200D ?O)
302  (0xE000 0xE3FF ?O)
303  (0x1014        ?T)                     ; tall consonant (substituted)
304  (0x101B        ?T)
305  (0x102F 0x1030 ?B)                     ; below position (substitute tall one)
306  (0x1037        ?b)                     ; shift to right
307  (0xE01D        ?B)
308  (0xE1A1        ?B)
309  (0xE1D1        ?B)
310  (0xE1B1 0xE1BA ?L)
311  (0xE1F1 0xE1F2 ?B)
312  (0xE2F1 0xE2F2 ?L)                     ; has lower part
313  )
314
315 (generator
316  (0
317   (cond
318    (" ([^ ]*) "
319     |
320     (1
321      (cond
322       ("(T)(B)([OL])?(b)?"
323        (1 (cond ((0x1014) 0xE140) ((0x101B) 0xE01B)))
324        (2 =)
325        (3 = *)
326        (4 0xE137))
327       ("([TBL])(O*)?(b)"
328        (1 =) (2 = *) (3 0xE137))
329       ("." =))
330      *)
331     |)
332    ("OO*" = *)
333    ("." =))
334   *))
335
336 ;; 6th stage
337 ;; Adjust conbination of normal consonant and wide subconsonant.
338
339 (category
340  (0x1000 0x107F ?O)
341  (0x200C 0x200D ?O)
342  (0xE000 0xE3FF ?O)
343  (0x1001 0x1002 ?n)
344  (0x1004 0x1005 ?n)
345  (0x1007        ?n)
346  (0x100E        ?n)
347  (0x1012 0x1013 ?n)
348  (0x1015 0x1017 ?n)
349  (0x1019        ?n)
350  (0x101D        ?n)
351  (0xE000        ?w)
352  (0xE003        ?w)
353  (0xE006        ?w)
354  (0xE00C        ?w)
355  (0xE00F        ?w)
356  (0xE010 0xE011 ?w)
357  (0xE018        ?w))
358
359 (generator
360  (0
361   (cond
362    (" (n)(w)([^ ]*) "
363     \[ (1 =) (2 Br>17Bl =) (3 = *))
364    (" ([^ ]*) "
365     (1 = *))
366    ("."
367     =))
368   *))
369
370 ;; Local Variables:
371 ;; mode: emacs-lisp
372 ;; coding: utf-8
373 ;; End: