Moved from the parent directory. Add layouter information.
[m17n/m17n-db.git] / FLT / ARAB-OTF.flt
1 ;; ARAB-OTF.flt -- Font Layout Table for Arabic OpenType font
2 ;; Copyright (C) 2004, 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., 59 Temple Place, Suite 330, Boston, MA
22 ;; 02111-1307, USA.
23
24 ;;; <li> ARAB-OTF.flt
25 ;;;
26 ;;; For Arabic OpenType fonts to draw the Arabic script.
27
28 (font layouter arab-otf nil
29       (font (nil nil unicode-bmp :otf=arab=init,medi,fina,liga+mark)))
30
31 ;; Step 0: Move Kazakh high hamza.
32
33 (category
34  ;; p: high hamza carrier (p for positive)
35  ;; n: high hamza suppressor (n for negative)
36  ;; x: don't care
37  (0x0600 0x06FF         ?x)
38  (0x0750 0x077F         ?x)             ; Arabic Supplement
39  (0x0674 0x0678         ?p)
40  (0x0643                ?n)
41  (0x06AF                ?n)
42  (0x06D5                ?n)
43  (0x200C                ?x)
44  (0x200D                ?x)
45  (0x25CC                ?x)
46  (0xFB50 0xFDFF         ?X)             ; Arabic Presentation Forms-A
47  (0xFE70 0xFEFC         ?X)             ; Arabic Presentation Forms-B
48  )
49
50 (generator
51  (0
52   (cond
53    ;; If a presentation form is found, draw the whole sequence as is.
54    (".*X.*" = *)
55
56    (".*p.*"                             ; If a high hamza is found,
57     (cond
58      (".*n.*"                           ;   and a suppressor exists,
59       rmhamza *)                        ;   then remove the high hamza.
60      (0                                 ;   Otherwise, move the high
61       0x674 rmhamza *)))                ;   hamza to the beginning.
62    (0 = *)))                            ; If no high hamza, do nothing.
63
64  (rmhamza
65   (cond
66    ((0x0674)            )
67    ((0x0675)            0x0627)
68    ((0x0676)            0x0648)
69    ((0x0677)            0x06C7)
70    ((0x0678)            0x0649)
71    ("."                 =))))
72
73 ;; Step 1: ccmp
74
75 (category
76  ;; D: Dual-joining (beh, teh, etc. & zwj)
77  ;; R: Right-joining (alef, dal, thal, reh, zain)
78  ;; U: Non-joining (Hamza, etc. & zwnj)
79  ;; T: Transparent (combining marks)
80  (0x060B 0x060F         ?U)
81  (0x0610 0x0615         ?T)
82  (0x061B                ?U)
83  (0x061E 0x061F         ?U)
84  (0x0621                ?U)
85  (0x0622 0x0623         ?R)
86  (0x0624                ?R)
87  (0x0625                ?R)
88  (0x0626                ?D)
89  (0x0627                ?R)
90  (0x0628                ?D)
91  (0x0629                ?R)
92  (0x062A 0x062E         ?D)
93  (0x062F 0x0632         ?R)
94  (0x0633 0x0647         ?D)
95  (0x0648                ?R)
96  (0x0649 0x064A         ?D)
97  (0x064B 0x065E         ?T)
98  (0x0660 0x066D         ?U)
99  (0x066E 0x066F         ?D)
100  (0x0670                ?T)
101  (0x0671 0x0673         ?R)
102  (0x0674 0x0678         ?U)
103  (0x0679 0x0687         ?D)
104  (0x0688 0x0699         ?R)
105  (0x069A 0x06C3         ?D)
106  (0x06C4 0x06CB         ?R)
107  (0x06CC 0x06CE         ?D)
108  (0x06CF                ?R)
109  (0x06D0 0x06D3         ?D)
110  (0x06D4                ?U)
111  (0x06D5                ?R)
112  (0x06D6 0x06E4         ?T)
113  (0x06E5 0x06E6         ?U)
114  (0x06E7 0x06E8         ?T)
115  (0x06E9                ?U)
116  (0x06EA 0x06ED         ?T)
117  (0x06EE 0x06EF         ?R)
118  (0x06F0 0x06F9         ?U)
119  (0x06FA 0x06FC         ?D)
120  (0x06FD 0x06FE         ?U)
121  (0x06FF                ?D)
122  (0x0750 0x0758         ?D)
123  (0x0759 0x075B         ?R)
124  (0x075C 0x076A         ?D)
125  (0x076B 0x076C         ?R)
126  (0x076D                ?D)
127  (0x200C                ?U)
128  (0x200D                ?D)
129  (0x25CC                ?U)
130  (0xFB50 0xFDFF         ?X)             ; Arabic Presentation Forms-A
131  (0xFE70 0xFEFC         ?X)             ; Arabic Presentation Forms-B
132  )
133
134 ;; (generator
135 ;;  (0
136 ;;   otf:arab=ccmp))
137
138 ;; Step 2: Initial, medial, or final.
139
140 (generator
141  (0
142   (cond
143    (".*X.*" (cond ("[DRUX]T*" < = * >) ("." =)) *)
144
145    ("D.*"
146     (cond
147      ("(.)(T*)([DR].*)"
148       <
149       (1 otf:arab=init)
150       (2 = *)
151       >
152       (3 join))
153      ("(.)(T*)(.*)"                     ; == (D)(T*)(U.*)
154       <
155       (1 otf:arab=isol)
156       (2 = *)
157       >
158       (3 disjoin))))
159
160    ("([RU])(T*)(.*)"
161     <
162     (1 otf:arab=isol)
163     (2 = *)
164     >
165     (3 disjoin))
166
167    ("(T+)(.*)"
168     (1 = *)
169     (2 disjoin))))
170
171  (join
172   (cond
173    ("D.*"
174     (cond
175      ("(.)(T*)([DR].*)"
176       <
177       (1 otf:arab=medi)
178       (2 = *)
179       >
180       (3 join))
181      ("(.)(T*)(.*)"                     ; == (D)(T*)(U.*)
182       <
183       (1 otf:arab=fina)
184       (2 = *)
185       >
186       (3 disjoin))))
187
188    ("(.)(T*)(.*)"
189     <
190     (1 otf:arab=fina)
191     (2 = *)
192     >
193     (3 disjoin))))
194
195  (disjoin
196   (cond
197    ("D.*"
198     (cond
199      ("(.)(T*)([DR].*)"
200       <
201       (1 otf:arab=init)
202       (2 = *)
203       >
204       (3 join))
205      ("(.)(T*)(.*)"                     ; == (D)(T*)(U.*)
206       <
207       (1 otf:arab=isol)
208       (2 = *)
209       >
210       (3 disjoin))))
211
212    ("(.)(T*)(.*)"                       ; == ([RU])(T*)(.*)
213     <
214     (1 otf:arab=isol)
215     (2 = *)
216     >
217     (3 disjoin)))))
218
219 ;; Step 3: Other GSUB features (ligatures, etc.)
220
221 (generator
222  (0
223   otf:arab=rlig,calt,liga,dlig,cswh,mset))
224
225 ;; Step 4: GPOS features.
226
227 (generator
228  (0
229   otf:arab=))
230
231 ;; Local Variables:
232 ;; mode: lisp
233 ;; End: