Update copyright year.
[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, 2008, 2010  AIST (H15PRO112)
3 ;; See the end for copying conditions.
4
5 (font layouter arab-otf nil
6       (font (nil nil unicode-bmp :otf=arab=init,medi,fina+mark)))
7
8 ;;; <li> ARAB-OTF.flt
9 ;;;
10 ;;; For Arabic OpenType fonts to draw the Arabic script.
11
12 ;; Step 0: Move Kazakh high hamza.
13
14 (category
15  ;; p: high hamza carrier (p for positive)
16  ;; n: high hamza suppressor (n for negative)
17  ;; x: don't care
18  ;; X: presentation form
19  (0x0600 0x06FF         ?x)
20  (0x0674 0x0678         ?p)
21  (0x0643                ?n)
22  (0x06AF                ?n)
23  (0x06D5                ?n)
24  (0x0750 0x077F         ?x)             ; Arabic Supplement
25  (0x200C                ?x)
26  (0x200D                ?x)
27  (0x25CC                ?x)
28  (0xFB50 0xFDFF         ?X)             ; Arabic Presentation Forms-A
29  (0xFE70 0xFEFC         ?X)             ; Arabic Presentation Forms-B
30  )
31
32 (generator
33  (0
34   (cond
35    ;; If a presentation form is found, draw the whole sequence as is.
36    (".*X.*" = *)
37
38    (".*p.*"                             ; If a high hamza is found,
39     (cond
40      (".*n.*"                           ;   and a suppressor exists,
41       rmhamza *)                        ;   then remove the high hamza.
42      (0                                 ;   Otherwise, move the high
43       0x674 rmhamza *)))                ;   hamza to the beginning.
44    (0 = *)))                            ; If no high hamza, do nothing.
45
46  (rmhamza
47   (cond
48    ((0x0674)            )
49    ((0x0675)            0x0627)
50    ((0x0676)            0x0648)
51    ((0x0677)            0x06C7)
52    ((0x0678)            0x0649)
53    ("."                 =))))
54
55 ;; Step 1: ccmp
56
57 (category
58  ;; D: Dual-joining (beh, teh, etc. & zwj)
59  ;; R: Right-joining (alef, dal, thal, reh, zain)
60  ;; U: Non-joining (Hamza, etc. & zwnj)
61  ;; T: Transparent (combining marks)
62  (0x0600 0x06FF         ?U)
63  (0x0610 0x0615         ?T)
64  (0x0622 0x0623         ?R)
65  (0x0624                ?R)
66  (0x0625                ?R)
67  (0x0626                ?D)
68  (0x0627                ?R)
69  (0x0628                ?D)
70  (0x0629                ?R)
71  (0x062A 0x062E         ?D)
72  (0x062F 0x0632         ?R)
73  (0x0633 0x0647         ?D)
74  (0x0648                ?R)
75  (0x0649 0x064A         ?D)
76  (0x064B 0x065E         ?T)
77  (0x066E 0x066F         ?D)
78  (0x0670                ?T)
79  (0x0671 0x0673         ?R)
80  (0x0679 0x0687         ?D)
81  (0x0688 0x0699         ?R)
82  (0x069A 0x06C3         ?D)
83  (0x06C4 0x06CB         ?R)
84  (0x06CC 0x06CE         ?D)
85  (0x06CF                ?R)
86  (0x06D0 0x06D3         ?D)
87  (0x06D5                ?R)
88  (0x06D6 0x06E4         ?T)
89  (0x06E7 0x06E8         ?T)
90  (0x06EA 0x06ED         ?T)
91  (0x06EE 0x06EF         ?R)
92  (0x06FA 0x06FC         ?D)
93  (0x06FF                ?D)
94  (0x0750 0x0758         ?D)
95  (0x0759 0x075B         ?R)
96  (0x075C 0x076A         ?D)
97  (0x076B 0x076C         ?R)
98  (0x076D 0x0770         ?D)
99  (0x0771                ?R)
100  (0x0772                ?D)
101  (0x0773 0x0774         ?R)
102  (0x0775 0x0777         ?D)
103  (0x0778 0x0779         ?R)
104  (0x077A 0x077F         ?D)
105  (0x200C                ?U)
106  (0x200D                ?D)
107  (0x25CC                ?U)
108  (0xFB50 0xFDFF         ?X)             ; Arabic Presentation Forms-A
109  (0xFE70 0xFEFC         ?X)             ; Arabic Presentation Forms-B
110  )
111
112 ;; (generator
113 ;;  (0
114 ;;   otf:arab=ccmp+))
115
116 ;; Step 2: Initial, medial, or final.
117
118 (generator
119  (0
120   (cond
121    (".*X.*" (cond ("[DRUX]T*" < = * >) ("." =)) *)
122
123    ("D.*"
124     (cond
125      ("(.)(T*)([DR].*)"
126       <
127       (1 otf:arab=init+)
128       (2 = *)
129       >
130       (3 join))
131      ("(.)(T*)(.*)"                     ; == (D)(T*)(U.*)
132       <
133       (1 otf:arab=isol+)
134       (2 = *)
135       >
136       (3 disjoin))))
137
138    ("([RU])(T*)(.*)"
139     <
140     (1 otf:arab=isol+)
141     (2 = *)
142     >
143     (3 disjoin))
144
145    ("(T+)(.*)"
146     (1 (cond
147         ((font-facility 0x25CC) < 0x25CC = * >)
148         (".+" [ = * ])))
149     (2 disjoin))))
150
151  (join
152   (cond
153    ("D.*"
154     (cond
155      ("(.)(T*)([DR].*)"
156       <
157       (1 otf:arab=medi+)
158       (2 = *)
159       >
160       (3 join))
161      ("(.)(T*)(.*)"                     ; == (D)(T*)(U.*)
162       <
163       (1 otf:arab=fina+)
164       (2 = *)
165       >
166       (3 disjoin))))
167
168    ("(.)(T*)(.*)"
169     <
170     (1 otf:arab=fina+)
171     (2 = *)
172     >
173     (3 disjoin))))
174
175  (disjoin
176   (cond
177    ("D.*"
178     (cond
179      ("(.)(T*)([DR].*)"
180       <
181       (1 otf:arab=init+)
182       (2 = *)
183       >
184       (3 join))
185      ("(.)(T*)(.*)"                     ; == (D)(T*)(U.*)
186       <
187       (1 otf:arab=isol+)
188       (2 = *)
189       >
190       (3 disjoin))))
191
192    ("(.)(T*)(.*)"                       ; == ([RU])(T*)(.*)
193     <
194     (1 otf:arab=isol+)
195     (2 = *)
196     >
197     (3 disjoin)))))
198
199 ;; Step 3: Other OTF features.
200
201 (generator
202  (0
203   otf:arab=rlig,calt,liga,dlig,cswh,mset+curs,kern,mark,mkmk))
204
205 ;; Copyright (C) 2004, 2006, 2007, 2008
206 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
207 ;;   Registration Number H15PRO112
208
209 ;; This file is part of the m17n database; a sub-part of the m17n
210 ;; library.
211
212 ;; The m17n library is free software; you can redistribute it and/or
213 ;; modify it under the terms of the GNU Lesser General Public License
214 ;; as published by the Free Software Foundation; either version 2.1 of
215 ;; the License, or (at your option) any later version.
216
217 ;; The m17n library is distributed in the hope that it will be useful,
218 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
219 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
220 ;; Lesser General Public License for more details.
221
222 ;; You should have received a copy of the GNU Lesser General Public
223 ;; License along with the m17n library; if not, write to the Free
224 ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
225 ;; 02111-1307, USA.
226
227 ;; Local Variables:
228 ;; mode: lisp
229 ;; End: