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